@@ -164,91 +164,6 @@ public static SHP1 Create(Scene scene, Dictionary<string, int> boneNames, Vertex
164164 return shp1 ;
165165 }
166166
167- private void SetMatrixIndices ( Vertex vert , EVP1 envelopes , DRW1 partialWeight , List < int > matrixIndices )
168- {
169- vert . SetAttributeIndex ( GXVertexAttribute . PositionMatrixIdx , ( uint ) matrixIndices . Count ) ;
170- matrixIndices . Add ( partialWeight . WeightTypeCheck . Count ) ;
171-
172- if ( vert . VertexWeight . WeightCount > 1 )
173- {
174- partialWeight . WeightTypeCheck . Add ( true ) ;
175- partialWeight . Indices . Add ( envelopes . Weights . Count ) ;
176- envelopes . Weights . Add ( vert . VertexWeight ) ;
177- }
178- else
179- {
180- partialWeight . WeightTypeCheck . Add ( false ) ;
181- partialWeight . Indices . Add ( vert . VertexWeight . BoneIndices [ 0 ] ) ;
182- }
183- }
184-
185- private void SetVertexIndices ( Mesh mesh , Vertex vert , VertexData vertData , ShapeVertexDescriptor descriptor , int vertIndex )
186- {
187- if ( descriptor . CheckAttribute ( GXVertexAttribute . Position ) )
188- {
189- Vector3D posVec = mesh . Vertices [ vertIndex ] ;
190- uint posIndex = ( uint ) vertData . Positions . IndexOf ( posVec . ToOpenTKVector3 ( ) ) ;
191- vert . SetAttributeIndex ( GXVertexAttribute . Position , posIndex ) ;
192- }
193- if ( descriptor . CheckAttribute ( GXVertexAttribute . Normal ) )
194- {
195- Vector3D normVec = mesh . Normals [ vertIndex ] ;
196- uint normIndex = ( uint ) vertData . Normals . IndexOf ( normVec . ToOpenTKVector3 ( ) ) ;
197- vert . SetAttributeIndex ( GXVertexAttribute . Normal , normIndex ) ;
198- }
199-
200- for ( int color = 0 ; color < 2 ; color ++ )
201- {
202- if ( descriptor . CheckAttribute ( GXVertexAttribute . Color0 + color ) )
203- {
204- Color4D assimpColor = mesh . VertexColorChannels [ color ] [ vertIndex ] ;
205- List < Color > colorData = ( List < Color > ) vertData . GetAttributeData ( GXVertexAttribute . Color0 + color ) ;
206- uint colIndex = ( uint ) colorData . IndexOf ( assimpColor . ToSuperBMDColorRGBA ( ) ) ;
207- vert . SetAttributeIndex ( GXVertexAttribute . Color0 + color , colIndex ) ;
208- }
209- }
210-
211- for ( int tex = 0 ; tex < 8 ; tex ++ )
212- {
213- if ( descriptor . CheckAttribute ( GXVertexAttribute . Tex0 + tex ) )
214- {
215- Vector3D texVec = mesh . TextureCoordinateChannels [ tex ] [ vertIndex ] ;
216- List < OpenTK . Vector2 > texData = ( List < OpenTK . Vector2 > ) vertData . GetAttributeData ( GXVertexAttribute . Tex0 + tex ) ;
217- uint texIndex = ( uint ) texData . IndexOf ( texVec . ToOpenTKVector2 ( ) ) ;
218- vert . SetAttributeIndex ( GXVertexAttribute . Tex0 + tex , texIndex ) ;
219- }
220- }
221- }
222-
223- public void DistributeWeights ( EVP1 envelopes , DRW1 partialWeights )
224- {
225- foreach ( Shape shape in Shapes )
226- {
227- foreach ( Packet pack in shape . Packets )
228- {
229- foreach ( Primitive prim in pack . Primitives )
230- {
231- foreach ( Vertex vert in prim . Vertices )
232- {
233- uint drw1Index = vert . GetAttributeIndex ( GXVertexAttribute . PositionMatrixIdx ) ;
234-
235- if ( partialWeights . WeightTypeCheck [ ( int ) drw1Index ] )
236- {
237- vert . SetWeight ( envelopes . Weights [ partialWeights . Indices [ ( int ) drw1Index ] ] ) ;
238- }
239- else
240- {
241- Rigging . Weight newWeight = new Rigging . Weight ( ) ;
242- newWeight . AddWeight ( 1.0f , partialWeights . Indices [ ( int ) drw1Index ] ) ;
243-
244- vert . SetWeight ( newWeight ) ;
245- }
246- }
247- }
248- }
249- }
250- }
251-
252167 public void Write ( EndianBinaryWriter writer )
253168 {
254169 List < Tuple < ShapeVertexDescriptor , int > > descriptorOffsets ; // Contains the offsets for each unique vertex descriptor
0 commit comments