What section of the code renders the textures?

Jun 18, 2013 at 9:09 AM
I simply cannot find the section of the code that actually renders the texture to the face of a cube.

Its a but frustrating, hours of searching through tutorials, and none of them describe efficiently, or how for that matter, how to draw multiple textures to a cube. Thank you for the source code, it is very helpful, but I do wish there were more comments!

So... Could someone show me what class/method or effect applies the textures while drawing? Please and thank you very much!
Jul 14, 2013 at 3:22 AM
Edited Jul 14, 2013 at 3:23 AM
Unfortunately Im still learning the code myself (and the details of XNA/c#)... but first thing - depends on whether you are looking at the NewTake (newer but not finished) code or the TechCraft code (older but more complete).

TechCraft: I think the textures are assigned via the Effects parameters. Have a look at the line as follows in TechCraft4.0Engine\WorldEngine\World.cs:
(the _textureAtlas is a texture containing the spritesheet of blocks)

Very similar (AFAIK) in NewTake, except that the code is in NewTake\view\Renderers\SimpleRenderer.cs:
And getting beyond that - to the effects files themselves (SolidBlockEffect.fx), is getting beyond me to understand properly at this point...

Someone kindly correct me if I'm wrong? :)
Jul 20, 2013 at 11:31 PM
In the original techcraft code...

I think what you're looking for is the BlockInformation class
This is what the engine uses to determine which texture is used for the different faces of a block.

The actual process of building the vertex buffers and applying the textures is done in the region class

In newtake...

The actual rendering is done by one of the renderers eg.

The newtake code is a bit messy since there was a lot of experimental stuff added to the code

Hope this helps