Commit 451d5bca authored by hybrid's avatar hybrid

Merged from 1.4 branch revisions 1251:1271

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1272 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 89aa5dab
...@@ -14,11 +14,11 @@ namespace scene ...@@ -14,11 +14,11 @@ namespace scene
{ {
//! Scene node which is a dynamic light. //! Scene node which is a dynamic light.
/** You can switch the light on and off by /** You can switch the light on and off by making it visible or not. It can be
making it visible or not, and let it be animated by ordinary scene node animators. animated by ordinary scene node animators.
If you set the light type to be directional, you will need to set the direction of the If the light type is directional or spot, the direction of the light source
light source manually in the SLight structure, the position of the scene node will have no is defined by the rotation of the scene node (assuming (0,0,1) as the local
effect on this direction. direction of the light).
*/ */
class ILightSceneNode : public ISceneNode class ILightSceneNode : public ISceneNode
{ {
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
: ISceneNode(parent, mgr, id, position) {} : ISceneNode(parent, mgr, id, position) {}
//! Sets the light data associated with this ILightSceneNode //! Sets the light data associated with this ILightSceneNode
//! \param light The new light data.
virtual void setLightData(const video::SLight& light) = 0; virtual void setLightData(const video::SLight& light) = 0;
//! Gets the light data associated with this ILightSceneNode //! Gets the light data associated with this ILightSceneNode
......
This diff is collapsed.
...@@ -37,26 +37,26 @@ const c8* const LightTypeNames[] = ...@@ -37,26 +37,26 @@ const c8* const LightTypeNames[] =
*/ */
struct SLight struct SLight
{ {
SLight() : AmbientColor(0.0f,0.0f,0.0f), DiffuseColor(1.0f,1.0f,1.0f), SLight() : AmbientColor(0.f,0.f,0.f), DiffuseColor(1.f,1.f,1.f),
SpecularColor(1.0f,1.0f,1.0f), Attenuation(1.0f,0.0f,0.0f), SpecularColor(1.f,1.f,1.f), Attenuation(1.f,0.f,0.f),
Radius(100.0f), OuterCone(45.0f), InnerCone(0.0f), Radius(100.f), OuterCone(45.f), InnerCone(0.f), Falloff(2.f),
Falloff(2.0f), CastShadows(true), Type(ELT_POINT), Position(0.f,0.f,0.f), Direction(0.f,0.f,1.f),
Position(0.0f,0.0f,0.0f), Direction(0.0f,0.0f,1.0f) Type(ELT_POINT), CastShadows(true)
{}; {};
//! Ambient color emitted by the light //! Ambient color emitted by the light
SColorf AmbientColor; SColorf AmbientColor;
//! Diffuse color emitted by the light. //! Diffuse color emitted by the light.
/** This is the primary color you might want to set. */ //! This is the primary color you want to set.
SColorf DiffuseColor; SColorf DiffuseColor;
//! Specular color emitted by the light. //! Specular color emitted by the light.
/** For details how to use specular highlights, see SMaterial::Shininess */ //! For details how to use specular highlights, see SMaterial::Shininess
SColorf SpecularColor; SColorf SpecularColor;
//! Attenuation factors (constant, linear, quadratic) //! Attenuation factors (constant, linear, quadratic)
/** Changes the light strength fading over distance */ //! Changes the light strength fading over distance
core::vector3df Attenuation; core::vector3df Attenuation;
//! Radius of light. Everything within this radius be be lighted. //! Radius of light. Everything within this radius be be lighted.
...@@ -71,17 +71,19 @@ struct SLight ...@@ -71,17 +71,19 @@ struct SLight
//! The light strength's decrease between Outer and Inner cone. //! The light strength's decrease between Outer and Inner cone.
f32 Falloff; f32 Falloff;
//! Does the light cast shadows? //! Read-ONLY! Position of the light. If Type is ELT_DIRECTIONAL,
bool CastShadows; //! it is ignored. Changed via light scene node's position.
core::vector3df Position;
//! Read-ONLY! Direction of the light. If Type is ELT_POINT,
//! it is ignored. Changed via light scene node's rotation.
core::vector3df Direction;
//! Type of the light. Default: ELT_POINT //! Type of the light. Default: ELT_POINT
E_LIGHT_TYPE Type; E_LIGHT_TYPE Type;
//! Read-ONLY! Position of the light. If Type is ELT_DIRECTIONAL, this is ignored. //! Does the light cast shadows?
core::vector3df Position; bool CastShadows;
//! Read-ONLY! Direction of the light. If Type is ELT_POINT, this is ignored.
core::vector3df Direction;
}; };
} // end namespace video } // end namespace video
......
...@@ -49,7 +49,7 @@ namespace scene ...@@ -49,7 +49,7 @@ namespace scene
// reverse search // reverse search
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial & material) const virtual IMeshBuffer* getMeshBuffer( const video::SMaterial & material) const
{ {
for (s32 i = (s32) MeshBuffers.size(); --i >= 0; ) for (s32 i = (s32)MeshBuffers.size()-1; i >= 0; --i)
{ {
if ( material == MeshBuffers[i]->getMaterial()) if ( material == MeshBuffers[i]->getMaterial())
return MeshBuffers[i]; return MeshBuffers[i];
......
...@@ -556,11 +556,11 @@ public: ...@@ -556,11 +556,11 @@ public:
} }
//! finds first occurrence of a character of a list in string //! finds first occurrence of a character of a list in string
/** \param c: List of strings to find. For example if the method /** \param c: List of characters to find. For example if the method
should find the first occurrence of 'a' or 'b', this parameter should be "ab". should find the first occurrence of 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Ususally, \param count: Amount of characters in the list. Usually,
this should be strlen(ofParameter1) this should be strlen(c)
\return Returns position where one of the character has been found, \return Returns position where one of the characters has been found,
or -1 if not found. */ or -1 if not found. */
s32 findFirstChar(const T* const c, u32 count) const s32 findFirstChar(const T* const c, u32 count) const
{ {
...@@ -579,8 +579,8 @@ public: ...@@ -579,8 +579,8 @@ public:
//! Finds first position of a character not in a given list. //! Finds first position of a character not in a given list.
/** \param c: List of characters not to find. For example if the method /** \param c: List of characters not to find. For example if the method
should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab". should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Ususally, \param count: Amount of characters in the list. Usually,
this should be strlen(ofParameter1) this should be strlen(c)
\return Returns position where the character has been found, \return Returns position where the character has been found,
or -1 if not found. */ or -1 if not found. */
template <class B> template <class B>
...@@ -603,8 +603,8 @@ public: ...@@ -603,8 +603,8 @@ public:
//! Finds last position of a character not in a given list. //! Finds last position of a character not in a given list.
/** \param c: List of characters not to find. For example if the method /** \param c: List of characters not to find. For example if the method
should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab". should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Ususally, \param count: Amount of characters in the list. Usually,
this should be strlen(ofParameter1) this should be strlen(c)
\return Returns position where the character has been found, \return Returns position where the character has been found,
or -1 if not found. */ or -1 if not found. */
template <class B> template <class B>
...@@ -654,6 +654,27 @@ public: ...@@ -654,6 +654,27 @@ public:
return -1; return -1;
} }
//! finds last occurrence of a character of a list in string
/** \param c: List of strings to find. For example if the method
should find the last occurrence of 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Usually,
this should be strlen(c)
\return Returns position where one of the characters has been found,
or -1 if not found. */
s32 findLastChar(const T* const c, u32 count) const
{
if (!c)
return -1;
for (u32 i=(used-1); i>=0; --i)
for (u32 j=0; j<count; ++j)
if (array[i] == c[j])
return i;
return -1;
}
//! finds another string in this string //! finds another string in this string
//! \param str: Another string //! \param str: Another string
//! \return Returns positions where the string has been found, //! \return Returns positions where the string has been found,
......
...@@ -402,10 +402,9 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop, ...@@ -402,10 +402,9 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop,
video::S3DVertex* first = FrameList[firstFrame].pointer(); video::S3DVertex* first = FrameList[firstFrame].pointer();
video::S3DVertex* second = FrameList[secondFrame].pointer(); video::S3DVertex* second = FrameList[secondFrame].pointer();
s32 count = FrameList[firstFrame].size();
// interpolate both frames // interpolate both frames
for (s32 i=0; i<count; ++i) const u32 count = FrameList[firstFrame].size();
for (u32 i=0; i<count; ++i)
{ {
target->Pos = (second->Pos - first->Pos) * div + first->Pos; target->Pos = (second->Pos - first->Pos) * div + first->Pos;
target->Normal = (second->Normal - first->Normal) * div + first->Normal; target->Normal = (second->Normal - first->Normal) * div + first->Normal;
...@@ -722,7 +721,8 @@ void CAnimatedMeshMD2::getFrameLoop(EMD2_ANIMATION_TYPE l, ...@@ -722,7 +721,8 @@ void CAnimatedMeshMD2::getFrameLoop(EMD2_ANIMATION_TYPE l,
bool CAnimatedMeshMD2::getFrameLoop(const c8* name, bool CAnimatedMeshMD2::getFrameLoop(const c8* name,
s32& outBegin, s32&outEnd, s32& outFPS) const s32& outBegin, s32&outEnd, s32& outFPS) const
{ {
for (s32 i=0; i<(s32)FrameData.size(); ++i) for (u32 i=0; i<FrameData.size(); ++i)
{
if (FrameData[i].name == name) if (FrameData[i].name == name)
{ {
outBegin = FrameData[i].begin << MD2_FRAME_SHIFT; outBegin = FrameData[i].begin << MD2_FRAME_SHIFT;
...@@ -731,6 +731,7 @@ bool CAnimatedMeshMD2::getFrameLoop(const c8* name, ...@@ -731,6 +731,7 @@ bool CAnimatedMeshMD2::getFrameLoop(const c8* name,
outFPS = FrameData[i].fps << MD2_FRAME_SHIFT; outFPS = FrameData[i].fps << MD2_FRAME_SHIFT;
return true; return true;
} }
}
return false; return false;
} }
...@@ -746,7 +747,7 @@ s32 CAnimatedMeshMD2::getAnimationCount() const ...@@ -746,7 +747,7 @@ s32 CAnimatedMeshMD2::getAnimationCount() const
//! Returns name of md2 animation. //! Returns name of md2 animation.
const c8* CAnimatedMeshMD2::getAnimationName(s32 nr) const const c8* CAnimatedMeshMD2::getAnimationName(s32 nr) const
{ {
if (nr < 0 || nr >= (s32)FrameData.size()) if ((u32)nr >= FrameData.size())
return 0; return 0;
return FrameData[nr].name.c_str(); return FrameData[nr].name.c_str();
......
...@@ -260,20 +260,7 @@ void CAnimatedMeshSceneNode::render() ...@@ -260,20 +260,7 @@ void CAnimatedMeshSceneNode::render()
} }
m=skinnedMesh; m=skinnedMesh;
if (m)
{
for (u32 g=0; g< m->getMeshBufferCount(); ++g)
{
const IMeshBuffer* mb = m->getMeshBuffer(g);
const core::matrix4 mat = AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation;
core::aabbox3df tmpbox(mb->getBoundingBox());
mat.transformBox(tmpbox);
if (g==0)
Box = tmpbox;
else
Box.addInternalBox(tmpbox);
}
}
} }
if ( 0 == m ) if ( 0 == m )
...@@ -298,14 +285,15 @@ void CAnimatedMeshSceneNode::render() ...@@ -298,14 +285,15 @@ void CAnimatedMeshSceneNode::render()
// overwrite half transparency // overwrite half transparency
if ( DebugDataVisible & scene::EDS_HALF_TRANSPARENCY ) if ( DebugDataVisible & scene::EDS_HALF_TRANSPARENCY )
{ {
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 i=0; i<m->getMeshBufferCount(); ++i) for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{ {
scene::IMeshBuffer* mb = m->getMeshBuffer(i); scene::IMeshBuffer* mb = m->getMeshBuffer(i);
mat = Materials[i]; mat = Materials[i];
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
if (Mesh->getMeshType() == EAMT_SKINNED) if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->setMaterial(mat); driver->setMaterial(mat);
...@@ -318,8 +306,7 @@ void CAnimatedMeshSceneNode::render() ...@@ -318,8 +306,7 @@ void CAnimatedMeshSceneNode::render()
// render original meshes // render original meshes
if ( renderMeshes ) if ( renderMeshes )
{ {
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 i=0; i<m->getMeshBufferCount(); ++i) for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{ {
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType); video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType);
...@@ -331,7 +318,9 @@ void CAnimatedMeshSceneNode::render() ...@@ -331,7 +318,9 @@ void CAnimatedMeshSceneNode::render()
{ {
scene::IMeshBuffer* mb = m->getMeshBuffer(i); scene::IMeshBuffer* mb = m->getMeshBuffer(i);
if (Mesh->getMeshType() == EAMT_SKINNED) if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->setMaterial(Materials[i]); driver->setMaterial(Materials[i]);
...@@ -402,11 +391,11 @@ void CAnimatedMeshSceneNode::render() ...@@ -402,11 +391,11 @@ void CAnimatedMeshSceneNode::render()
// show bounding box // show bounding box
if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS ) if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS )
{ {
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 g=0; g< m->getMeshBufferCount(); ++g) for (u32 g=0; g< m->getMeshBufferCount(); ++g)
{ {
const IMeshBuffer* mb = m->getMeshBuffer(g); const IMeshBuffer* mb = m->getMeshBuffer(g);
if (Mesh->getMeshType() == EAMT_SKINNED) if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->draw3DBox( mb->getBoundingBox(), driver->draw3DBox( mb->getBoundingBox(),
...@@ -483,12 +472,13 @@ void CAnimatedMeshSceneNode::render() ...@@ -483,12 +472,13 @@ void CAnimatedMeshSceneNode::render()
mat.ZBuffer = true; mat.ZBuffer = true;
driver->setMaterial(mat); driver->setMaterial(mat);
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 g=0; g<m->getMeshBufferCount(); ++g) for (u32 g=0; g<m->getMeshBufferCount(); ++g)
{ {
const IMeshBuffer* mb = m->getMeshBuffer(g); const IMeshBuffer* mb = m->getMeshBuffer(g);
if (Mesh->getMeshType() == EAMT_SKINNED) if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->drawMeshBuffer(mb); driver->drawMeshBuffer(mb);
} }
......
...@@ -21,8 +21,7 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -21,8 +21,7 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool noclip) s32 id, core::rect<s32> rectangle, bool noclip)
: IGUIButton(environment, parent, id, rectangle), Pressed(false), : IGUIButton(environment, parent, id, rectangle), Pressed(false),
IsPushButton(false), UseAlphaChannel(false), Border(true), IsPushButton(false), UseAlphaChannel(false), Border(true),
MouseOverTime(0), FocusTime(0), ClickTime(0), SpriteBank(0), ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0)
OverrideFont(0), Image(0), PressedImage(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIButton"); setDebugName("CGUIButton");
...@@ -39,7 +38,6 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -39,7 +38,6 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
} }
//! destructor //! destructor
CGUIButton::~CGUIButton() CGUIButton::~CGUIButton()
{ {
...@@ -56,12 +54,14 @@ CGUIButton::~CGUIButton() ...@@ -56,12 +54,14 @@ CGUIButton::~CGUIButton()
SpriteBank->drop(); SpriteBank->drop();
} }
//! Sets if the button should use the skin to draw its border //! Sets if the button should use the skin to draw its border
void CGUIButton::setDrawBorder(bool border) void CGUIButton::setDrawBorder(bool border)
{ {
Border = border; Border = border;
} }
void CGUIButton::setSpriteBank(IGUISpriteBank* sprites) void CGUIButton::setSpriteBank(IGUISpriteBank* sprites)
{ {
if (sprites) if (sprites)
...@@ -73,6 +73,7 @@ void CGUIButton::setSpriteBank(IGUISpriteBank* sprites) ...@@ -73,6 +73,7 @@ void CGUIButton::setSpriteBank(IGUISpriteBank* sprites)
SpriteBank = sprites; SpriteBank = sprites;
} }
void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop)
{ {
if (SpriteBank) if (SpriteBank)
...@@ -87,6 +88,7 @@ void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor col ...@@ -87,6 +88,7 @@ void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor col
} }
} }
//! called if an event happened. //! called if an event happened.
bool CGUIButton::OnEvent(const SEvent& event) bool CGUIButton::OnEvent(const SEvent& event)
{ {
...@@ -199,7 +201,6 @@ bool CGUIButton::OnEvent(const SEvent& event) ...@@ -199,7 +201,6 @@ bool CGUIButton::OnEvent(const SEvent& event)
} }
//! draws the element and its children //! draws the element and its children
void CGUIButton::draw() void CGUIButton::draw()
{ {
...@@ -287,7 +288,6 @@ void CGUIButton::draw() ...@@ -287,7 +288,6 @@ void CGUIButton::draw()
} }
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin. //! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
void CGUIButton::setOverrideFont(IGUIFont* font) void CGUIButton::setOverrideFont(IGUIFont* font)
{ {
...@@ -318,6 +318,7 @@ void CGUIButton::setImage(video::ITexture* image) ...@@ -318,6 +318,7 @@ void CGUIButton::setImage(video::ITexture* image)
setPressedImage(Image); setPressedImage(Image);
} }
//! Sets the image which should be displayed on the button when it is in its normal state. //! Sets the image which should be displayed on the button when it is in its normal state.
void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos) void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
{ {
...@@ -334,6 +335,7 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos) ...@@ -334,6 +335,7 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
setPressedImage(Image, pos); setPressedImage(Image, pos);
} }
//! Sets an image which should be displayed on the button when it is in pressed state. //! Sets an image which should be displayed on the button when it is in pressed state.
void CGUIButton::setPressedImage(video::ITexture* image) void CGUIButton::setPressedImage(video::ITexture* image)
{ {
...@@ -348,6 +350,7 @@ void CGUIButton::setPressedImage(video::ITexture* image) ...@@ -348,6 +350,7 @@ void CGUIButton::setPressedImage(video::ITexture* image)
PressedImage->grab(); PressedImage->grab();
} }
//! Sets the image which should be displayed on the button when it is in its pressed state. //! Sets the image which should be displayed on the button when it is in its pressed state.
void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos) void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
{ {
...@@ -378,6 +381,7 @@ bool CGUIButton::isPressed() const ...@@ -378,6 +381,7 @@ bool CGUIButton::isPressed() const
return Pressed; return Pressed;
} }
//! Sets the pressed state of the button if this is a pushbutton //! Sets the pressed state of the button if this is a pushbutton
void CGUIButton::setPressed(bool pressed) void CGUIButton::setPressed(bool pressed)
{ {
...@@ -388,6 +392,7 @@ void CGUIButton::setPressed(bool pressed) ...@@ -388,6 +392,7 @@ void CGUIButton::setPressed(bool pressed)
} }
} }
//! Returns whether the button is a push button //! Returns whether the button is a push button
bool CGUIButton::isPushButton() const bool CGUIButton::isPushButton() const
{ {
...@@ -395,12 +400,14 @@ bool CGUIButton::isPushButton() const ...@@ -395,12 +400,14 @@ bool CGUIButton::isPushButton() const
return IsPushButton; return IsPushButton;
} }
//! Sets if the alpha channel should be used for drawing images on the button (default is false) //! Sets if the alpha channel should be used for drawing images on the button (default is false)
void CGUIButton::setUseAlphaChannel(bool useAlphaChannel) void CGUIButton::setUseAlphaChannel(bool useAlphaChannel)
{ {
UseAlphaChannel = useAlphaChannel; UseAlphaChannel = useAlphaChannel;
} }
//! Returns if the alpha channel should be used for drawing images on the button //! Returns if the alpha channel should be used for drawing images on the button
bool CGUIButton::isAlphaChannelUsed() const bool CGUIButton::isAlphaChannelUsed() const
{ {
...@@ -408,16 +415,17 @@ bool CGUIButton::isAlphaChannelUsed() const ...@@ -408,16 +415,17 @@ bool CGUIButton::isAlphaChannelUsed() const
return UseAlphaChannel; return UseAlphaChannel;
} }
bool CGUIButton::isDrawingBorder() const bool CGUIButton::isDrawingBorder() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Border; return Border;
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
IGUIButton::serializeAttributes(out,options); IGUIButton::serializeAttributes(out,options);
out->addBool ("PushButton", IsPushButton ); out->addBool ("PushButton", IsPushButton );
...@@ -435,6 +443,7 @@ void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWri ...@@ -435,6 +443,7 @@ void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWri
// out->addString ("OverrideFont", OverrideFont); // out->addString ("OverrideFont", OverrideFont);
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
...@@ -463,7 +472,9 @@ void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWr ...@@ -463,7 +472,9 @@ void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWr
updateAbsolutePosition(); updateAbsolutePosition();
} }
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
...@@ -108,8 +108,6 @@ namespace gui ...@@ -108,8 +108,6 @@ namespace gui
bool Border; bool Border;
u32 MouseOverTime;
u32 FocusTime;
u32 ClickTime; u32 ClickTime;
IGUISpriteBank* SpriteBank; IGUISpriteBank* SpriteBank;
......
...@@ -206,9 +206,11 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment, ...@@ -206,9 +206,11 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
//! destructor //! destructor
CGUITabControl::~CGUITabControl() CGUITabControl::~CGUITabControl()
{ {
for (s32 i=0; i<(s32)Tabs.size(); ++i) for (u32 i=0; i<Tabs.size(); ++i)
{
if (Tabs[i]) if (Tabs[i])
Tabs[i]->drop(); Tabs[i]->drop();
}
if (UpButton) if (UpButton)
UpButton->drop(); UpButton->drop();
...@@ -269,9 +271,11 @@ void CGUITabControl::addTab(CGUITab* tab) ...@@ -269,9 +271,11 @@ void CGUITabControl::addTab(CGUITab* tab)
return; return;
// check if its already added // check if its already added
for (s32 i=0; i < (s32)Tabs.size(); ++i) for (u32 i=0; i < Tabs.size(); ++i)
{
if (Tabs[i] == tab) if (Tabs[i] == tab)
return; return;
}
tab->grab(); tab->grab();
...@@ -309,7 +313,7 @@ s32 CGUITabControl::getTabCount() const ...@@ -309,7 +313,7 @@ s32 CGUITabControl::getTabCount() const
//! Returns a tab based on zero based index //! Returns a tab based on zero based index
IGUITab* CGUITabControl::getTab(s32 idx) const IGUITab* CGUITabControl::getTab(s32 idx) const
{ {
if (idx < 0 || idx >= (s32)Tabs.size()) if ((u32)idx >= Tabs.size())
return 0; return 0;
return Tabs[idx]; return Tabs[idx];
...@@ -523,7 +527,7 @@ void CGUITabControl::draw() ...@@ -523,7 +527,7 @@ void CGUITabControl::draw()
//const wchar_t* activetext = 0; //const wchar_t* activetext = 0;
CGUITab *activeTab = 0; CGUITab *activeTab = 0;
for (s32 i=CurrentScrollTabIndex; i<(s32)Tabs.size(); ++i) for (u32 i=0; i<Tabs.size(); ++i)
{ {
// get Text // get Text
const wchar_t* text = 0; const wchar_t* text = 0;
...@@ -543,7 +547,7 @@ void CGUITabControl::draw() ...@@ -543,7 +547,7 @@ void CGUITabControl::draw()
pos += len; pos += len;
if (i == ActiveTab) if ((s32)i == ActiveTab)
{ {
left = frameRect.UpperLeftCorner.X; left = frameRect.UpperLeftCorner.X;
right = frameRect.LowerRightCorner.X; right = frameRect.LowerRightCorner.X;
......
...@@ -17,6 +17,7 @@ CMetaTriangleSelector::CMetaTriangleSelector() ...@@ -17,6 +17,7 @@ CMetaTriangleSelector::CMetaTriangleSelector()
#endif #endif
} }
//! destructor //! destructor
CMetaTriangleSelector::~CMetaTriangleSelector() CMetaTriangleSelector::~CMetaTriangleSelector()
{ {
...@@ -24,7 +25,6 @@ CMetaTriangleSelector::~CMetaTriangleSelector() ...@@ -24,7 +25,6 @@ CMetaTriangleSelector::~CMetaTriangleSelector()
} }
//! Returns amount of all available triangles in this selector //! Returns amount of all available triangles in this selector
s32 CMetaTriangleSelector::getTriangleCount() const s32 CMetaTriangleSelector::getTriangleCount() const
{ {
...@@ -36,7 +36,6 @@ s32 CMetaTriangleSelector::getTriangleCount() const ...@@ -36,7 +36,6 @@ s32 CMetaTriangleSelector::getTriangleCount() const
} }
//! Gets all triangles. //! Gets all triangles.
void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize, void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::matrix4* transform) const s32& outTriangleCount, const core::matrix4* transform) const
...@@ -54,7 +53,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array ...@@ -54,7 +53,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array
} }
//! Gets all triangles which lie within a specific bounding box. //! Gets all triangles which lie within a specific bounding box.
void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize, void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::aabbox3d<f32>& box, s32& outTriangleCount, const core::aabbox3d<f32>& box,
...@@ -74,7 +72,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array ...@@ -74,7 +72,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array
} }
//! Gets all triangles which have or may have contact with a 3d line. //! Gets all triangles which have or may have contact with a 3d line.
void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize, void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line, s32& outTriangleCount, const core::line3d<f32>& line,
...@@ -94,7 +91,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array ...@@ -94,7 +91,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array
} }
//! Adds a triangle selector to the collection of triangle selectors //! Adds a triangle selector to the collection of triangle selectors
//! in this metaTriangleSelector. //! in this metaTriangleSelector.
void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd) void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd)
...@@ -107,23 +103,23 @@ void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd) ...@@ -107,23 +103,23 @@ void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd)
} }
//! Removes a specific triangle selector which was added before from the collection. //! Removes a specific triangle selector which was added before from the collection.
bool CMetaTriangleSelector::removeTriangleSelector(ITriangleSelector* toRemove) bool CMetaTriangleSelector::removeTriangleSelector(ITriangleSelector* toRemove)
{ {
for (u32 i=0; i<TriangleSelectors.size(); ++i) for (u32 i=0; i<TriangleSelectors.size(); ++i)
{
if (toRemove == TriangleSelectors[i]) if (toRemove == TriangleSelectors[i])
{ {
TriangleSelectors[i]->drop(); TriangleSelectors[i]->drop();
TriangleSelectors.erase(i); TriangleSelectors.erase(i);
return true; return true;
} }
}
return false; return false;
} }
//! Removes all triangle selectors from the collection. //! Removes all triangle selectors from the collection.
void CMetaTriangleSelector::removeAllTriangleSelectors() void CMetaTriangleSelector::removeAllTriangleSelectors()
{ {
......
...@@ -422,7 +422,7 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time) ...@@ -422,7 +422,7 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time)
// animate all particles // animate all particles
f32 scale = (f32)timediff; f32 scale = (f32)timediff;
for (s32 i=0; i<(s32)Particles.size();) for (u32 i=0; i<Particles.size();)
{ {
if (now > Particles[i].endTime) if (now > Particles[i].endTime)
Particles.erase(i); Particles.erase(i);
......
...@@ -278,8 +278,8 @@ CSceneManager::~CSceneManager() ...@@ -278,8 +278,8 @@ CSceneManager::~CSceneManager()
if (MeshManipulator) if (MeshManipulator)
MeshManipulator->drop(); MeshManipulator->drop();
if ( GUIEnvironment ) if (GUIEnvironment)
GUIEnvironment->drop (); GUIEnvironment->drop();
u32 i; u32 i;
...@@ -350,8 +350,9 @@ video::IVideoDriver* CSceneManager::getVideoDriver() ...@@ -350,8 +350,9 @@ video::IVideoDriver* CSceneManager::getVideoDriver()
return Driver; return Driver;
} }
//! returns the GUI Environment //! returns the GUI Environment
gui::IGUIEnvironment* CSceneManager::getGUIEnvironment () gui::IGUIEnvironment* CSceneManager::getGUIEnvironment()
{ {
return GUIEnvironment; return GUIEnvironment;
} }
...@@ -376,6 +377,7 @@ ITextSceneNode* CSceneManager::addTextSceneNode(gui::IGUIFont* font, ...@@ -376,6 +377,7 @@ ITextSceneNode* CSceneManager::addTextSceneNode(gui::IGUIFont* font,
return t; return t;
} }
//! Adds a text scene node, which uses billboards //! Adds a text scene node, which uses billboards
ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font,
const wchar_t* text, ISceneNode* parent, const wchar_t* text, ISceneNode* parent,
...@@ -399,12 +401,9 @@ ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, ...@@ -399,12 +401,9 @@ ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font,
//! Adds a scene node, which can render a quake3 shader //! Adds a scene node, which can render a quake3 shader
ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer, ISceneNode* CSceneManager::addQuake3SceneNode(IMeshBuffer* meshBuffer,
const quake3::SShader * shader, const quake3::SShader * shader,
ISceneNode* parent, ISceneNode* parent, s32 id)
s32 id
)
{ {
if ( 0 == shader ) if ( 0 == shader )
return 0; return 0;
...@@ -412,11 +411,10 @@ ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer, ...@@ -412,11 +411,10 @@ ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer,
if (!parent) if (!parent)
parent = this; parent = this;
CQuake3ShaderSceneNode* node = new CQuake3ShaderSceneNode ( parent, this, id, FileSystem, meshBuffer, shader ); CQuake3ShaderSceneNode* node = new CQuake3ShaderSceneNode( parent, this, id, FileSystem, meshBuffer, shader );
node->drop(); node->drop();
return node; return node;
} }
//! adds Volume Lighting Scene Node. //! adds Volume Lighting Scene Node.
...@@ -437,8 +435,9 @@ ISceneNode* CSceneManager::addVolumeLightSceneNode(ISceneNode* parent, s32 id, ...@@ -437,8 +435,9 @@ ISceneNode* CSceneManager::addVolumeLightSceneNode(ISceneNode* parent, s32 id,
//! adds a test scene node for test purposes to the scene. It is a simple cube of (1,1,1) size. //! adds a test scene node for test purposes to the scene. It is a simple cube of (1,1,1) size.
//! the returned pointer must not be dropped. //! the returned pointer must not be dropped.
ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent, s32 id, ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent,
const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale) s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{ {
if (!parent) if (!parent)
parent = this; parent = this;
...@@ -449,11 +448,11 @@ ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent, s32 id ...@@ -449,11 +448,11 @@ ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent, s32 id
return node; return node;
} }
//! Adds a sphere scene node for test purposes to the scene. //! Adds a sphere scene node for test purposes to the scene.
ISceneNode* CSceneManager::addSphereSceneNode(f32 radius, s32 polyCount, ISceneNode* parent, s32 id, ISceneNode* CSceneManager::addSphereSceneNode(f32 radius, s32 polyCount,
const core::vector3df& position, ISceneNode* parent, s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& rotation, const core::vector3df& scale)
const core::vector3df& scale)
{ {
if (!parent) if (!parent)
parent = this; parent = this;
...@@ -504,7 +503,6 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight, ...@@ -504,7 +503,6 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight,
} }
//! adds a scene node for rendering an animated mesh model //! adds a scene node for rendering an animated mesh model
IAnimatedMeshSceneNode* CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent, s32 id, IAnimatedMeshSceneNode* CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent, s32 id,
const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& position, const core::vector3df& rotation,
...@@ -584,7 +582,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNode(ISceneNode* parent, ...@@ -584,7 +582,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNode(ISceneNode* parent,
} }
//! Adds a camera scene node which is able to be controlle with the mouse similar //! Adds a camera scene node which is able to be controlle with the mouse similar
//! like in the 3D Software Maya by Alias Wavefront. //! like in the 3D Software Maya by Alias Wavefront.
//! The returned pointer must not be dropped. //! The returned pointer must not be dropped.
...@@ -604,7 +601,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeMaya(ISceneNode* parent, ...@@ -604,7 +601,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeMaya(ISceneNode* parent,
} }
//! Adds a camera scene node which is able to be controled with the mouse and keys //! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS): //! like in most first person shooters (FPS):
ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent, ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
...@@ -624,7 +620,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent, ...@@ -624,7 +620,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
} }
//! Adds a dynamic light scene node. The light will cast dynamic light on all //! Adds a dynamic light scene node. The light will cast dynamic light on all
//! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING //! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING
//! turned on. (This is the default setting in most scene nodes). //! turned on. (This is the default setting in most scene nodes).
...@@ -641,7 +636,6 @@ ILightSceneNode* CSceneManager::addLightSceneNode(ISceneNode* parent, ...@@ -641,7 +636,6 @@ ILightSceneNode* CSceneManager::addLightSceneNode(ISceneNode* parent,
} }
//! Adds a billboard scene node to the scene. A billboard is like a 3d sprite: A 2d element, //! Adds a billboard scene node to the scene. A billboard is like a 3d sprite: A 2d element,
//! which always looks to the camera. It is usually used for things like explosions, fire, //! which always looks to the camera. It is usually used for things like explosions, fire,
//! lensflares and things like that. //! lensflares and things like that.
...@@ -1239,9 +1233,9 @@ void CSceneManager::drawAll() ...@@ -1239,9 +1233,9 @@ void CSceneManager::drawAll()
Driver->setAmbientLight(AmbientLight); Driver->setAmbientLight(AmbientLight);
LightList.sort (); // on distance to camera LightList.sort(); // on distance to camera
u32 maxLights = core::min_ ( Driver->getMaximalDynamicLightAmount (), LightList.size () ); u32 maxLights = core::min_ ( Driver->getMaximalDynamicLightAmount(), LightList.size() );
for (i=0; i< maxLights; ++i) for (i=0; i< maxLights; ++i)
LightList[i].node->render(); LightList[i].node->render();
...@@ -1267,7 +1261,7 @@ void CSceneManager::drawAll() ...@@ -1267,7 +1261,7 @@ void CSceneManager::drawAll()
for (i=0; i<SolidNodeList.size(); ++i) for (i=0; i<SolidNodeList.size(); ++i)
SolidNodeList[i].node->render(); SolidNodeList[i].node->render();
Parameters.setAttribute ( "drawn", (s32) SolidNodeList.size () ); Parameters.setAttribute ( "drawn", (s32) SolidNodeList.size() );
SolidNodeList.set_used(0); SolidNodeList.set_used(0);
} }
...@@ -1296,7 +1290,6 @@ void CSceneManager::drawAll() ...@@ -1296,7 +1290,6 @@ void CSceneManager::drawAll()
TransparentNodeList.set_used(0); TransparentNodeList.set_used(0);
} }
clearDeletionList(); clearDeletionList();
CurrentRendertime = ESNRP_COUNT; CurrentRendertime = ESNRP_COUNT;
...@@ -1495,7 +1488,7 @@ void CSceneManager::clearDeletionList() ...@@ -1495,7 +1488,7 @@ void CSceneManager::clearDeletionList()
if (DeletionList.empty()) if (DeletionList.empty())
return; return;
for (s32 i=0; i<(s32)DeletionList.size(); ++i) for (u32 i=0; i<DeletionList.size(); ++i)
{ {
DeletionList[i]->remove(); DeletionList[i]->remove();
DeletionList[i]->drop(); DeletionList[i]->drop();
......
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