CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
TrVisMaterialDef.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// GLES2 device material definition
24
25#ifndef ODTRVISMATERIALDEF
26#define ODTRVISMATERIALDEF
27
28#include "TD_PackPush.h"
29
30#include "TrVisMaterialColor.h"
31#include "TrVisTextureDef.h"
32
37{
38 // Main material channel color.
40 // Factor to blend between material channel color and vertex color [0 - full material color, 1 - full vertex color]
42 // Material transparency [0 - completely transparent, 1 - opaque]
43 float m_opacityLevel; // [Have sense for diffuse channel only]
44 // Channel coefficient [have different meaning for different channels]. Must be non-zero to make channel active.
45 // For specular channel: specular color (shininnes) component.
46 // For bump and normal map channels: bump (normal) map scale.
47 // For reflection and refracion channel: reflectance (refraction) coefficient.
48 // For other channels it is can provide color intensity or blending opacity multiplier and typically set as 1.
50 // Factor to blend between texture and channel color [0 - full channel color, 1 - full texture color]
52 // Texture ID
54 // Texture tiling (wrapping) method
56 {
62
63 // Setup channel defaults
64 void setDefault(float channelColor = 0.0f, float blendFactor = 1.0f, float channelValue = 0.0f)
65 {
66 m_channelColor[0] = m_channelColor[1] = m_channelColor[2] = channelColor;
67 m_blendFactor = blendFactor;
68 m_opacityLevel = 1.0f;
69 m_channelValue = channelValue;
70 m_textureBlend = 0.0f;
73 }
74 // Check that channel enabled
75 bool isEnabled() const { return !OdTrVisFPZero(m_channelValue); }
76};
77
82{
83 // Realistic material channel component
85 // Material channel component for non-realistic modes
87
88 // Setup channel defaults
89 void setDefault(float realisticColor = 0.0f, float shadingColor = 0.0f, float blendFactor = 1.0f, float channelValue = 0.0f)
90 {
91 m_realisticComponent.setDefault(realisticColor, blendFactor, channelValue);
92 m_shadingComponent.setDefault(shadingColor, blendFactor, channelValue);
93 }
94 // Copy realistic material component to shading material component
96 // Copy shading material component to realistic material component
98 // Check that channel enabled
99 bool isEnabled() const { return m_realisticComponent.isEnabled(); }
100 // Check that shading component enabled
102};
103
108{
109 // Ambient material channel
111 // Diffuse material channel
113 // Specular material channel
115 // Emission material channel
117 // Opacity material channel
119 // Bump material channel
121 // Reflection material channel
123 // Refraction material channel
125 // Normal map material channel
127 // Tint material channel
129
130 // Setup material defaults
132 {
133 m_ambientChannel.setDefault(0.0f, 0.0f, 0.0f, 1.0f);
134 m_diffuseChannel.setDefault(0.0f, 0.0f, 1.0f, 1.0f);
135 m_specularChannel.setDefault(1.0f, 0.0f, 0.0f, 50.0f);
143 }
144 // Copy realistic material component to shading material component
146 {
157 }
158 // Copy shading material component to realistic material component
160 {
171 }
172};
173
174#include "TD_PackPop.h"
175
176#endif // ODTRVISMATERIALDEF
const OdTrVisId kTrVisNullId
Definition: TrVisDefs.h:134
OD_FORCEINLINE bool OdTrVisFPZero(float a, float tol=1.e-8f)
Definition: TrVisDefs.h:246
enum OdTrVisMaterialChannelComponent::WrapType m_vWrap
OdTrVisMaterialColor m_channelColor
void setDefault(float channelColor=0.0f, float blendFactor=1.0f, float channelValue=0.0f)
enum OdTrVisMaterialChannelComponent::WrapType m_uWrap
void setDefault(float realisticColor=0.0f, float shadingColor=0.0f, float blendFactor=1.0f, float channelValue=0.0f)
OdTrVisMaterialChannelComponent m_realisticComponent
OdTrVisMaterialChannelComponent m_shadingComponent
OdTrVisMaterialChannelDef m_normMapChannel
OdTrVisMaterialChannelDef m_bumpMapChannel
OdTrVisMaterialChannelDef m_reflectChannel
OdTrVisMaterialChannelDef m_refractChannel
OdTrVisMaterialChannelDef m_emissionChannel
OdTrVisMaterialChannelDef m_ambientChannel
OdTrVisMaterialChannelDef m_diffuseChannel
OdTrVisMaterialChannelDef m_opacityChannel
OdTrVisMaterialChannelDef m_specularChannel
OdTrVisMaterialChannelDef m_tintChannel