@@ -2986,7 +2986,7 @@ public ThreeDimCabDigit(Viewer viewer, int iMatrix, string size, string aceFile,
29862986
29872987 //create the shape primitive
29882988 shapePrimitive = new MutableShapePrimitive ( Material , NumVertices , NumIndices , new [ ] { - 1 } , 0 ) ;
2989- UpdateShapePrimitive ( ) ;
2989+ UpdateShapePrimitive ( Material ) ;
29902990
29912991 }
29922992
@@ -3085,11 +3085,11 @@ public void UpdateDigit()
30853085 }
30863086
30873087 //update the shape primitive
3088- UpdateShapePrimitive ( ) ;
3088+ UpdateShapePrimitive ( UsedMaterial ) ;
30893089
30903090 }
30913091
3092- private void UpdateShapePrimitive ( )
3092+ private void UpdateShapePrimitive ( Material material )
30933093 {
30943094 var indexData = new short [ NumIndices ] ;
30953095 Array . Copy ( TriangleListIndices , indexData , NumIndices ) ;
@@ -3098,6 +3098,8 @@ private void UpdateShapePrimitive()
30983098 var vertexData = new VertexPositionNormalTexture [ NumVertices ] ;
30993099 Array . Copy ( VertexList , vertexData , NumVertices ) ;
31003100 shapePrimitive . SetVertexData ( vertexData , 0 , NumVertices , NumIndices / 3 ) ;
3101+
3102+ shapePrimitive . SetMaterial ( material ) ;
31013103 }
31023104
31033105 //ACE MAP:
@@ -3216,8 +3218,9 @@ public ThreeDimCabGaugeNative(Viewer viewer, int iMatrix, string size, string le
32163218
32173219
32183220 //create the shape primitive
3219- shapePrimitive = new MutableShapePrimitive ( FindMaterial ( ) , NumVertices , NumIndices , new [ ] { - 1 } , 0 ) ;
3220- UpdateShapePrimitive ( ) ;
3221+ var material = FindMaterial ( ) ;
3222+ shapePrimitive = new MutableShapePrimitive ( material , NumVertices , NumIndices , new [ ] { - 1 } , 0 ) ;
3223+ UpdateShapePrimitive ( material ) ;
32213224
32223225 }
32233226
@@ -3229,13 +3232,14 @@ Material FindMaterial()
32293232 {
32303233 if ( PositiveMaterial == null )
32313234 {
3232- PositiveMaterial = new SolidColorMaterial ( this . Viewer , 0f , c . R , c . G , c . B ) ;
3235+ PositiveMaterial = new SolidColorMaterial ( this . Viewer , c . A , c . R , c . G , c . B ) ;
32333236 }
32343237 return PositiveMaterial ;
32353238 }
32363239 else
32373240 {
3238- if ( NegativeMaterial == null ) NegativeMaterial = new SolidColorMaterial ( this . Viewer , c . A , c . R , c . G , c . B ) ;
3241+ if ( NegativeMaterial == null )
3242+ NegativeMaterial = new SolidColorMaterial ( this . Viewer , c . A , c . R , c . G , c . B ) ;
32393243 return NegativeMaterial ;
32403244 }
32413245 }
@@ -3298,7 +3302,7 @@ public void UpdateDigit()
32983302 NumVertices += 4 ;
32993303
33003304 //update the shape primitive
3301- UpdateShapePrimitive ( ) ;
3305+ UpdateShapePrimitive ( UsedMaterial ) ;
33023306
33033307 }
33043308
@@ -3330,7 +3334,7 @@ static float GetTextureCoordY(char c)
33303334 return 1.0f ;
33313335 }
33323336
3333- private void UpdateShapePrimitive ( )
3337+ private void UpdateShapePrimitive ( Material material )
33343338 {
33353339 var indexData = new short [ NumIndices ] ;
33363340 Array . Copy ( TriangleListIndices , indexData , NumIndices ) ;
@@ -3339,6 +3343,8 @@ private void UpdateShapePrimitive()
33393343 var vertexData = new VertexPositionNormalTexture [ NumVertices ] ;
33403344 Array . Copy ( VertexList , vertexData , NumVertices ) ;
33413345 shapePrimitive . SetVertexData ( vertexData , 0 , NumVertices , NumIndices / 3 ) ;
3346+
3347+ shapePrimitive . SetMaterial ( material ) ;
33423348 }
33433349
33443350 public void PrepareFrame ( RenderFrame frame , ElapsedTime elapsedTime )
0 commit comments