NL3D::SCloudTexture3D Struct Reference

#include <cloud_scape.h>


Public Member Functions

void init (uint32 nWidth, uint32 nHeight, uint32 nDepth)
 SCloudTexture3D ()

Data Fields

uint32 Depth
uint32 Height
uint8Mem
uint32 NbH
uint32 NbW
NLMISC::CSmartPtr< NL3D::CTextureMemTex
NL3D::CMaterial ToBill
NL3D::CMaterial ToLight
uint32 Width


Constructor & Destructor Documentation

NL3D::SCloudTexture3D::SCloudTexture3D  ) 
 

Definition at line 51 of file cloud_scape.cpp.

References NL3D::CMaterial::initUnlit(), Mem, NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDoubleSided(), NL3D::CMaterial::setShader(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), NL3D::CMaterial::texEnvArg0Alpha(), NL3D::CMaterial::texEnvArg0RGB(), NL3D::CMaterial::texEnvArg1RGB(), NL3D::CMaterial::texEnvOpAlpha(), NL3D::CMaterial::texEnvOpRGB(), ToBill, and ToLight.

00052 {
00053         Mem = NULL;
00054         ToLight.initUnlit();
00055         ToLight.setShader (CMaterial::Normal);
00056         //ToLight.setTexture (0, Tex);
00057         ToLight.setZFunc (CMaterial::always);
00058         ToLight.setZWrite (false);
00059         ToLight.texEnvOpRGB (0, CMaterial::Replace);
00060         ToLight.texEnvArg0RGB (0, CMaterial::Diffuse, CMaterial::SrcColor);
00061         ToLight.texEnvOpAlpha (0, CMaterial::Replace);
00062         ToLight.texEnvArg0Alpha (0, CMaterial::Texture, CMaterial::InvSrcAlpha);
00063         ToLight.setBlend (true);
00064         ToLight.setBlendFunc (CMaterial::invsrcalpha, CMaterial::srcalpha);
00065         ToLight.setColor (CRGBA(0,0,0,255));
00066 
00067         ToBill.initUnlit();
00068         ToBill.setZFunc (CMaterial::always);
00069         ToBill.setZWrite (false);
00070         ToBill.setDoubleSided(true);
00071 
00072         ToBill.texEnvOpRGB (0, CMaterial::Add);
00073         ToBill.texEnvArg0RGB (0, CMaterial::Texture, CMaterial::SrcColor);
00074         ToBill.texEnvArg1RGB (0, CMaterial::Diffuse, CMaterial::SrcColor);
00075         ToBill.setColor (CRGBA(80,80,80,255));
00076 
00077         ToBill.texEnvOpAlpha (0, CMaterial::Replace);
00078         ToBill.texEnvArg0Alpha (0, CMaterial::Texture, CMaterial::SrcAlpha);
00079 
00080         ToBill.texEnvOpRGB (1, CMaterial::Modulate);
00081         ToBill.texEnvArg0RGB (1, CMaterial::Previous, CMaterial::SrcColor);
00082         ToBill.texEnvArg1RGB (1, CMaterial::Previous, CMaterial::SrcAlpha);
00083         ToBill.texEnvOpAlpha (1, CMaterial::Replace);
00084         ToBill.texEnvArg0Alpha (1, CMaterial::Previous, CMaterial::SrcAlpha);
00085 
00086         ToBill.setBlendFunc (CMaterial::one, CMaterial::invsrcalpha);
00087         ToBill.setBlend (true);
00088 }


Member Function Documentation

void NL3D::SCloudTexture3D::init uint32  nWidth,
uint32  nHeight,
uint32  nDepth
 

Definition at line 91 of file cloud_scape.cpp.

References Depth, NLMISC::getPowerOf2(), Height, Mem, NbH, NbW, NLMISC::raiseToNextPowerOf2(), NL3D::CMaterial::setTexture(), Tex, ToBill, ToLight, uint32, uint8, and Width.

Referenced by NL3D::CCloudScape::init().

00092 {
00093         if (Mem != NULL)
00094                 return;
00095 
00096         Width = raiseToNextPowerOf2 (nWidth);
00097         Height = raiseToNextPowerOf2 (nHeight);
00098         Depth = raiseToNextPowerOf2 (nDepth);
00099         uint32 vdpo2 = getPowerOf2(Depth);
00100         NbW = 1 << (vdpo2 / 2);
00101         if ((vdpo2 & 1) != 0)
00102                 NbH = 2 << (vdpo2 / 2);
00103         else
00104                 NbH = 1 << (vdpo2 / 2);
00105 
00106         Mem = new uint8[4*NbW*Width*NbH*Height];
00107         Tex = new CTextureMem (Mem, 4*NbW*Width*NbH*Height, true, false, NbW*Width, NbH*Height, CBitmap::RGBA);
00108 
00109         Tex->setWrapS (ITexture::Clamp);
00110         Tex->setWrapT (ITexture::Clamp);
00111         Tex->setFilterMode (ITexture::Linear, ITexture::LinearMipMapOff);
00112         Tex->setReleasable (false);
00113         Tex->generate ();
00114 
00115         ToLight.setTexture (0, Tex);
00116 
00117         ToBill.setTexture(0, Tex);
00118         ToBill.setTexture(1, Tex);
00119 }


Field Documentation

uint32 NL3D::SCloudTexture3D::Depth
 

Definition at line 48 of file cloud_scape.h.

Referenced by init().

uint32 NL3D::SCloudTexture3D::Height
 

Definition at line 48 of file cloud_scape.h.

Referenced by init().

uint8* NL3D::SCloudTexture3D::Mem
 

Definition at line 50 of file cloud_scape.h.

Referenced by init(), and SCloudTexture3D().

uint32 NL3D::SCloudTexture3D::NbH
 

Definition at line 49 of file cloud_scape.h.

Referenced by init().

uint32 NL3D::SCloudTexture3D::NbW
 

Definition at line 49 of file cloud_scape.h.

Referenced by init().

NLMISC::CSmartPtr<NL3D::CTextureMem> NL3D::SCloudTexture3D::Tex
 

Definition at line 51 of file cloud_scape.h.

Referenced by NL3D::CCloud::disp(), NL3D::CCloud::generate(), init(), and NL3D::CCloud::light().

NL3D::CMaterial NL3D::SCloudTexture3D::ToBill
 

Definition at line 53 of file cloud_scape.h.

Referenced by NL3D::CCloud::genBill(), init(), and SCloudTexture3D().

NL3D::CMaterial NL3D::SCloudTexture3D::ToLight
 

Definition at line 52 of file cloud_scape.h.

Referenced by init(), NL3D::CCloud::light(), and SCloudTexture3D().

uint32 NL3D::SCloudTexture3D::Width
 

Definition at line 48 of file cloud_scape.h.

Referenced by init().


The documentation for this struct was generated from the following files:
Generated on Tue Mar 16 08:42:06 2004 for NeL by doxygen 1.3.6