Monday, April 16, 2007

Custom texture added

The latest addition to the GE2 is a new Custom Texture.

The Custom Texture is a special class that is used to programatically generate texture for other engine/game components to use. For example this can be use to generate default , white or lightmap textures.

The texture itself is already using the base texture class STexture. When user creates the texture, He just needs to pass RGBA data with it for each pixel.

Further on the texture is registered with the TextureManager and other parts of the engine can point to it if required. 

This is the code for example that is used to create the "white" texture which is used to render objects that are missing the lightmap:


//the white texture is stored here
CustomTexture _white;

//data
unsigned char whitepixel[4] ;

whitepixel[0] = 0xff;
whitepixel[1] = 0xff;
whitepixel[2] = 0xff;
whitepixel[3] = 0xff;

_white.Create( "white" , (unsigned char*)&whitepixel , 1 , 1 );

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home