bmap_to_cubemap(
BMAP*)
Converts a six-sided sky cube bitmap into a cubic environment map,
which can be used for enviroment mapping or shader effects.
Parameters:
BMAP* - pointer to sky cube bitmap
Remarks:
- The bmap must look like a sky cube (see image below): consisting
of 6 adjacent square cube faces in the order south, east, north, west, down,
up. Thus its width must be six times larger than its height. The faces must
be tiled in a way that they can be wrapped around a cube. Each cube face must
be a power of 2 in size.
- Some old 3D cards (ATI) do not support cubic environment maps with
cube sizes larger than 256x256.
- For mipmapped environment
maps, create the mipmaps before calling bmap_to_cubemap (like bmap_to_cubemap(bmap_to_mipmap(skymap)).
Creating mipmaps afterwards will produce an invalid environment map.
-
For rendering into a face of an environment map, set the view pos_x parameter to the pixel position of the beginning of the face you want to render into.
Speed:
Slow
Edition:
C
P
Example:

BMAP* bmpEnviro = "skybox+6.tga";
MATERIAL* mtlEnviro =
{
skin2 = bmpEnviro;
effect = "
texture mtlSkin2;
technique enviro
{
pass P0
{
Texture[0] = <mtlSkin2>;
AddressU[0] = Clamp; // don't wrap around edges
AddressV[0] = Clamp;
ColorOp[0] = SelectArg1; // ignore the ambient light
ColorArg1[0] = Texture;
TexCoordIndex[0] = CameraSpaceReflectionVector;
TextureTransformFlags[0] = Count3;
}
}
technique fallback { pass p0 { } } // empty fallback causes normal rendering without effect
";
}
function mtlEnviro_startup()
{
bmap_to_cubemap(mtlEnviro.skin2);
}
See also:
CUBE, view.bmap
► latest
version online