🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

The infamous Lesson 10

Started by
2 comments, last by knowyourrole 18 years, 1 month ago
Lesson 10 adds all sorts of struct's and gives them all sorts of weird names. And one of the things that it does is opens in a READ ONLY format, a .txt document called world.txt . What exactly does this mean? I don't get it. Thank you for your time. NUMPOLLIES 36 // Floor 1 -3.0 0.0 -3.0 0.0 6.0 -3.0 0.0 3.0 0.0 0.0 3.0 0.0 3.0 6.0 0.0 -3.0 0.0 -3.0 0.0 6.0 3.0 0.0 -3.0 6.0 6.0 3.0 0.0 3.0 6.0 0.0 // Ceiling 1 -3.0 1.0 -3.0 0.0 6.0 -3.0 1.0 3.0 0.0 0.0 3.0 1.0 3.0 6.0 0.0 -3.0 1.0 -3.0 0.0 6.0 3.0 1.0 -3.0 6.0 6.0 3.0 1.0 3.0 6.0 0.0 // A1 -2.0 1.0 -2.0 0.0 1.0 -2.0 0.0 -2.0 0.0 0.0 -0.5 0.0 -2.0 1.5 0.0 -2.0 1.0 -2.0 0.0 1.0 -0.5 1.0 -2.0 1.5 1.0 -0.5 0.0 -2.0 1.5 0.0 // A2 2.0 1.0 -2.0 2.0 1.0 2.0 0.0 -2.0 2.0 0.0 0.5 0.0 -2.0 0.5 0.0 2.0 1.0 -2.0 2.0 1.0 0.5 1.0 -2.0 0.5 1.0 0.5 0.0 -2.0 0.5 0.0 // B1 -2.0 1.0 2.0 2.0 1.0 -2.0 0.0 2.0 2.0 0.0 -0.5 0.0 2.0 0.5 0.0 -2.0 1.0 2.0 2.0 1.0 -0.5 1.0 2.0 0.5 1.0 -0.5 0.0 2.0 0.5 0.0 // B2 2.0 1.0 2.0 2.0 1.0 2.0 0.0 2.0 2.0 0.0 0.5 0.0 2.0 0.5 0.0 2.0 1.0 2.0 2.0 1.0 0.5 1.0 2.0 0.5 1.0 0.5 0.0 2.0 0.5 0.0 // C1 -2.0 1.0 -2.0 0.0 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0.0 2.0 1.0 0.0 // Left hallway - Lw -3.0 1.0 0.5 1.0 1.0 -3.0 0.0 0.5 1.0 0.0 -2.0 0.0 0.5 0.0 0.0 -3.0 1.0 0.5 1.0 1.0 -2.0 1.0 0.5 0.0 1.0 -2.0 0.0 0.5 0.0 0.0 // Left hallway - Hi -3.0 1.0 -0.5 1.0 1.0 -3.0 0.0 -0.5 1.0 0.0 -2.0 0.0 -0.5 0.0 0.0 -3.0 1.0 -0.5 1.0 1.0 -2.0 1.0 -0.5 0.0 1.0 -2.0 0.0 -0.5 0.0 0.0 // Right hallway - Lw 3.0 1.0 0.5 1.0 1.0 3.0 0.0 0.5 1.0 0.0 2.0 0.0 0.5 0.0 0.0 3.0 1.0 0.5 1.0 1.0 2.0 1.0 0.5 0.0 1.0 2.0 0.0 0.5 0.0 0.0 // Right hallway - Hi 3.0 1.0 -0.5 1.0 1.0 3.0 0.0 -0.5 1.0 0.0 2.0 0.0 -0.5 0.0 0.0 3.0 1.0 -0.5 1.0 1.0 2.0 1.0 -0.5 0.0 1.0 2.0 0.0 -0.5 0.0 0.0
Advertisement
I assume you're talking about Nehe - lesson ten, in which case that would be the model file for the world. You write the model loader to convert all those numbers you see in the text file into vertices, and thus polygons onscreen.
But how do the numbers work. In other words. Can you explain the code.
I cant really explain any of the nehe code, I've only just skimmed over the lesson. As for the numbers in the text file, each row of five numbers is the data for a single vertex in your 3D scene. The first three numbers are the x, y and z coordinates, and last two numbers are the texture coordinates for that vertex.

X Y Z U V
-3.0 0.0 -3.0 0.0 6.0
-3.0 0.0 3.0 0.0 0.0
3.0 0.0 3.0 6.0 0.0

They are grouped into rows of three and six to define a triangle or a quad (two triangles obviously). The above just shows the 3 vertices of a triangle. Basically if you load in this vertex data somewhere, you can easily splurge it onto the screen with some openGL commands like glVertex, etc.

Hope that helped.

This topic is closed to new replies.

Advertisement