enum class WRL1_BINDING

This commit is contained in:
Marek Roszko 2021-03-10 18:52:21 -05:00
parent 57dbb7def0
commit 737a23f7e6
4 changed files with 26 additions and 25 deletions

View File

@ -343,12 +343,12 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
switch( mbind )
{
case BIND_PER_FACE:
case BIND_PER_VERTEX:
case BIND_PER_VERTEX_INDEXED:
case WRL1_BINDING::BIND_PER_FACE:
case WRL1_BINDING::BIND_PER_VERTEX:
case WRL1_BINDING::BIND_PER_VERTEX_INDEXED:
break;
case BIND_PER_FACE_INDEXED:
case WRL1_BINDING::BIND_PER_FACE_INDEXED:
if( matIndex.empty() )
{
@ -357,7 +357,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
#endif
// support bad models by temporarily switching bindings
mbind = BIND_OVERALL;
mbind = WRL1_BINDING::BIND_OVERALL;
sgcolor = m_current.mat->GetAppearance( 0 );
}
@ -379,7 +379,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
size_t cidx = 0; // color index
SGCOLOR pc1;
if( mbind == BIND_OVERALL || mbind == BIND_DEFAULT )
if( mbind == WRL1_BINDING::BIND_OVERALL || mbind == WRL1_BINDING::BIND_DEFAULT )
{
// no per-vertex colors; we can save a few CPU cycles
for( iCoord = 0; iCoord < vsize; ++iCoord )
@ -433,7 +433,8 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
fp->Init();
}
if( mbind == BIND_PER_FACE || mbind == BIND_PER_FACE_INDEXED )
if( mbind == WRL1_BINDING::BIND_PER_FACE
|| mbind == WRL1_BINDING::BIND_PER_FACE_INDEXED )
++cidx;
continue;
@ -459,7 +460,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
// push the color if appropriate
switch( mbind )
{
case BIND_PER_FACE:
case WRL1_BINDING::BIND_PER_FACE:
if( !fp->HasColors() )
{
@ -469,12 +470,12 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
break;
case BIND_PER_VERTEX:
case WRL1_BINDING::BIND_PER_VERTEX:
m_current.mat->GetColor( &pc1, idx );
fp->AddColor( pc1 );
break;
case BIND_PER_FACE_INDEXED:
case WRL1_BINDING::BIND_PER_FACE_INDEXED:
if( !fp->HasColors() )
{
if( cidx >= matSize )
@ -487,7 +488,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
break;
case BIND_PER_VERTEX_INDEXED:
case WRL1_BINDING::BIND_PER_VERTEX_INDEXED:
if( matIndex.empty() )
{

View File

@ -33,7 +33,7 @@
WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
{
m_binding = BIND_OVERALL;
m_binding = WRL1_BINDING::BIND_OVERALL;
m_Type = WRL1_MATERIALBINDING;
return;
}
@ -42,7 +42,7 @@ WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary ) : WRL1NODE( aDiction
WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
WRL1NODE( aDictionary )
{
m_binding = BIND_OVERALL;
m_binding = WRL1_BINDING::BIND_OVERALL;
m_Type = WRL1_MATERIALBINDING;
m_Parent = aParent;
@ -218,35 +218,35 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
if( !glob.compare( "DEFAULT" ) )
{
m_binding = BIND_DEFAULT;
m_binding = WRL1_BINDING::BIND_DEFAULT;
}
else if( !glob.compare( "OVERALL" ) )
{
m_binding = BIND_OVERALL;
m_binding = WRL1_BINDING::BIND_OVERALL;
}
else if( !glob.compare( "PER_PART" ) )
{
m_binding = BIND_PER_PART;
m_binding = WRL1_BINDING::BIND_PER_PART;
}
else if( !glob.compare( "PER_PART_INDEXED" ) )
{
m_binding = BIND_PER_PART_INDEXED;
m_binding = WRL1_BINDING::BIND_PER_PART_INDEXED;
}
else if( !glob.compare( "PER_FACE" ) )
{
m_binding = BIND_PER_FACE;
m_binding = WRL1_BINDING::BIND_PER_FACE;
}
else if( !glob.compare( "PER_FACE_INDEXED" ) )
{
m_binding = BIND_PER_FACE_INDEXED;
m_binding = WRL1_BINDING::BIND_PER_FACE_INDEXED;
}
else if( !glob.compare( "PER_VERTEX" ) )
{
m_binding = BIND_PER_VERTEX;
m_binding = WRL1_BINDING::BIND_PER_VERTEX;
}
else if( !glob.compare( "PER_VERTEX_INDEXED" ) )
{
m_binding = BIND_PER_VERTEX_INDEXED;
m_binding = WRL1_BINDING::BIND_PER_VERTEX_INDEXED;
}
else
{
@ -261,7 +261,7 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
} while( 0 );
#endif
m_binding = BIND_OVERALL;
m_binding = WRL1_BINDING::BIND_OVERALL;
}
} // while( true ) -- reading contents of MaterialBinding{}

View File

@ -92,9 +92,9 @@ struct WRL1STATUS
void Init()
{
mat = NULL;
matbind = BIND_OVERALL;
matbind = WRL1_BINDING::BIND_OVERALL;
norm = NULL;
normbind = BIND_DEFAULT;
normbind = WRL1_BINDING::BIND_DEFAULT;
coord = NULL;
txmatrix = glm::scale( glm::mat4( 1.0 ), glm::vec3( 1.0 ) );
order = ORD_UNKNOWN;

View File

@ -94,7 +94,7 @@ enum WRL1NODES
// VRML1 Material/Normal Binding values
// note: PART/FACE have the same meaning in the specification
enum WRL1_BINDING
enum class WRL1_BINDING
{
BIND_DEFAULT = 0,
BIND_OVERALL,