TSE/Cubemaps

From TDN

Cubemaps, like Materials in TGEA, are defined through script. The structure used is 'CubemapData' and it simply references the 6 textures that make up the cube. The script looks like:

new CubemapData( Sky_Day_Blur02 )
{
   cubeFace[0] = "~/data/textures/sky_x_pos3";
   cubeFace[1] = "~/data/textures/sky_x_neg3";
   cubeFace[2] = "~/data/textures/sky_y_pos3";
   cubeFace[3] = "~/data/textures/sky_y_neg3";
   cubeFace[4] = "~/data/textures/sky_z_pos3";
   cubeFace[5] = "~/data/textures/sky_z_neg";
};

Note that the order of the textures is x, y, then z, positive and negative directions for each. Note also that each texture MUST be of the same size, or the cubemap will fail to be created.

The orientation of each texture must conform to how it is laid out in texture memory. For more information, consult the DirectX SDK docs. This link also currently works:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx8_vb/directx_vb/graphics_using_2ng3.asp


Once a CubemapData structure has been set up, it can be used in Materials like so:

new Material( Foo01 )
{
   baseTex[0] = "noise02";
   cubemap = Sky_Day_Blur02;
};

new Material( FooBar02 )
{
   baseTex[0] = "fooTex";
   cubemap = Sky_Day_Blur02;
};