@@ -94,14 +94,15 @@ var flipbookSwapKeyframes
9494 return finModel ;
9595 }
9696
97- public static ( IModel < ISkin < NormalUvVertexImpl > > , IBone ) CreateModel (
97+ public static ( IModel < ISkin < Normal1Color1UvVertexImpl > > , IBone ) CreateModel (
9898 ( IFileBundle fileBundle , IReadOnlySet < IReadOnlyGenericFile > files ) ?
9999 modelMetadata = null ) {
100100 var finModel =
101- new ModelImpl < NormalUvVertexImpl > ( ( index , position )
102- => new NormalUvVertexImpl (
103- index ,
104- position ) ) {
101+ new ModelImpl < Normal1Color1UvVertexImpl > ( ( index , position )
102+ => new
103+ Normal1Color1UvVertexImpl (
104+ index ,
105+ position ) ) {
105106 FileBundle = modelMetadata ? . fileBundle ! ,
106107 Files = modelMetadata ? . files !
107108 } ;
@@ -118,7 +119,8 @@ public static IBone CreateAdjustedRootBone(IModel finModel) {
118119 }
119120
120121 public static void AddToModel ( D3d d3d ,
121- IModel < ISkin < NormalUvVertexImpl > > finModel ,
122+ IModel < ISkin < Normal1Color1UvVertexImpl > >
123+ finModel ,
122124 IReadOnlyBone bone ,
123125 out IMesh finMesh ,
124126 IMaterial ? material = null ) {
@@ -139,8 +141,19 @@ public static void AddToModel(D3d d3d,
139141 }
140142 case D3dCommandType . END : {
141143 switch ( d3dPrimitiveType ) {
144+ case D3dPrimitiveType . TRIANGLE_FAN : {
145+ finMesh . AddTriangleFan ( finVertices . ToArray ( ) )
146+ . SetMaterial ( material ) ;
147+ break ;
148+ }
142149 case D3dPrimitiveType . TRIANGLE_LIST : {
143- finMesh . AddTriangles ( finVertices . ToArray ( ) ) . SetMaterial ( material ) ;
150+ finMesh . AddTriangles ( finVertices . ToArray ( ) )
151+ . SetMaterial ( material ) ;
152+ break ;
153+ }
154+ case D3dPrimitiveType . TRIANGLE_STRIP : {
155+ finMesh . AddTriangleStrip ( finVertices . ToArray ( ) )
156+ . SetMaterial ( material ) ;
144157 break ;
145158 }
146159 default : throw new NotImplementedException ( ) ;
@@ -170,6 +183,17 @@ public static void AddToModel(D3d d3d,
170183 finVertices . AddLast ( finVertex ) ;
171184 break ;
172185 }
186+ case D3dCommandType . VERTEX_TEXTURE_COLOR : {
187+ var d3dParams = d3dCommand . Parameters . AsSpan ( ) ;
188+
189+ var finVertex = finSkin . AddVertex ( new Vector3 ( d3dParams [ ..3 ] ) ) ;
190+ finVertex . SetUv ( new Vector2 ( d3dParams . Slice ( 3 , 2 ) ) ) ;
191+ finVertex . SetColor ( new Vector3 ( d3dParams . Slice ( 5 , 3 ) ) / 255f ) ;
192+ finVertex . SetBoneWeights ( boneWeights ) ;
193+
194+ finVertices . AddLast ( finVertex ) ;
195+ break ;
196+ }
173197 default : throw new ArgumentOutOfRangeException ( ) ;
174198 }
175199 }
0 commit comments