ghosthunter Posted August 10 Share Posted August 10 Recently I have studied the source code of pyrogenesis engine. And there're few confusing implementation. For example in the function "CPatchRData::BuildIndices" I can see indices in clockwise order - [0,0] -> [1,0] -> [0,1] -> [1,0] -> [1,1] -> [0,1] for (ssize_t j = 0; j < PATCH_SIZE; j++) { for (ssize_t i = 0; i < PATCH_SIZE; i++) { if (texgrid[j][i] == tex) { bool dir = terrain->GetTriangulationDir(px+i, pz+j); if (dir) { indices.push_back(u16(((j+0)*vsize+(i+0))+base)); indices.push_back(u16(((j+0)*vsize+(i+1))+base)); indices.push_back(u16(((j+1)*vsize+(i+0))+base)); indices.push_back(u16(((j+0)*vsize+(i+1))+base)); indices.push_back(u16(((j+1)*vsize+(i+1))+base)); indices.push_back(u16(((j+1)*vsize+(i+0))+base)); } else { indices.push_back(u16(((j+0)*vsize+(i+0))+base)); indices.push_back(u16(((j+0)*vsize+(i+1))+base)); indices.push_back(u16(((j+1)*vsize+(i+1))+base)); indices.push_back(u16(((j+1)*vsize+(i+1))+base)); indices.push_back(u16(((j+1)*vsize+(i+0))+base)); indices.push_back(u16(((j+0)*vsize+(i+0))+base)); } } } } However the default triangle winding of OpenGL is counter-clockwise. Anyway in the Atlas editor the terrain is stil visible with front faces up. I wonder whether such implementation is rectified with projection matrix and orientation matrix, Or this is just my misunderstanding in some point? Hope that some expert can provide help. I really appreciate that! 1 Link to comment Share on other sites More sharing options...
vladislavbelov Posted 17 minutes ago Share Posted 17 minutes ago Hi! And sorry for the long reply. On 10/8/2026 at 1:59 PM, ghosthunter said: I wonder whether such implementation is rectified with projection matrix and orientation matrix Yes, it's in sync with the projection matrix and culling mode. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now