CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
TrVisTextureDef.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23// Rendition texture definition
24
25#ifndef ODTRVISTEXTUREDEF
26#define ODTRVISTEXTUREDEF
27
28#include "TD_PackPush.h"
29
30#include "TrVisTexture.h"
31
36{
37 public:
39
40 // Constructors
43};
44
46
51{
52 // Flags
53 enum Flags
54 {
55 // Enable bilinear texture filtration.
56 kSmoothFilter = (1 << 0),
57 // Enable texture color with vertex color modulation.
58 kModulateColor = (1 << 1),
59 // Intensity map or height map. Actual for opacity maps. Means that alpha must be computed from RGB intensity even if alpha channel available.
60 kIntensityMap = (1 << 2),
61 // Image contain negative RGBA components, which is must be inverted before use.
62 kNegative = (1 << 3),
63 // Means that texture provide precalculated bump(normal)-map, so calculation for this channel isn't required.
64 kNormalMap = (1 << 4),
65 // Means that texture provide spherical environment map. If set together with cube map, spherical map must be calculated from cube map.
66 kSphereMap = (1 << 5),
67 // Means that texture provide cube environment map. If set together with spherical map, spherical map must be calculated and used instead of cube map as is.
68 kCubeMap = (1 << 6),
69 // Means that image is already grayscale (height or intensity map), so RGB intensity conversion isn't required, we can use any color channel instead as is.
70 kGrayscale = (1 << 7)
71 };
72 // Texture flags
74 // Texture
76 // Texture resolver
78
79 void resetFlags(OdUInt16 nFlags = 0)
80 {
81 m_flags = nFlags;
82 }
84 {
85 resetFlags();
86 m_pTexture = NULL;
87 }
88
90 {
91 if (!m_pTexture.isNull())
92 return m_pTexture;
93 if (!m_pResolver.isNull())
95 return OdTrVisTexturePtr();
96 }
98 {
99 m_pTexture = pTexture;
100 return m_pTexture;
101 }
102
103 void setSmoothFilter(bool bSet) { SETBIT(m_flags, kSmoothFilter, bSet); }
105
106 void setColorModulation(bool bSet) { SETBIT(m_flags, kModulateColor, bSet); }
108
109 void setIntensityMap(bool bSet) { SETBIT(m_flags, kIntensityMap, bSet); }
110 bool isIntensityMap() const { return GETBIT(m_flags, kIntensityMap); }
111
112 void setNegativeImage(bool bSet) { SETBIT(m_flags, kNegative, bSet); }
113 bool isNegativeImage() const { return GETBIT(m_flags, kNegative); }
114
115 void setNormalMap(bool bSet) { SETBIT(m_flags, kNormalMap, bSet); }
116 bool isNormalMap() const { return GETBIT(m_flags, kNormalMap); }
117
118 void setSphericalMap(bool bSet) { SETBIT(m_flags, kSphereMap, bSet); }
119 bool isSphericalMap() const { return GETBIT(m_flags, kSphereMap); }
120
121 void setCubeMap(bool bSet) { SETBIT(m_flags, kCubeMap, bSet); }
122 bool isCubeMap() const { return GETBIT(m_flags, kCubeMap); }
123
124 void setGrayscaleImage(bool bSet) { SETBIT(m_flags, kGrayscale, bSet); }
125 bool isGrayscaleImage() const { return GETBIT(m_flags, kGrayscale); }
126};
127
128#include "TD_PackPop.h"
129
130#endif // ODTRVISTEXTUREDEF
unsigned short OdUInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
OdSmartPtr< OdTrVisTexture > OdTrVisTexturePtr
Definition: TrVisTexture.h:210
OdSmartPtr< OdTrVisTextureResolver > OdTrVisTextureResolverPtr
bool isNull() const
Definition: BaseObjectPtr.h:86
virtual OdTrVisTexturePtr extractUnderlyingTexture()=0
static OdSmartPtr< OdTrVisTextureResolver > createSimplePreserver(const OdTrVisTexture *pTexture)
static OdSmartPtr< OdTrVisTextureResolver > createOnceTexturePreserver(const OdTrVisTexture *pTexture, const OdTrVisTextureResolver *pExtraResolver)
void setNegativeImage(bool bSet)
OdTrVisTextureResolverPtr m_pResolver
void setColorModulation(bool bSet)
void setSmoothFilter(bool bSet)
void setCubeMap(bool bSet)
bool colorModulationEnabled() const
bool isIntensityMap() const
OdTrVisTexturePtr m_pTexture
void setIntensityMap(bool bSet)
bool smoothFilterEnabled() const
bool isNormalMap() const
bool isNegativeImage() const
void setSphericalMap(bool bSet)
void setGrayscaleImage(bool bSet)
bool isGrayscaleImage() const
bool isCubeMap() const
void resetFlags(OdUInt16 nFlags=0)
OdTrVisTexturePtr setTexture(const OdTrVisTexture *pTexture)
void setNormalMap(bool bSet)
bool isSphericalMap() const
OdTrVisTexturePtr texture() const