@@ -5582,50 +5582,50 @@ static Model LoadGLTF(const char *fileName)
55825582 {
55835583 // Init raylib mesh vertices to copy glTF attribute data
55845584 model .meshes [meshIndex ].vertexCount = (int )attribute -> count ;
5585- model .meshes [meshIndex ].vertices = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
5585+ model .meshes [meshIndex ].vertices = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
55865586
55875587 // Load data into a temp buffer to be converted to raylib data type
5588- unsigned short * temp = (unsigned short * )RL_MALLOC (attribute -> count * 3 * sizeof (unsigned short ));
5588+ unsigned short * temp = (unsigned short * )RL_MALLOC (attribute -> count * 3 * sizeof (unsigned short ));
55895589 LOAD_ATTRIBUTE (attribute , 3 , unsigned short , temp );
55905590
55915591 // Convert data to raylib vertex data type (float) the matrix will scale it to the correct size as a float
5592- for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].vertices [t ] = (float )temp [t ];
5592+ for (unsigned int t = 0 ; t < attribute -> count 3 ; t ++ ) model .meshes [meshIndex ].vertices [t ] = (float )temp [t ];
55935593
55945594 RL_FREE (temp );
55955595
55965596 // Transform the vertices
5597- float * vertices = model .meshes [meshIndex ].vertices ;
5597+ float * vertices = model .meshes [meshIndex ].vertices ;
55985598 for (unsigned int k = 0 ; k < attribute -> count ; k ++ )
55995599 {
5600- Vector3 vt = Vector3Transform ((Vector3 ) { vertices [3 * k ], vertices [3 * k + 1 ], vertices [3 * k + 2 ] }, worldMatrix );
5601- vertices [3 * k ] = vt .x ;
5602- vertices [3 * k + 1 ] = vt .y ;
5603- vertices [3 * k + 2 ] = vt .z ;
5600+ Vector3 vt = Vector3Transform ((Vector3 ){ vertices [3 * k ], vertices [3 * k + 1 ], vertices [3 * k + 2 ] }, worldMatrix );
5601+ vertices [3 * k ] = vt .x ;
5602+ vertices [3 * k + 1 ] = vt .y ;
5603+ vertices [3 * k + 2 ] = vt .z ;
56045604 }
56055605 }
56065606 else if ((attribute -> type == cgltf_type_vec3 ) && (attribute -> component_type == cgltf_component_type_r_16 ))
56075607 {
56085608 // Init raylib mesh vertices to copy glTF attribute data
56095609 model .meshes [meshIndex ].vertexCount = (int )attribute -> count ;
5610- model .meshes [meshIndex ].vertices = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
5610+ model .meshes [meshIndex ].vertices = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
56115611
56125612 // Load data into a temp buffer to be converted to raylib data type
5613- short * temp = (short * )RL_MALLOC (attribute -> count * 3 * sizeof (short ));
5613+ short * temp = (short * )RL_MALLOC (attribute -> count * 3 * sizeof (short ));
56145614 LOAD_ATTRIBUTE (attribute , 3 , short , temp );
56155615
56165616 // Convert data to raylib vertex data type (float) the matrix will scale it to the correct size as a float
5617- for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].vertices [t ] = (float )temp [t ];
5617+ for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].vertices [t ] = (float )temp [t ];
56185618
56195619 RL_FREE (temp );
56205620
56215621 // Transform the vertices
5622- float * vertices = model .meshes [meshIndex ].vertices ;
5622+ float * vertices = model .meshes [meshIndex ].vertices ;
56235623 for (unsigned int k = 0 ; k < attribute -> count ; k ++ )
56245624 {
5625- Vector3 vt = Vector3Transform ((Vector3 ) { vertices [3 * k ], vertices [3 * k + 1 ], vertices [3 * k + 2 ] }, worldMatrix );
5626- vertices [3 * k ] = vt .x ;
5627- vertices [3 * k + 1 ] = vt .y ;
5628- vertices [3 * k + 2 ] = vt .z ;
5625+ Vector3 vt = Vector3Transform ((Vector3 ){ vertices [3 * k ], vertices [3 * k + 1 ], vertices [3 * k + 2 ] }, worldMatrix );
5626+ vertices [3 * k ] = vt .x ;
5627+ vertices [3 * k + 1 ] = vt .y ;
5628+ vertices [3 * k + 2 ] = vt .z ;
56295629 }
56305630 }
56315631 else TRACELOG (LOG_WARNING , "MODEL: [%s] Vertices attribute data format not supported, use vec3 float" , fileName );
@@ -5659,73 +5659,73 @@ static Model LoadGLTF(const char *fileName)
56595659 else if ((attribute -> type == cgltf_type_vec3 ) && (attribute -> component_type == cgltf_component_type_r_16 ))
56605660 {
56615661 // Init raylib mesh normals to copy glTF attribute data
5662- model .meshes [meshIndex ].normals = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
5662+ model .meshes [meshIndex ].normals = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
56635663
56645664 // Load data into a temp buffer to be converted to raylib data type
5665- short * temp = (short * )RL_MALLOC (attribute -> count * 3 * sizeof (short ));
5665+ short * temp = (short * )RL_MALLOC (attribute -> count * 3 * sizeof (short ));
56665666 LOAD_ATTRIBUTE (attribute , 3 , short , temp );
56675667
56685668 // Convert data to raylib normal data type (float)
5669- for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].normals [t ] = (float )temp [t ];
5669+ for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].normals [t ] = (float )temp [t ];
56705670
56715671 RL_FREE (temp );
56725672
56735673 // Transform the normals
5674- float * normals = model .meshes [meshIndex ].normals ;
5674+ float * normals = model .meshes [meshIndex ].normals ;
56755675 for (unsigned int k = 0 ; k < attribute -> count ; k ++ )
56765676 {
5677- Vector3 nt = Vector3Normalize (Vector3Transform ((Vector3 ) { normals [3 * k ], normals [3 * k + 1 ], normals [3 * k + 2 ] }, worldMatrixNormals ));
5678- normals [3 * k ] = nt .x ;
5679- normals [3 * k + 1 ] = nt .y ;
5680- normals [3 * k + 2 ] = nt .z ;
5677+ Vector3 nt = Vector3Normalize (Vector3Transform ((Vector3 ){ normals [3 * k ], normals [3 * k + 1 ], normals [3 * k + 2 ] }, worldMatrixNormals ));
5678+ normals [3 * k ] = nt .x ;
5679+ normals [3 * k + 1 ] = nt .y ;
5680+ normals [3 * k + 2 ] = nt .z ;
56815681 }
56825682 }
56835683 else if ((attribute -> type == cgltf_type_vec3 ) && (attribute -> component_type == cgltf_component_type_r_8u ))
56845684 {
56855685 // Init raylib mesh normals to copy glTF attribute data
5686- model .meshes [meshIndex ].normals = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
5686+ model .meshes [meshIndex ].normals = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
56875687
56885688 // Load data into a temp buffer to be converted to raylib data type
5689- unsigned char * temp = (unsigned char * )RL_MALLOC (attribute -> count * 3 * sizeof (unsigned char ));
5689+ unsigned char * temp = (unsigned char * )RL_MALLOC (attribute -> count * 3 * sizeof (unsigned char ));
56905690 LOAD_ATTRIBUTE (attribute , 3 , unsigned char , temp );
56915691
56925692 // Convert data to raylib normal data type (float)
5693- for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].normals [t ] = (float )temp [t ];
5693+ for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].normals [t ] = (float )temp [t ];
56945694
56955695 RL_FREE (temp );
56965696
56975697 // Transform the normals
5698- float * normals = model .meshes [meshIndex ].normals ;
5698+ float * normals = model .meshes [meshIndex ].normals ;
56995699 for (unsigned int k = 0 ; k < attribute -> count ; k ++ )
57005700 {
5701- Vector3 nt = Vector3Normalize (Vector3Transform ((Vector3 ) { normals [3 * k ], normals [3 * k + 1 ], normals [3 * k + 2 ] }, worldMatrixNormals ));
5702- normals [3 * k ] = nt .x ;
5703- normals [3 * k + 1 ] = nt .y ;
5704- normals [3 * k + 2 ] = nt .z ;
5701+ Vector3 nt = Vector3Normalize (Vector3Transform ((Vector3 ){ normals [3 * k ], normals [3 * k + 1 ], normals [3 * k + 2 ] }, worldMatrixNormals ));
5702+ normals [3 * k ] = nt .x ;
5703+ normals [3 * k + 1 ] = nt .y ;
5704+ normals [3 * k + 2 ] = nt .z ;
57055705 }
57065706 }
57075707 else if ((attribute -> type == cgltf_type_vec3 ) && (attribute -> component_type == cgltf_component_type_r_8 ))
57085708 {
57095709 // Init raylib mesh normals to copy glTF attribute data
5710- model .meshes [meshIndex ].normals = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
5710+ model .meshes [meshIndex ].normals = (float * )RL_MALLOC (attribute -> count * 3 * sizeof (float ));
57115711
57125712 // Load data into a temp buffer to be converted to raylib data type
5713- char * temp = (char * )RL_MALLOC (attribute -> count * 3 * sizeof (char ));
5713+ char * temp = (char * )RL_MALLOC (attribute -> count * 3 * sizeof (char ));
57145714 LOAD_ATTRIBUTE (attribute , 3 , char , temp );
57155715
57165716 // Convert data to raylib normal data type (float)
5717- for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].normals [t ] = (float )temp [t ];
5717+ for (unsigned int t = 0 ; t < attribute -> count * 3 ; t ++ ) model .meshes [meshIndex ].normals [t ] = (float )temp [t ];
57185718
57195719 RL_FREE (temp );
57205720
57215721 // Transform the normals
5722- float * normals = model .meshes [meshIndex ].normals ;
5722+ float * normals = model .meshes [meshIndex ].normals ;
57235723 for (unsigned int k = 0 ; k < attribute -> count ; k ++ )
57245724 {
5725- Vector3 nt = Vector3Normalize (Vector3Transform ((Vector3 ) { normals [3 * k ], normals [3 * k + 1 ], normals [3 * k + 2 ] }, worldMatrixNormals ));
5726- normals [3 * k ] = nt .x ;
5727- normals [3 * k + 1 ] = nt .y ;
5728- normals [3 * k + 2 ] = nt .z ;
5725+ Vector3 nt = Vector3Normalize (Vector3Transform ((Vector3 ){ normals [3 * k ], normals [3 * k + 1 ], normals [3 * k + 2 ] }, worldMatrixNormals ));
5726+ normals [3 * k ] = nt .x ;
5727+ normals [3 * k + 1 ] = nt .y ;
5728+ normals [3 * k + 2 ] = nt .z ;
57295729 }
57305730 }
57315731 else TRACELOG (LOG_WARNING , "MODEL: [%s] Normals attribute data format not supported, use vec3 float" , fileName );
0 commit comments