- Fix bug in CSceneNodeAnimatorCollisionResponse::setWorld as found by Quillraven.
- Fix simliar bugs where object have been dropped accidentally in set functions in many places git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2417 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
f598ea9265
commit
2391338b57
|
@ -305,6 +305,8 @@ void CGUIButton::setOverrideFont(IGUIFont* font)
|
||||||
//! Sets an image which should be displayed on the button when it is in normal state.
|
//! Sets an image which should be displayed on the button when it is in normal state.
|
||||||
void CGUIButton::setImage(video::ITexture* image)
|
void CGUIButton::setImage(video::ITexture* image)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
if (Image)
|
if (Image)
|
||||||
Image->drop();
|
Image->drop();
|
||||||
|
|
||||||
|
@ -315,9 +317,6 @@ void CGUIButton::setImage(video::ITexture* image)
|
||||||
ImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
ImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Image)
|
|
||||||
Image->grab();
|
|
||||||
|
|
||||||
if (!PressedImage)
|
if (!PressedImage)
|
||||||
setPressedImage(Image);
|
setPressedImage(Image);
|
||||||
}
|
}
|
||||||
|
@ -326,15 +325,14 @@ void CGUIButton::setImage(video::ITexture* 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)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
if (Image)
|
if (Image)
|
||||||
Image->drop();
|
Image->drop();
|
||||||
|
|
||||||
Image = image;
|
Image = image;
|
||||||
ImageRect = pos;
|
ImageRect = pos;
|
||||||
|
|
||||||
if (Image)
|
|
||||||
Image->grab();
|
|
||||||
|
|
||||||
if (!PressedImage)
|
if (!PressedImage)
|
||||||
setPressedImage(Image, pos);
|
setPressedImage(Image, pos);
|
||||||
}
|
}
|
||||||
|
@ -343,6 +341,9 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& 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)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
|
|
||||||
if (PressedImage)
|
if (PressedImage)
|
||||||
PressedImage->drop();
|
PressedImage->drop();
|
||||||
|
|
||||||
|
@ -352,23 +353,19 @@ void CGUIButton::setPressedImage(video::ITexture* image)
|
||||||
core::dimension2di signedSize(image->getOriginalSize());
|
core::dimension2di signedSize(image->getOriginalSize());
|
||||||
PressedImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
PressedImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PressedImage)
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
if (PressedImage)
|
if (PressedImage)
|
||||||
PressedImage->drop();
|
PressedImage->drop();
|
||||||
|
|
||||||
PressedImage = image;
|
PressedImage = image;
|
||||||
PressedImageRect = pos;
|
PressedImageRect = pos;
|
||||||
|
|
||||||
if (PressedImage)
|
|
||||||
PressedImage->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,8 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
||||||
if (index >= Items.size())
|
if (index >= Items.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (menu)
|
||||||
|
menu->grab();
|
||||||
if (Items[index].SubMenu)
|
if (Items[index].SubMenu)
|
||||||
Items[index].SubMenu->drop();
|
Items[index].SubMenu->drop();
|
||||||
|
|
||||||
|
@ -98,7 +100,6 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
||||||
|
|
||||||
if (Items[index].SubMenu)
|
if (Items[index].SubMenu)
|
||||||
{
|
{
|
||||||
menu->grab();
|
|
||||||
menu->AllowFocus = false;
|
menu->AllowFocus = false;
|
||||||
if ( Environment->getFocus() == menu )
|
if ( Environment->getFocus() == menu )
|
||||||
{
|
{
|
||||||
|
|
|
@ -597,6 +597,8 @@ u32 CGUIListBox::addItem(const wchar_t* text, s32 icon)
|
||||||
|
|
||||||
void CGUIListBox::setSpriteBank(IGUISpriteBank* bank)
|
void CGUIListBox::setSpriteBank(IGUISpriteBank* bank)
|
||||||
{
|
{
|
||||||
|
if ( bank == IconBank )
|
||||||
|
return;
|
||||||
if (IconBank)
|
if (IconBank)
|
||||||
IconBank->drop();
|
IconBank->drop();
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,12 @@ CGUIMeshViewer::~CGUIMeshViewer()
|
||||||
//! sets the mesh to be shown
|
//! sets the mesh to be shown
|
||||||
void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
|
void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
|
||||||
{
|
{
|
||||||
|
if (mesh)
|
||||||
|
mesh->grab();
|
||||||
if (Mesh)
|
if (Mesh)
|
||||||
Mesh->drop();
|
Mesh->drop();
|
||||||
|
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
if (!Mesh)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
Mesh->grab();
|
|
||||||
|
|
||||||
/* This might be used for proper transformation etc.
|
/* This might be used for proper transformation etc.
|
||||||
core::vector3df center(0.0f,0.0f,0.0f);
|
core::vector3df center(0.0f,0.0f,0.0f);
|
||||||
|
|
|
@ -205,13 +205,12 @@ void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
|
||||||
if ((u32)which >= EGDS_COUNT)
|
if ((u32)which >= EGDS_COUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (font)
|
||||||
|
font->grab();
|
||||||
if (Fonts[which])
|
if (Fonts[which])
|
||||||
Fonts[which]->drop();
|
Fonts[which]->drop();
|
||||||
|
|
||||||
Fonts[which] = font;
|
Fonts[which] = font;
|
||||||
|
|
||||||
if (Fonts[which])
|
|
||||||
Fonts[which]->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,12 +224,12 @@ IGUISpriteBank* CGUISkin::getSpriteBank() const
|
||||||
//! set a new sprite bank or remove one by passing 0
|
//! set a new sprite bank or remove one by passing 0
|
||||||
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
|
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
|
||||||
{
|
{
|
||||||
if (SpriteBank)
|
|
||||||
SpriteBank->drop();
|
|
||||||
|
|
||||||
if (bank)
|
if (bank)
|
||||||
bank->grab();
|
bank->grab();
|
||||||
|
|
||||||
|
if (SpriteBank)
|
||||||
|
SpriteBank->drop();
|
||||||
|
|
||||||
SpriteBank = bank;
|
SpriteBank = bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,12 +80,12 @@ void CGUISpriteBank::setTexture(u32 index, video::ITexture* texture)
|
||||||
while (index >= Textures.size())
|
while (index >= Textures.size())
|
||||||
Textures.push_back(0);
|
Textures.push_back(0);
|
||||||
|
|
||||||
if (Textures[index])
|
|
||||||
Textures[index]->drop();
|
|
||||||
|
|
||||||
if (texture)
|
if (texture)
|
||||||
texture->grab();
|
texture->grab();
|
||||||
|
|
||||||
|
if (Textures[index])
|
||||||
|
Textures[index]->drop();
|
||||||
|
|
||||||
Textures[index] = texture;
|
Textures[index] = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ void CGUITreeViewNode::clearChilds()
|
||||||
}
|
}
|
||||||
|
|
||||||
IGUITreeViewNode* CGUITreeViewNode::addChildBack(
|
IGUITreeViewNode* CGUITreeViewNode::addChildBack(
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon /*= 0*/,
|
const wchar_t* icon /*= 0*/,
|
||||||
s32 imageIndex /*= -1*/,
|
s32 imageIndex /*= -1*/,
|
||||||
s32 selectedImageIndex /*= -1*/,
|
s32 selectedImageIndex /*= -1*/,
|
||||||
void* data /*= 0*/,
|
void* data /*= 0*/,
|
||||||
|
@ -97,9 +97,9 @@ IGUITreeViewNode* CGUITreeViewNode::addChildBack(
|
||||||
return newChild;
|
return newChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGUITreeViewNode* CGUITreeViewNode::addChildFront(
|
IGUITreeViewNode* CGUITreeViewNode::addChildFront(
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon /*= 0*/,
|
const wchar_t* icon /*= 0*/,
|
||||||
s32 imageIndex /*= -1*/,
|
s32 imageIndex /*= -1*/,
|
||||||
s32 selectedImageIndex /*= -1*/,
|
s32 selectedImageIndex /*= -1*/,
|
||||||
void* data /*= 0*/,
|
void* data /*= 0*/,
|
||||||
|
@ -121,10 +121,10 @@ IGUITreeViewNode* CGUITreeViewNode::addChildFront(
|
||||||
return newChild;
|
return newChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGUITreeViewNode* CGUITreeViewNode::insertChildAfter(
|
IGUITreeViewNode* CGUITreeViewNode::insertChildAfter(
|
||||||
IGUITreeViewNode* other,
|
IGUITreeViewNode* other,
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon /*= 0*/,
|
const wchar_t* icon /*= 0*/,
|
||||||
s32 imageIndex /*= -1*/,
|
s32 imageIndex /*= -1*/,
|
||||||
s32 selectedImageIndex /*= -1*/,
|
s32 selectedImageIndex /*= -1*/,
|
||||||
void* data /*= 0*/,
|
void* data /*= 0*/,
|
||||||
|
@ -155,10 +155,10 @@ IGUITreeViewNode* CGUITreeViewNode::insertChildAfter(
|
||||||
return newChild;
|
return newChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGUITreeViewNode* CGUITreeViewNode::insertChildBefore(
|
IGUITreeViewNode* CGUITreeViewNode::insertChildBefore(
|
||||||
IGUITreeViewNode* other,
|
IGUITreeViewNode* other,
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon /*= 0*/,
|
const wchar_t* icon /*= 0*/,
|
||||||
s32 imageIndex /*= -1*/,
|
s32 imageIndex /*= -1*/,
|
||||||
s32 selectedImageIndex /*= -1*/,
|
s32 selectedImageIndex /*= -1*/,
|
||||||
void* data /*= 0*/,
|
void* data /*= 0*/,
|
||||||
|
@ -421,10 +421,10 @@ bool CGUITreeViewNode::isVisible() const
|
||||||
|
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
||||||
s32 id, core::rect<s32> rectangle, bool clip,
|
s32 id, core::rect<s32> rectangle, bool clip,
|
||||||
bool drawBack,bool scrollBarVertical, bool scrollBarHorizontal)
|
bool drawBack,bool scrollBarVertical, bool scrollBarHorizontal)
|
||||||
: IGUITreeView( environment, parent, id, rectangle ),
|
: IGUITreeView( environment, parent, id, rectangle ),
|
||||||
Root(0), Selected(0),
|
Root(0), Selected(0),
|
||||||
ItemHeight( 0 ),
|
ItemHeight( 0 ),
|
||||||
IndentWidth( 0 ),
|
IndentWidth( 0 ),
|
||||||
|
@ -452,7 +452,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
||||||
if ( scrollBarVertical )
|
if ( scrollBarVertical )
|
||||||
{
|
{
|
||||||
ScrollBarV = new CGUIScrollBar( false, Environment, this, 0,
|
ScrollBarV = new CGUIScrollBar( false, Environment, this, 0,
|
||||||
core::rect<s32>( RelativeRect.getWidth() - s,
|
core::rect<s32>( RelativeRect.getWidth() - s,
|
||||||
0,
|
0,
|
||||||
RelativeRect.getWidth(),
|
RelativeRect.getWidth(),
|
||||||
RelativeRect.getHeight() - (scrollBarHorizontal ? s : 0 )
|
RelativeRect.getHeight() - (scrollBarHorizontal ? s : 0 )
|
||||||
|
@ -539,7 +539,7 @@ void CGUITreeView::recalculateItemHeight()
|
||||||
|
|
||||||
if( IconFont )
|
if( IconFont )
|
||||||
{
|
{
|
||||||
s32 height = IconFont->getDimension( L" " ).Height;
|
s32 height = IconFont->getDimension( L" " ).Height;
|
||||||
if( height > ItemHeight )
|
if( height > ItemHeight )
|
||||||
{
|
{
|
||||||
ItemHeight = height;
|
ItemHeight = height;
|
||||||
|
@ -658,7 +658,7 @@ bool CGUITreeView::OnEvent( const SEvent &event )
|
||||||
}
|
}
|
||||||
|
|
||||||
Selecting = false;
|
Selecting = false;
|
||||||
Environment->removeFocus( this );
|
Environment->removeFocus( this );
|
||||||
mouseAction( event.MouseInput.X, event.MouseInput.Y );
|
mouseAction( event.MouseInput.X, event.MouseInput.Y );
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
@ -728,7 +728,7 @@ void CGUITreeView::mouseAction( s32 xpos, s32 ypos, bool onlyHover /*= false*/ )
|
||||||
Selected = hitNode;
|
Selected = hitNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hitNode && !onlyHover
|
if( hitNode && !onlyHover
|
||||||
&& xpos < hitNode->getLevel() * IndentWidth
|
&& xpos < hitNode->getLevel() * IndentWidth
|
||||||
&& xpos > ( hitNode->getLevel() - 1 ) * IndentWidth
|
&& xpos > ( hitNode->getLevel() - 1 ) * IndentWidth
|
||||||
&& hitNode->hasChilds() )
|
&& hitNode->hasChilds() )
|
||||||
|
@ -804,7 +804,7 @@ void CGUITreeView::draw()
|
||||||
clipRect );
|
clipRect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the border
|
// draw the border
|
||||||
frameRect.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y + 1;
|
frameRect.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y + 1;
|
||||||
driver->draw2DRectangle( skin->getColor( EGDC_3D_SHADOW ), frameRect,
|
driver->draw2DRectangle( skin->getColor( EGDC_3D_SHADOW ), frameRect,
|
||||||
clipRect );
|
clipRect );
|
||||||
|
@ -953,10 +953,10 @@ void CGUITreeView::draw()
|
||||||
index = node->getImageIndex();
|
index = node->getImageIndex();
|
||||||
}
|
}
|
||||||
ImageList->draw(
|
ImageList->draw(
|
||||||
index,
|
index,
|
||||||
core::position2d<s32>(
|
core::position2d<s32>(
|
||||||
textRect.UpperLeftCorner.X,
|
textRect.UpperLeftCorner.X,
|
||||||
textRect.UpperLeftCorner.Y + ( ( textRect.getHeight() - ImageList->getImageSize().Height ) >> 1 ) ),
|
textRect.UpperLeftCorner.Y + ( ( textRect.getHeight() - ImageList->getImageSize().Height ) >> 1 ) ),
|
||||||
&clientClip );
|
&clientClip );
|
||||||
iconWidth += ImageList->getImageSize().Width + 3;
|
iconWidth += ImageList->getImageSize().Width + 3;
|
||||||
textRect.UpperLeftCorner.X += ImageList->getImageSize().Width + 3;
|
textRect.UpperLeftCorner.X += ImageList->getImageSize().Width + 3;
|
||||||
|
@ -976,7 +976,7 @@ void CGUITreeView::draw()
|
||||||
textRect.UpperLeftCorner.X -= iconWidth;
|
textRect.UpperLeftCorner.X -= iconWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the lines if neccessary
|
// draw the lines if neccessary
|
||||||
if( LinesVisible )
|
if( LinesVisible )
|
||||||
{
|
{
|
||||||
core::rect<s32> rc;
|
core::rect<s32> rc;
|
||||||
|
@ -997,7 +997,7 @@ void CGUITreeView::draw()
|
||||||
clipRect );
|
clipRect );
|
||||||
|
|
||||||
if( node->getParent() != Root )
|
if( node->getParent() != Root )
|
||||||
{
|
{
|
||||||
// vertical line
|
// vertical line
|
||||||
if( node == node->getParent()->getFirstChild() )
|
if( node == node->getParent()->getFirstChild() )
|
||||||
{
|
{
|
||||||
|
@ -1012,7 +1012,7 @@ void CGUITreeView::draw()
|
||||||
clipRect );
|
clipRect );
|
||||||
|
|
||||||
// the vertical lines of all parents
|
// the vertical lines of all parents
|
||||||
IGUITreeViewNode* nodeTmp = node->getParent();
|
IGUITreeViewNode* nodeTmp = node->getParent();
|
||||||
rc.UpperLeftCorner.Y = frameRect.UpperLeftCorner.Y - ( frameRect.getHeight() >> 1 );
|
rc.UpperLeftCorner.Y = frameRect.UpperLeftCorner.Y - ( frameRect.getHeight() >> 1 );
|
||||||
for( s32 n = 0; n < node->getLevel() - 2; ++n )
|
for( s32 n = 0; n < node->getLevel() - 2; ++n )
|
||||||
{
|
{
|
||||||
|
@ -1046,7 +1046,9 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
||||||
{
|
{
|
||||||
s32 height;
|
s32 height;
|
||||||
|
|
||||||
if( IconFont )
|
if ( font )
|
||||||
|
font->grab();
|
||||||
|
if ( IconFont )
|
||||||
{
|
{
|
||||||
IconFont->drop();
|
IconFont->drop();
|
||||||
}
|
}
|
||||||
|
@ -1054,12 +1056,11 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
||||||
IconFont = font;
|
IconFont = font;
|
||||||
if( IconFont )
|
if( IconFont )
|
||||||
{
|
{
|
||||||
height = IconFont->getDimension( L" " ).Height;
|
height = IconFont->getDimension( L" " ).Height;
|
||||||
if( height > ItemHeight )
|
if( height > ItemHeight )
|
||||||
{
|
{
|
||||||
ItemHeight = height;
|
ItemHeight = height;
|
||||||
}
|
}
|
||||||
IconFont->grab();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,6 +1068,8 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
||||||
//! The default is 0 (no images).
|
//! The default is 0 (no images).
|
||||||
void CGUITreeView::setImageList( IGUIImageList* imageList )
|
void CGUITreeView::setImageList( IGUIImageList* imageList )
|
||||||
{
|
{
|
||||||
|
if (imageList )
|
||||||
|
imageList->grab();
|
||||||
if( ImageList )
|
if( ImageList )
|
||||||
{
|
{
|
||||||
ImageList->drop();
|
ImageList->drop();
|
||||||
|
@ -1079,7 +1082,6 @@ void CGUITreeView::setImageList( IGUIImageList* imageList )
|
||||||
{
|
{
|
||||||
ItemHeight = ImageList->getImageSize().Height + 1;
|
ItemHeight = ImageList->getImageSize().Height + 1;
|
||||||
}
|
}
|
||||||
ImageList->grab();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace irr
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
||||||
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
||||||
Timer(0), CursorControl(0), UserReceiver(params.EventReceiver), Logger(0), Operator(0),
|
Timer(0), CursorControl(0), UserReceiver(params.EventReceiver), Logger(0), Operator(0),
|
||||||
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params)
|
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ void CIrrDeviceStub::createGUIAndScene()
|
||||||
#ifdef _IRR_COMPILE_WITH_GUI_
|
#ifdef _IRR_COMPILE_WITH_GUI_
|
||||||
// create gui environment
|
// create gui environment
|
||||||
GUIEnvironment = gui::createGUIEnvironment(FileSystem, VideoDriver, Operator);
|
GUIEnvironment = gui::createGUIEnvironment(FileSystem, VideoDriver, Operator);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// create Scene manager
|
// create Scene manager
|
||||||
SceneManager = scene::createSceneManager(VideoDriver, FileSystem, CursorControl, GUIEnvironment);
|
SceneManager = scene::createSceneManager(VideoDriver, FileSystem, CursorControl, GUIEnvironment);
|
||||||
|
@ -130,7 +130,7 @@ ITimer* CIrrDeviceStub::getTimer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Returns the version of the engine.
|
//! Returns the version of the engine.
|
||||||
const char* CIrrDeviceStub::getVersion() const
|
const char* CIrrDeviceStub::getVersion() const
|
||||||
{
|
{
|
||||||
return IRRLICHT_SDK_VERSION;
|
return IRRLICHT_SDK_VERSION;
|
||||||
|
@ -225,16 +225,15 @@ IOSOperator* CIrrDeviceStub::getOSOperator()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Sets the input receiving scene manager.
|
//! Sets the input receiving scene manager.
|
||||||
void CIrrDeviceStub::setInputReceivingSceneManager(scene::ISceneManager* sceneManager)
|
void CIrrDeviceStub::setInputReceivingSceneManager(scene::ISceneManager* sceneManager)
|
||||||
{
|
{
|
||||||
|
if (sceneManager)
|
||||||
|
sceneManager->grab();
|
||||||
if (InputReceivingSceneManager)
|
if (InputReceivingSceneManager)
|
||||||
InputReceivingSceneManager->drop();
|
InputReceivingSceneManager->drop();
|
||||||
|
|
||||||
InputReceivingSceneManager = sceneManager;
|
InputReceivingSceneManager = sceneManager;
|
||||||
|
|
||||||
if (InputReceivingSceneManager)
|
|
||||||
InputReceivingSceneManager->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ void CMeshSceneNode::OnRegisterSceneNode()
|
||||||
{
|
{
|
||||||
if (IsVisible)
|
if (IsVisible)
|
||||||
{
|
{
|
||||||
// because this node supports rendering of mixed mode meshes consisting of
|
// because this node supports rendering of mixed mode meshes consisting of
|
||||||
// transparent and solid material at the same time, we need to go through all
|
// transparent and solid material at the same time, we need to go through all
|
||||||
// materials, check of what type they are and register this node for the right
|
// materials, check of what type they are and register this node for the right
|
||||||
// render pass according to that.
|
// render pass according to that.
|
||||||
|
|
||||||
|
@ -62,16 +62,16 @@ void CMeshSceneNode::OnRegisterSceneNode()
|
||||||
// count transparent and solid materials in this scene node
|
// count transparent and solid materials in this scene node
|
||||||
if (ReadOnlyMaterials && Mesh)
|
if (ReadOnlyMaterials && Mesh)
|
||||||
{
|
{
|
||||||
// count mesh materials
|
// count mesh materials
|
||||||
|
|
||||||
for (u32 i=0; i<Mesh->getMeshBufferCount(); ++i)
|
for (u32 i=0; i<Mesh->getMeshBufferCount(); ++i)
|
||||||
{
|
{
|
||||||
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
|
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
|
||||||
video::IMaterialRenderer* rnd = mb ? driver->getMaterialRenderer(mb->getMaterial().MaterialType) : 0;
|
video::IMaterialRenderer* rnd = mb ? driver->getMaterialRenderer(mb->getMaterial().MaterialType) : 0;
|
||||||
|
|
||||||
if (rnd && rnd->isTransparent())
|
if (rnd && rnd->isTransparent())
|
||||||
++transparentCount;
|
++transparentCount;
|
||||||
else
|
else
|
||||||
++solidCount;
|
++solidCount;
|
||||||
|
|
||||||
if (solidCount && transparentCount)
|
if (solidCount && transparentCount)
|
||||||
|
@ -80,21 +80,21 @@ void CMeshSceneNode::OnRegisterSceneNode()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// count copied materials
|
// count copied materials
|
||||||
|
|
||||||
for (u32 i=0; i<Materials.size(); ++i)
|
for (u32 i=0; i<Materials.size(); ++i)
|
||||||
{
|
{
|
||||||
video::IMaterialRenderer* rnd =
|
video::IMaterialRenderer* rnd =
|
||||||
driver->getMaterialRenderer(Materials[i].MaterialType);
|
driver->getMaterialRenderer(Materials[i].MaterialType);
|
||||||
|
|
||||||
if (rnd && rnd->isTransparent())
|
if (rnd && rnd->isTransparent())
|
||||||
++transparentCount;
|
++transparentCount;
|
||||||
else
|
else
|
||||||
++solidCount;
|
++solidCount;
|
||||||
|
|
||||||
if (solidCount && transparentCount)
|
if (solidCount && transparentCount)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// register according to material types counted
|
// register according to material types counted
|
||||||
|
@ -119,7 +119,7 @@ void CMeshSceneNode::render()
|
||||||
if (!Mesh || !driver)
|
if (!Mesh || !driver)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isTransparentPass =
|
bool isTransparentPass =
|
||||||
SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;
|
SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;
|
||||||
|
|
||||||
++PassCount;
|
++PassCount;
|
||||||
|
@ -162,7 +162,7 @@ void CMeshSceneNode::render()
|
||||||
|
|
||||||
// only render transparent buffer if this is the transparent render pass
|
// only render transparent buffer if this is the transparent render pass
|
||||||
// and solid only in solid pass
|
// and solid only in solid pass
|
||||||
if (transparent == isTransparentPass)
|
if (transparent == isTransparentPass)
|
||||||
{
|
{
|
||||||
driver->setMaterial(material);
|
driver->setMaterial(material);
|
||||||
driver->drawMeshBuffer(mb);
|
driver->drawMeshBuffer(mb);
|
||||||
|
@ -295,14 +295,12 @@ void CMeshSceneNode::setMesh(IMesh* mesh)
|
||||||
if (!mesh)
|
if (!mesh)
|
||||||
return; // won't set null mesh
|
return; // won't set null mesh
|
||||||
|
|
||||||
|
mesh->grab();
|
||||||
if (Mesh)
|
if (Mesh)
|
||||||
Mesh->drop();
|
Mesh->drop();
|
||||||
|
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
copyMaterials();
|
copyMaterials();
|
||||||
|
|
||||||
if (Mesh)
|
|
||||||
Mesh->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,7 +356,7 @@ void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
|
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
|
||||||
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
|
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
|
||||||
referencing this mesh to change too. */
|
referencing this mesh to change too. */
|
||||||
void CMeshSceneNode::setReadOnlyMaterials(bool readonly)
|
void CMeshSceneNode::setReadOnlyMaterials(bool readonly)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +376,7 @@ ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
|
||||||
if (!newParent) newParent = Parent;
|
if (!newParent) newParent = Parent;
|
||||||
if (!newManager) newManager = SceneManager;
|
if (!newManager) newManager = SceneManager;
|
||||||
|
|
||||||
CMeshSceneNode* nb = new CMeshSceneNode(Mesh, newParent,
|
CMeshSceneNode* nb = new CMeshSceneNode(Mesh, newParent,
|
||||||
newManager, ID, RelativeTranslation, RelativeRotation, RelativeScale);
|
newManager, ID, RelativeTranslation, RelativeRotation, RelativeScale);
|
||||||
|
|
||||||
nb->cloneMembers(this, newManager);
|
nb->cloneMembers(this, newManager);
|
||||||
|
|
|
@ -286,10 +286,10 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
|
||||||
|
|
||||||
MeshName = SceneManager->getMeshCache()->getMeshFilename( mesh );
|
MeshName = SceneManager->getMeshCache()->getMeshFilename( mesh );
|
||||||
|
|
||||||
|
mesh->grab();
|
||||||
deleteTree();
|
deleteTree();
|
||||||
|
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
Mesh->grab();
|
|
||||||
|
|
||||||
u32 beginTime = os::Timer::getRealTime();
|
u32 beginTime = os::Timer::getRealTime();
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
|
||||||
{
|
{
|
||||||
IMeshBuffer* b = mesh->getMeshBuffer(i);
|
IMeshBuffer* b = mesh->getMeshBuffer(i);
|
||||||
|
|
||||||
if (b->getVertexCount() && b->getIndexCount())
|
if (b->getVertexCount() && b->getIndexCount())
|
||||||
{
|
{
|
||||||
Materials.push_back(b->getMaterial());
|
Materials.push_back(b->getMaterial());
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
|
||||||
for ( i=0; i < mesh->getMeshBufferCount(); ++i)
|
for ( i=0; i < mesh->getMeshBufferCount(); ++i)
|
||||||
{
|
{
|
||||||
b = mesh->getMeshBuffer(i);
|
b = mesh->getMeshBuffer(i);
|
||||||
if (b->getVertexCount() && b->getIndexCount())
|
if (b->getVertexCount() && b->getIndexCount())
|
||||||
{
|
{
|
||||||
meshReserve += 1;
|
meshReserve += 1;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
|
||||||
{
|
{
|
||||||
b = mesh->getMeshBuffer(i);
|
b = mesh->getMeshBuffer(i);
|
||||||
|
|
||||||
if (b->getVertexCount() && b->getIndexCount())
|
if (b->getVertexCount() && b->getIndexCount())
|
||||||
{
|
{
|
||||||
Materials.push_back(b->getMaterial());
|
Materials.push_back(b->getMaterial());
|
||||||
LightMapMeshes.push_back(OctTree<video::S3DVertex2TCoords>::SMeshChunk());
|
LightMapMeshes.push_back(OctTree<video::S3DVertex2TCoords>::SMeshChunk());
|
||||||
|
@ -388,7 +388,7 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
|
||||||
{
|
{
|
||||||
IMeshBuffer* b = mesh->getMeshBuffer(i);
|
IMeshBuffer* b = mesh->getMeshBuffer(i);
|
||||||
|
|
||||||
if (b->getVertexCount() && b->getIndexCount())
|
if (b->getVertexCount() && b->getIndexCount())
|
||||||
{
|
{
|
||||||
Materials.push_back(b->getMaterial());
|
Materials.push_back(b->getMaterial());
|
||||||
TangentsMeshes.push_back(OctTree<video::S3DVertexTangents>::SMeshChunk());
|
TangentsMeshes.push_back(OctTree<video::S3DVertexTangents>::SMeshChunk());
|
||||||
|
|
|
@ -72,6 +72,8 @@ IParticleEmitter* CParticleSystemSceneNode::getEmitter()
|
||||||
//! Sets the particle emitter, which creates the particles.
|
//! Sets the particle emitter, which creates the particles.
|
||||||
void CParticleSystemSceneNode::setEmitter(IParticleEmitter* emitter)
|
void CParticleSystemSceneNode::setEmitter(IParticleEmitter* emitter)
|
||||||
{
|
{
|
||||||
|
if (emitter == Emitter)
|
||||||
|
return;
|
||||||
if (Emitter)
|
if (Emitter)
|
||||||
Emitter->drop();
|
Emitter->drop();
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@ IParticleCylinderEmitter* CParticleSystemSceneNode::createCylinderEmitter(
|
||||||
bool outlineOnly, const core::vector3df& direction,
|
bool outlineOnly, const core::vector3df& direction,
|
||||||
u32 minParticlesPerSecond, u32 maxParticlesPerSecond,
|
u32 minParticlesPerSecond, u32 maxParticlesPerSecond,
|
||||||
const video::SColor& minStartColor, const video::SColor& maxStartColor,
|
const video::SColor& minStartColor, const video::SColor& maxStartColor,
|
||||||
u32 lifeTimeMin, u32 lifeTimeMax, s32 maxAngleDegrees,
|
u32 lifeTimeMin, u32 lifeTimeMax, s32 maxAngleDegrees,
|
||||||
const core::dimension2df& minStartSize,
|
const core::dimension2df& minStartSize,
|
||||||
const core::dimension2df& maxStartSize )
|
const core::dimension2df& maxStartSize )
|
||||||
{
|
{
|
||||||
|
|
|
@ -493,8 +493,8 @@ IMeshSceneNode* CSceneManager::addQuake3SceneNode(IMeshBuffer* meshBuffer,
|
||||||
if (!parent)
|
if (!parent)
|
||||||
parent = this;
|
parent = this;
|
||||||
|
|
||||||
CQuake3ShaderSceneNode* node = new CQuake3ShaderSceneNode( parent,
|
CQuake3ShaderSceneNode* node = new CQuake3ShaderSceneNode( parent,
|
||||||
this, id, FileSystem,
|
this, id, FileSystem,
|
||||||
meshBuffer, shader );
|
meshBuffer, shader );
|
||||||
node->drop();
|
node->drop();
|
||||||
|
|
||||||
|
@ -1095,13 +1095,12 @@ ICameraSceneNode* CSceneManager::getActiveCamera() const
|
||||||
//! \param camera: The new camera which should be active.
|
//! \param camera: The new camera which should be active.
|
||||||
void CSceneManager::setActiveCamera(ICameraSceneNode* camera)
|
void CSceneManager::setActiveCamera(ICameraSceneNode* camera)
|
||||||
{
|
{
|
||||||
|
if (camera)
|
||||||
|
camera->grab();
|
||||||
if (ActiveCamera)
|
if (ActiveCamera)
|
||||||
ActiveCamera->drop();
|
ActiveCamera->drop();
|
||||||
|
|
||||||
ActiveCamera = camera;
|
ActiveCamera = camera;
|
||||||
|
|
||||||
if (ActiveCamera)
|
|
||||||
ActiveCamera->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1579,13 +1578,12 @@ void CSceneManager::drawAll()
|
||||||
|
|
||||||
void CSceneManager::setLightManager(ILightManager* lightManager)
|
void CSceneManager::setLightManager(ILightManager* lightManager)
|
||||||
{
|
{
|
||||||
|
if ( lightManager )
|
||||||
|
lightManager->grab();
|
||||||
if(LightManager)
|
if(LightManager)
|
||||||
LightManager->drop();
|
LightManager->drop();
|
||||||
|
|
||||||
LightManager = lightManager;
|
LightManager = lightManager;
|
||||||
|
|
||||||
if(LightManager)
|
|
||||||
LightManager->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -118,15 +118,15 @@ core::vector3df CSceneNodeAnimatorCollisionResponse::getEllipsoidTranslation() c
|
||||||
//! the scene node may collide.
|
//! the scene node may collide.
|
||||||
void CSceneNodeAnimatorCollisionResponse::setWorld(ITriangleSelector* newWorld)
|
void CSceneNodeAnimatorCollisionResponse::setWorld(ITriangleSelector* newWorld)
|
||||||
{
|
{
|
||||||
if (World)
|
if (newWorld)
|
||||||
World->drop();
|
newWorld->grab();
|
||||||
|
|
||||||
World = newWorld;
|
if (World)
|
||||||
if (World)
|
World->drop();
|
||||||
World->grab();
|
|
||||||
|
World = newWorld;
|
||||||
|
|
||||||
FirstUpdate = true;
|
FirstUpdate = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ void CSceneNodeAnimatorCollisionResponse::animateNode(ISceneNode* node, u32 time
|
||||||
CollisionResultPosition
|
CollisionResultPosition
|
||||||
= SceneManager->getSceneCollisionManager()->getCollisionResultPosition(
|
= SceneManager->getSceneCollisionManager()->getCollisionResultPosition(
|
||||||
World, LastPosition-Translation,
|
World, LastPosition-Translation,
|
||||||
Radius, vel, CollisionTriangle, CollisionPoint, f,
|
Radius, vel, CollisionTriangle, CollisionPoint, f,
|
||||||
CollisionNode, SlidingSpeed, FallingVelocity);
|
CollisionNode, SlidingSpeed, FallingVelocity);
|
||||||
|
|
||||||
CollisionOccurred = (CollisionTriangle != RefTriangle);
|
CollisionOccurred = (CollisionTriangle != RefTriangle);
|
||||||
|
@ -273,6 +273,9 @@ ISceneNodeAnimator* CSceneNodeAnimatorCollisionResponse::createClone(ISceneNode*
|
||||||
|
|
||||||
void CSceneNodeAnimatorCollisionResponse::setCollisionCallback(ICollisionCallback* callback)
|
void CSceneNodeAnimatorCollisionResponse::setCollisionCallback(ICollisionCallback* callback)
|
||||||
{
|
{
|
||||||
|
if ( CollisionCallback == callback )
|
||||||
|
return;
|
||||||
|
|
||||||
if (CollisionCallback)
|
if (CollisionCallback)
|
||||||
CollisionCallback->drop();
|
CollisionCallback->drop();
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,8 @@ void CShadowVolumeSceneNode::createZPassVolume(s32 faceCount,
|
||||||
|
|
||||||
void CShadowVolumeSceneNode::setShadowMesh(const IMesh* mesh)
|
void CShadowVolumeSceneNode::setShadowMesh(const IMesh* mesh)
|
||||||
{
|
{
|
||||||
|
if ( ShadowMesh == mesh )
|
||||||
|
return;
|
||||||
if (ShadowMesh)
|
if (ShadowMesh)
|
||||||
ShadowMesh->drop();
|
ShadowMesh->drop();
|
||||||
ShadowMesh = mesh;
|
ShadowMesh = mesh;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
Test suite pass at GMT Tue Jun 9 00:45:13 2009
|
Test suite pass at GMT Wed Jun 10 20:04:22 2009
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue