Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WII, Uses my vertex struct.
- void ModelPart::DrawPart()
- {
- //Set the texture to be used.
- if(modelMaterial->texture){
- GX_LoadTexObj(&modelMaterial->texture->_textureObject, GX_TEXMAP0);
- }
- //Begin the drawing process for the designated amount of vertices.
- GX_Begin(GX_TRIANGLES, GX_VTXFMT0, _vertexList.size());
- //Loop through all of the vertices and send each attribute, such as the position and stuff.
- for(int i = 0; i < _vertexList.size(); i++){
- GX_Position3f32(positionArray[_vertexList.at(i).vertexID * positionStride], positionArray[_vertexList.at(i).vertexID * positionStride + 1], positionArray[_vertexList.at(i).vertexID * positionStride + 2]);
- GX_Color4u8(255, 255, 255, 255);
- GX_TexCoord2f32(uvArray[_vertexList.at(i).uvID * uvStride], 1 - uvArray[_vertexList.at(i).uvID * uvStride + 1]);
- }
- GX_End();
- }
- //3DS, Uses hard coded values.
- C3D_ImmDrawBegin(GPU_TRIANGLES);
- C3D_ImmSendAttrib(200.0f, 200.0f, 0.5f, 0.0f); // v0=position
- C3D_ImmSendAttrib(1.0f, 0.0f, 0.0f, 1.0f); // v1=color
- C3D_ImmSendAttrib(100.0f, 40.0f, 0.5f, 0.0f);
- C3D_ImmSendAttrib(0.0f, 1.0f, 0.0f, 1.0f);
- C3D_ImmSendAttrib(300.0f, 40.0f, 0.5f, 0.0f);
- C3D_ImmSendAttrib(0.0f, 0.0f, 1.0f, 1.0f);
- C3D_ImmDrawEnd();
Advertisement
Add Comment
Please, Sign In to add comment