You need to sign in or sign up before continuing.
Commit b1c52e4d authored by hybrid's avatar hybrid

Minor coding changes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1166 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 0e88bcc1
...@@ -307,7 +307,7 @@ namespace scene ...@@ -307,7 +307,7 @@ namespace scene
//! adds Volume Lighting Scene Node. //! adds Volume Lighting Scene Node.
//! the returned pointer must not be dropped. //! the returned pointer must not be dropped.
// Example Useage: // Example Usage:
// scene::ISceneNode * n = smgr->addVolumeLightSceneNode(NULL, -1, // scene::ISceneNode * n = smgr->addVolumeLightSceneNode(NULL, -1,
// 32, //Sub Divid U // 32, //Sub Divid U
// 32, //Sub Divid V // 32, //Sub Divid V
...@@ -322,7 +322,7 @@ namespace scene ...@@ -322,7 +322,7 @@ namespace scene
// } // }
// //
virtual ISceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, virtual ISceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1,
const s32 subdivU = 32, const s32 subdivV = 32, const u32 subdivU = 32, const u32 subdivV = 32,
const video::SColor foot = video::SColor(51, 0, 230, 180), const video::SColor foot = video::SColor(51, 0, 230, 180),
const video::SColor tail = video::SColor(0, 0, 0, 0), const video::SColor tail = video::SColor(0, 0, 0, 0),
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& position = core::vector3df(0,0,0),
......
...@@ -415,9 +415,8 @@ ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer, ...@@ -415,9 +415,8 @@ ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer,
//! adds Volume Lighting Scene Node. //! adds Volume Lighting Scene Node.
//! the returned pointer must not be dropped. //! the returned pointer must not be dropped.
ISceneNode* CSceneManager::addVolumeLightSceneNode(ISceneNode* parent, s32 id, ISceneNode* CSceneManager::addVolumeLightSceneNode(ISceneNode* parent, s32 id,
const s32 subdivU, const s32 subdivV, const u32 subdivU, const u32 subdivV,
const video::SColor foot, const video::SColor foot, const video::SColor tail,
const video::SColor tail,
const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale) const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale)
{ {
if (!parent) if (!parent)
......
...@@ -53,7 +53,7 @@ namespace scene ...@@ -53,7 +53,7 @@ namespace scene
//! adds Volume Lighting Scene Node. //! adds Volume Lighting Scene Node.
//! the returned pointer must not be dropped. //! the returned pointer must not be dropped.
virtual ISceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, virtual ISceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1,
const s32 subdivU = 32, const s32 subdivV = 32, const u32 subdivU = 32, const u32 subdivV = 32,
const video::SColor foot = video::SColor(51, 0, 230, 180), const video::SColor foot = video::SColor(51, 0, 230, 180),
const video::SColor tail = video::SColor(0, 0, 0, 0), const video::SColor tail = video::SColor(0, 0, 0, 0),
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& rotation = core::vector3df(0,0,0), const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& rotation = core::vector3df(0,0,0), const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f));
......
...@@ -17,32 +17,20 @@ namespace scene ...@@ -17,32 +17,20 @@ namespace scene
//! constructor //! constructor
CVolumeLightSceneNode::CVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, CVolumeLightSceneNode::CVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr,
s32 id, const s32 subdivU, const s32 subdivV, s32 id, const u32 subdivU, const u32 subdivV,
const video::SColor foot, const video::SColor foot,
const video::SColor tail, const video::SColor tail,
const core::vector3df& position, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale) const core::vector3df& rotation, const core::vector3df& scale)
: ISceneNode(parent, mgr, id, position, rotation, scale) : ISceneNode(parent, mgr, id, position, rotation, scale), Buffer(0),
LPDistance(8.0f), SubdivideU(subdivU), SubdivideV(subdivV),
FootColour(foot), TailColour(tail),
LightDimensions(core::vector3df(1.0f, 1.2f, 1.0f))
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CVolumeLightSceneNode"); setDebugName("CVolumeLightSceneNode");
#endif #endif
video::IVideoDriver* driver = SceneManager->getVideoDriver();
lightDimensions = core::vector3df(1.0f, 1.2f, 1.0f);
mlpDistance = 8.0f;
mSubdivideU = subdivU;
mSubdivideV = subdivV;
//test light
mfootColour = foot;
mtailColour = tail;
Buffer = NULL;
constructLight(); constructLight();
} }
...@@ -54,10 +42,11 @@ CVolumeLightSceneNode::~CVolumeLightSceneNode() ...@@ -54,10 +42,11 @@ CVolumeLightSceneNode::~CVolumeLightSceneNode()
Buffer->drop(); Buffer->drop();
} }
void CVolumeLightSceneNode::addToBuffer(video::S3DVertex v) void CVolumeLightSceneNode::addToBuffer(video::S3DVertex v)
{ {
s32 tnidx = Buffer->Vertices.linear_reverse_search(v); const s32 tnidx = Buffer->Vertices.linear_reverse_search(v);
bool alreadyIn = (tnidx != -1); const bool alreadyIn = (tnidx != -1);
u16 nidx = (u16)tnidx; u16 nidx = (u16)tnidx;
if (!alreadyIn) { if (!alreadyIn) {
nidx = Buffer->Vertices.size(); nidx = Buffer->Vertices.size();
...@@ -68,117 +57,120 @@ void CVolumeLightSceneNode::addToBuffer(video::S3DVertex v) ...@@ -68,117 +57,120 @@ void CVolumeLightSceneNode::addToBuffer(video::S3DVertex v)
} }
void CVolumeLightSceneNode::constructLight() void CVolumeLightSceneNode::constructLight()
{ {
core::vector3df lightPoint = core::vector3df(0, -(mlpDistance*lightDimensions.Y), 0); const core::vector3df lightPoint(0, -(LPDistance*LightDimensions.Y), 0);
f32 ax = lightDimensions.X / 2.0f; // X Axis const f32 ax = LightDimensions.X * 0.5f; // X Axis
f32 az = lightDimensions.Z / 2.0f; // Z Axis const f32 az = LightDimensions.Z * 0.5f; // Z Axis
if (Buffer) if (Buffer)
Buffer->drop(); Buffer->drop();
Buffer = new SMeshBuffer(); Buffer = new SMeshBuffer();
//draw the bottom foot.. the glowing region
addToBuffer(video::S3DVertex(-ax, 0, az, 0,0,0, mfootColour, 0, 1));
addToBuffer(video::S3DVertex(ax , 0, az, 0,0,0, mfootColour, 1, 1));
addToBuffer(video::S3DVertex(ax , 0,-az, 0,0,0, mfootColour, 1, 0));
addToBuffer(video::S3DVertex(ax , 0,-az, 0,0,0, mfootColour, 1, 0));
addToBuffer(video::S3DVertex(-ax, 0,-az, 0,0,0, mfootColour, 0, 0));
addToBuffer(video::S3DVertex(-ax, 0, az, 0,0,0, mfootColour, 0, 1));
//draw the bottom foot.. the glowing region
addToBuffer(video::S3DVertex(-ax, 0, az, 0,0,0, FootColour, 0, 1));
addToBuffer(video::S3DVertex(ax , 0, az, 0,0,0, FootColour, 1, 1));
addToBuffer(video::S3DVertex(ax , 0,-az, 0,0,0, FootColour, 1, 0));
addToBuffer(video::S3DVertex(ax , 0,-az, 0,0,0, FootColour, 1, 0));
addToBuffer(video::S3DVertex(-ax, 0,-az, 0,0,0, FootColour, 0, 0));
addToBuffer(video::S3DVertex(-ax, 0, az, 0,0,0, FootColour, 0, 1));
f32 tu = 0.f;
const f32 tuStep = 1.f/SubdivideU;
f32 bx = -ax;
const f32 bxStep = LightDimensions.X * tuStep;
// Slices in X/U space // Slices in X/U space
for(s32 i = 0; i <= mSubdivideU; i++) { for (u32 i = 0; i <= SubdivideU; ++i)
f32 k = ((f32)i) / mSubdivideU; // use for the texture coord {
f32 bx = ((lightDimensions.X / (f32)mSubdivideU) * i) - ax;
//printf("bx: %f\n", bx);
// These are the two endpoints for a slice at the foot // These are the two endpoints for a slice at the foot
core::vector3df end1(bx, 0.0f, -az); core::vector3df end1(bx, 0.0f, -az);
core::vector3df end2(bx, 0.0f, az); core::vector3df end2(bx, 0.0f, az);
end1 -= lightPoint; // get a vector from point to lightsource end1 -= lightPoint; // get a vector from point to lightsource
end1.normalize(); // normalize vector end1.normalize(); // normalize vector
end1 *= lightDimensions.Y; // multiply it out by shootlength end1 *= LightDimensions.Y; // multiply it out by shootlength
end1.X += bx; // Add the original point location to the vector end1.X += bx; // Add the original point location to the vector
end1.Z -= az; end1.Z -= az;
// Do it again for the other point. // Do it again for the other point.
end2 -= lightPoint; end2 -= lightPoint;
end2.normalize(); end2.normalize();
end2 *= lightDimensions.Y; end2 *= LightDimensions.Y;
end2.X += bx; end2.X += bx;
end2.Z += az; end2.Z += az;
addToBuffer(video::S3DVertex(bx , 0, az, 0,0,0, FootColour, tu, 1));
addToBuffer(video::S3DVertex(bx , 0, az, 0,0,0, mfootColour, k, 1)); addToBuffer(video::S3DVertex(bx , 0, -az, 0,0,0, FootColour, tu, 0));
addToBuffer(video::S3DVertex(bx , 0, -az, 0,0,0, mfootColour, k, 0)); addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, tu, 1));
addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, mtailColour, k, 1));
addToBuffer(video::S3DVertex(bx , 0, -az, 0,0,0, FootColour, tu, 0));
addToBuffer(video::S3DVertex(bx , 0, -az, 0,0,0, mfootColour, k, 0)); addToBuffer(video::S3DVertex(end1.X , end1.Y, end1.Z, 0,0,0, TailColour, tu, 0));
addToBuffer(video::S3DVertex(end1.X , end1.Y, end1.Z, 0,0,0, mtailColour, k, 0)); addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, tu, 1));
addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, mtailColour, k, 1));
//back side //back side
addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, mtailColour, k, 1)); addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, tu, 1));
addToBuffer(video::S3DVertex(-bx , 0, -az, 0,0,0, mfootColour, k, 1)); addToBuffer(video::S3DVertex(-bx , 0, -az, 0,0,0, FootColour, tu, 1));
addToBuffer(video::S3DVertex(-bx , 0, az, 0,0,0, mfootColour, k, 0)); addToBuffer(video::S3DVertex(-bx , 0, az, 0,0,0, FootColour, tu, 0));
addToBuffer(video::S3DVertex(-bx , 0, az, 0,0,0, mfootColour, k, 0)); addToBuffer(video::S3DVertex(-bx , 0, az, 0,0,0, FootColour, tu, 0));
addToBuffer(video::S3DVertex(-end1.X , end1.Y, -end1.Z, 0,0,0, mtailColour, k, 0)); addToBuffer(video::S3DVertex(-end1.X , end1.Y, -end1.Z, 0,0,0, TailColour, tu, 0));
addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, mtailColour, k, 1)); addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, tu, 1));
tu += tuStep;
bx += bxStep;
} }
f32 tv = 0.f;
const f32 tvStep = 1.f/SubdivideV;
f32 bz = -az;
const f32 bzStep = LightDimensions.Z * tvStep;
// Slices in Z/V space // Slices in Z/V space
for(s32 i = 0; i <= mSubdivideV; i++) { for(u32 i = 0; i <= SubdivideV; ++i)
f32 k = ((f32)i) / mSubdivideV; // use for the texture coord {
f32 bz = ((lightDimensions.Z / (f32)mSubdivideV) * i) - az;
// These are the two endpoints for a slice at the foot // These are the two endpoints for a slice at the foot
core::vector3df end1(-ax, 0.0f, bz); core::vector3df end1(-ax, 0.0f, bz);
core::vector3df end2(ax, 0.0f, bz); core::vector3df end2(ax, 0.0f, bz);
end1 -= lightPoint; // get a vector from point to lightsource end1 -= lightPoint; // get a vector from point to lightsource
end1.normalize(); // normalize vector end1.normalize(); // normalize vector
end1 *= lightDimensions.Y; // multiply it out by shootlength end1 *= LightDimensions.Y; // multiply it out by shootlength
end1.X -= ax; // Add the original point location to the vector end1.X -= ax; // Add the original point location to the vector
end1.Z += bz; end1.Z += bz;
// Do it again for the other point. // Do it again for the other point.
end2 -= lightPoint; end2 -= lightPoint;
end2.normalize(); end2.normalize();
end2 *= lightDimensions.Y; end2 *= LightDimensions.Y;
end2.X += ax; end2.X += ax;
end2.Z += bz; end2.Z += bz;
addToBuffer(video::S3DVertex(-ax , 0, bz, 0,0,0, mfootColour, 0, k)); addToBuffer(video::S3DVertex(-ax , 0, bz, 0,0,0, FootColour, 0, tv));
addToBuffer(video::S3DVertex(ax , 0, bz, 0,0,0, mfootColour, 1, k)); addToBuffer(video::S3DVertex(ax , 0, bz, 0,0,0, FootColour, 1, tv));
addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, mtailColour, 1, k)); addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, 1, tv));
addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, mtailColour, 1, k)); addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, 1, tv));
addToBuffer(video::S3DVertex(end1.X , end1.Y, end1.Z, 0,0,0, mtailColour, 0, k)); addToBuffer(video::S3DVertex(end1.X , end1.Y, end1.Z, 0,0,0, TailColour, 0, tv));
addToBuffer(video::S3DVertex(-ax , 0, bz, 0,0,0, mfootColour, 0, k)); addToBuffer(video::S3DVertex(-ax , 0, bz, 0,0,0, FootColour, 0, tv));
//back side //back side
addToBuffer(video::S3DVertex(ax , 0, -bz, 0,0,0, mfootColour, 0, k)); addToBuffer(video::S3DVertex(ax , 0, -bz, 0,0,0, FootColour, 0, tv));
addToBuffer(video::S3DVertex(-ax , 0, -bz, 0,0,0, mfootColour, 1, k)); addToBuffer(video::S3DVertex(-ax , 0, -bz, 0,0,0, FootColour, 1, tv));
addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, mtailColour, 1, k)); addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, 1, tv));
addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, mtailColour, 1, k)); addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, 1, tv));
addToBuffer(video::S3DVertex(-end1.X , end1.Y, -end1.Z, 0,0,0, mtailColour, 0, k)); addToBuffer(video::S3DVertex(-end1.X , end1.Y, -end1.Z, 0,0,0, TailColour, 0, tv));
addToBuffer(video::S3DVertex(ax , 0, -bz, 0,0,0, mfootColour, 0, k)); addToBuffer(video::S3DVertex(ax , 0, -bz, 0,0,0, FootColour, 0, tv));
tv += tvStep;
bz += bzStep;
} }
Buffer->BoundingBox.reset(0,0,0);
Buffer->recalculateBoundingBox(); Buffer->recalculateBoundingBox();
Buffer->Material.MaterialType = video::EMT_ONETEXTURE_BLEND; Buffer->Material.MaterialType = video::EMT_ONETEXTURE_BLEND;
Buffer->Material.MaterialTypeParam = pack_texureBlendFunc( video::EBF_SRC_COLOR, video::EBF_SRC_ALPHA, video::EMFN_MODULATE_1X ); Buffer->Material.MaterialTypeParam = pack_texureBlendFunc( video::EBF_SRC_COLOR, video::EBF_SRC_ALPHA, video::EMFN_MODULATE_1X );
...@@ -186,6 +178,7 @@ void CVolumeLightSceneNode::constructLight() ...@@ -186,6 +178,7 @@ void CVolumeLightSceneNode::constructLight()
Buffer->Material.ZWriteEnable = false; Buffer->Material.ZWriteEnable = false;
} }
//! renders the node. //! renders the node.
void CVolumeLightSceneNode::render() void CVolumeLightSceneNode::render()
{ {
...@@ -209,12 +202,13 @@ const core::aabbox3d<f32>& CVolumeLightSceneNode::getBoundingBox() const ...@@ -209,12 +202,13 @@ const core::aabbox3d<f32>& CVolumeLightSceneNode::getBoundingBox() const
void CVolumeLightSceneNode::OnRegisterSceneNode() void CVolumeLightSceneNode::OnRegisterSceneNode()
{ {
if (IsVisible) { if (IsVisible)
{
//lie to sceneManager //lie to sceneManager
Buffer->Material.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; Buffer->Material.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
Buffer->Material.MaterialTypeParam = 0.01f; Buffer->Material.MaterialTypeParam = 0.01f;
SceneManager->registerNodeForRendering(this, ESNRP_AUTOMATIC); SceneManager->registerNodeForRendering(this, ESNRP_AUTOMATIC);
//restore state //restore state
Buffer->Material.MaterialType = video::EMT_ONETEXTURE_BLEND; Buffer->Material.MaterialType = video::EMT_ONETEXTURE_BLEND;
Buffer->Material.MaterialTypeParam = pack_texureBlendFunc( video::EBF_SRC_COLOR, video::EBF_SRC_ALPHA, video::EMFN_MODULATE_1X ); Buffer->Material.MaterialTypeParam = pack_texureBlendFunc( video::EBF_SRC_COLOR, video::EBF_SRC_ALPHA, video::EMFN_MODULATE_1X );
...@@ -246,34 +240,34 @@ void CVolumeLightSceneNode::serializeAttributes(io::IAttributes* out, io::SAttri ...@@ -246,34 +240,34 @@ void CVolumeLightSceneNode::serializeAttributes(io::IAttributes* out, io::SAttri
{ {
ISceneNode::serializeAttributes(out, options); ISceneNode::serializeAttributes(out, options);
out->addFloat("lpDistance", mlpDistance); out->addFloat("lpDistance", LPDistance);
out->addInt("subDivideU", mSubdivideU); out->addInt("subDivideU", SubdivideU);
out->addInt("subDivideV", mSubdivideV); out->addInt("subDivideV", SubdivideV);
out->addColor("footColour", mfootColour); out->addColor("footColour", FootColour);
out->addColor("tailColour", mtailColour); out->addColor("tailColour", TailColour);
out->addVector3d("lightDimension", lightDimensions); out->addVector3d("lightDimension", LightDimensions);
} }
//! Reads attributes of the scene node. //! Reads attributes of the scene node.
void CVolumeLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) void CVolumeLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{ {
mlpDistance = in->getAttributeAsFloat("lpDistance"); LPDistance = in->getAttributeAsFloat("lpDistance");
mlpDistance = core::max_(mlpDistance, 8.0f); LPDistance = core::max_(LPDistance, 8.0f);
mSubdivideU = in->getAttributeAsInt("subDivideU"); SubdivideU = in->getAttributeAsInt("subDivideU");
mSubdivideU = core::max_(mSubdivideU, 1); SubdivideU = core::max_(SubdivideU, 1u);
mSubdivideV = in->getAttributeAsInt("subDivideV"); SubdivideV = in->getAttributeAsInt("subDivideV");
mSubdivideV = core::max_(mSubdivideV, 1); SubdivideV = core::max_(SubdivideV, 1u);
mfootColour = in->getAttributeAsColor("footColour"); FootColour = in->getAttributeAsColor("footColour");
mtailColour = in->getAttributeAsColor("tailColour"); TailColour = in->getAttributeAsColor("tailColour");
lightDimensions = in->getAttributeAsVector3d("lightDimension"); LightDimensions = in->getAttributeAsVector3d("lightDimension");
constructLight(); constructLight();
ISceneNode::deserializeAttributes(in, options); ISceneNode::deserializeAttributes(in, options);
...@@ -283,11 +277,13 @@ void CVolumeLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttr ...@@ -283,11 +277,13 @@ void CVolumeLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttr
//! Creates a clone of this scene node and its children. //! Creates a clone of this scene node and its children.
ISceneNode* CVolumeLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager) ISceneNode* CVolumeLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{ {
if (!newParent) newParent = Parent; if (!newParent)
if (!newManager) newManager = SceneManager; newParent = Parent;
if (!newManager)
newManager = SceneManager;
CVolumeLightSceneNode* nb = new CVolumeLightSceneNode(newParent, CVolumeLightSceneNode* nb = new CVolumeLightSceneNode(newParent,
newManager, ID, mSubdivideU, mSubdivideV, mfootColour, mtailColour, RelativeTranslation); newManager, ID, SubdivideU, SubdivideV, FootColour, TailColour, RelativeTranslation);
nb->cloneMembers(this, newManager); nb->cloneMembers(this, newManager);
nb->Buffer->Material = Buffer->Material; nb->Buffer->Material = Buffer->Material;
...@@ -299,3 +295,4 @@ ISceneNode* CVolumeLightSceneNode::clone(ISceneNode* newParent, ISceneManager* n ...@@ -299,3 +295,4 @@ ISceneNode* CVolumeLightSceneNode::clone(ISceneNode* newParent, ISceneManager* n
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
...@@ -20,7 +20,7 @@ namespace scene ...@@ -20,7 +20,7 @@ namespace scene
//! constructor //! constructor
CVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, CVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const s32 subdivU = 32, const s32 subdivV = 32, const u32 subdivU = 32, const u32 subdivV = 32,
const video::SColor foot = video::SColor(51, 0, 230, 180), const video::SColor foot = video::SColor(51, 0, 230, 180),
const video::SColor tail = video::SColor(0, 0, 0, 0), const video::SColor tail = video::SColor(0, 0, 0, 0),
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& position = core::vector3df(0,0,0),
...@@ -60,17 +60,17 @@ namespace scene ...@@ -60,17 +60,17 @@ namespace scene
//! Creates a clone of this scene node and its children. //! Creates a clone of this scene node and its children.
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0); virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
void setSubDivideU (const s32 inU) { mSubdivideU = inU; } void setSubDivideU (const u32 inU) { SubdivideU = inU; }
void setSubDivideV (const s32 inV) { mSubdivideV = inV; } void setSubDivideV (const u32 inV) { SubdivideV = inV; }
s32 getSubDivideU () const { return mSubdivideU; } u32 getSubDivideU () const { return SubdivideU; }
s32 getSubDivideV () const { return mSubdivideV; } u32 getSubDivideV () const { return SubdivideV; }
void setFootColour(const video::SColor inColouf) { mfootColour = inColouf; } void setFootColour(const video::SColor inColouf) { FootColour = inColouf; }
void setTailColour(const video::SColor inColouf) { mtailColour = inColouf; } void setTailColour(const video::SColor inColouf) { TailColour = inColouf; }
video::SColor getFootColour () const { return mfootColour; } video::SColor getFootColour () const { return FootColour; }
video::SColor getTailColour () const { return mtailColour; } video::SColor getTailColour () const { return TailColour; }
private: private:
void addToBuffer(video::S3DVertex v); void addToBuffer(video::S3DVertex v);
...@@ -78,18 +78,18 @@ namespace scene ...@@ -78,18 +78,18 @@ namespace scene
SMeshBuffer * Buffer; SMeshBuffer * Buffer;
f32 mlpDistance; // Distance to hypothetical lightsource point -- affects fov angle f32 LPDistance; // Distance to hypothetical lightsource point -- affects fov angle
s32 mSubdivideU; // Number of subdivisions in U and V space. u32 SubdivideU; // Number of subdivisions in U and V space.
s32 mSubdivideV; // Controls the number of "slices" in the volume. u32 SubdivideV; // Controls the number of "slices" in the volume.
// NOTE : Total number of polygons = 2 + ((mSubdiveU + 1) + (mSubdivideV + 1)) * 2 // NOTE : Total number of polygons = 2 + ((SubdivideU + 1) + (SubdivideV + 1)) * 2
// Each slice being a quad plus the rectangular plane at the bottom. // Each slice being a quad plus the rectangular plane at the bottom.
video::SColor mfootColour; // Color at the source video::SColor FootColour; // Color at the source
video::SColor mtailColour; // Color at the end. video::SColor TailColour; // Color at the end.
core::vector3df lightDimensions; // lightDimensions.Y Distance of shooting -- Length of beams core::vector3df LightDimensions; // LightDimensions.Y Distance of shooting -- Length of beams
// lightDimensions.X and lightDimensions.Z determine the size/dimension of the plane // LightDimensions.X and LightDimensions.Z determine the size/dimension of the plane
}; };
} // end namespace scene } // end namespace scene
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment