From 52e03a8485d3f2ad9c2aa14341a2ad5aca74ee9d Mon Sep 17 00:00:00 2001 From: ROllerozxa Date: Wed, 29 Dec 2021 23:00:56 +0100 Subject: [PATCH] Remove unused attribute saving and loading (#86) --- include/IAttributeExchangingObject.h | 71 - include/IAttributes.h | 591 ------ include/ICameraSceneNode.h | 21 - include/IFileSystem.h | 8 - include/IGUIElement.h | 68 +- include/IGUIEnvironment.h | 6 - include/IGUISkin.h | 4 +- include/ISceneLoader.h | 62 - include/ISceneManager.h | 94 - include/ISceneNode.h | 65 +- include/ISceneUserDataSerializer.h | 51 - include/IVideoDriver.h | 23 - include/SceneParameters.h | 26 - include/irrlicht.h | 3 - source/Irrlicht/CAnimatedMeshSceneNode.cpp | 52 +- source/Irrlicht/CAnimatedMeshSceneNode.h | 6 - source/Irrlicht/CAttributeImpl.h | 1931 -------------------- source/Irrlicht/CAttributes.cpp | 1115 +---------- source/Irrlicht/CAttributes.h | 574 ------ source/Irrlicht/CBillboardSceneNode.cpp | 36 - source/Irrlicht/CBillboardSceneNode.h | 6 - source/Irrlicht/CBoneSceneNode.cpp | 20 - source/Irrlicht/CBoneSceneNode.h | 6 - source/Irrlicht/CCameraSceneNode.cpp | 35 - source/Irrlicht/CCameraSceneNode.h | 6 - source/Irrlicht/CFileSystem.cpp | 8 - source/Irrlicht/CFileSystem.h | 3 - source/Irrlicht/CGUIButton.cpp | 97 - source/Irrlicht/CGUIButton.h | 6 - source/Irrlicht/CGUICheckBox.cpp | 22 - source/Irrlicht/CGUICheckBox.h | 6 - source/Irrlicht/CGUIComboBox.cpp | 46 - source/Irrlicht/CGUIComboBox.h | 6 - source/Irrlicht/CGUIContextMenu.cpp | 107 -- source/Irrlicht/CGUIContextMenu.h | 6 - source/Irrlicht/CGUIEditBox.cpp | 54 - source/Irrlicht/CGUIEditBox.h | 7 - source/Irrlicht/CGUIEnvironment.cpp | 43 - source/Irrlicht/CGUIEnvironment.h | 6 - source/Irrlicht/CGUIFileOpenDialog.cpp | 30 - source/Irrlicht/CGUIFileOpenDialog.h | 3 - source/Irrlicht/CGUIImage.cpp | 38 - source/Irrlicht/CGUIImage.h | 6 - source/Irrlicht/CGUIInOutFader.cpp | 22 - source/Irrlicht/CGUIInOutFader.h | 6 - source/Irrlicht/CGUIListBox.cpp | 80 - source/Irrlicht/CGUIListBox.h | 6 - source/Irrlicht/CGUIMessageBox.cpp | 43 - source/Irrlicht/CGUIMessageBox.h | 6 - source/Irrlicht/CGUIModalScreen.cpp | 18 - source/Irrlicht/CGUIModalScreen.h | 6 - source/Irrlicht/CGUIScrollBar.cpp | 33 - source/Irrlicht/CGUIScrollBar.h | 6 - source/Irrlicht/CGUISkin.cpp | 37 - source/Irrlicht/CGUISkin.h | 6 - source/Irrlicht/CGUISpinBox.cpp | 23 - source/Irrlicht/CGUISpinBox.h | 6 - source/Irrlicht/CGUIStaticText.cpp | 45 - source/Irrlicht/CGUIStaticText.h | 6 - source/Irrlicht/CGUITabControl.cpp | 71 - source/Irrlicht/CGUITabControl.h | 11 - source/Irrlicht/CGUITable.cpp | 154 -- source/Irrlicht/CGUITable.h | 10 - source/Irrlicht/CGUIWindow.cpp | 41 - source/Irrlicht/CGUIWindow.h | 6 - source/Irrlicht/CMeshSceneNode.cpp | 73 +- source/Irrlicht/CMeshSceneNode.h | 6 - source/Irrlicht/CNullDriver.cpp | 189 +- source/Irrlicht/CNullDriver.h | 7 - source/Irrlicht/CSceneManager.cpp | 164 +- source/Irrlicht/CSceneManager.h | 28 - source/Irrlicht/IAttribute.h | 50 - 72 files changed, 21 insertions(+), 6512 deletions(-) delete mode 100644 include/IAttributeExchangingObject.h delete mode 100644 include/ISceneLoader.h delete mode 100644 include/ISceneUserDataSerializer.h diff --git a/include/IAttributeExchangingObject.h b/include/IAttributeExchangingObject.h deleted file mode 100644 index 5b13cdba..00000000 --- a/include/IAttributeExchangingObject.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__ -#define __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__ - -#include "IReferenceCounted.h" - - -namespace irr -{ - -namespace io -{ - -class IAttributes; - -//! Enumeration flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object -enum E_ATTRIBUTE_READ_WRITE_FLAGS -{ - //! Serialization/Deserializion is done for an xml file - EARWF_FOR_FILE = 0x00000001, - - //! Serialization/Deserializion is done for an editor property box - EARWF_FOR_EDITOR = 0x00000002, - - //! When writing filenames, relative paths should be used - EARWF_USE_RELATIVE_PATHS = 0x00000004 -}; - - -//! struct holding data describing options -struct SAttributeReadWriteOptions -{ - //! Constructor - SAttributeReadWriteOptions() - : Flags(0), Filename(0) - { - } - - //! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones - s32 Flags; - - //! Optional filename - const fschar_t* Filename; -}; - - -//! An object which is able to serialize and deserialize its attributes into an attributes object -class IAttributeExchangingObject : virtual public IReferenceCounted -{ -public: - - //! Writes attributes of the object. - /** Implement this to expose the attributes of your scene node animator for - scripting languages, editors, debuggers or xml serialization purposes. */ - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {} - - //! Reads attributes of the object. - /** Implement this to set the attributes of your scene node animator for - scripting languages, editors, debuggers or xml deserialization purposes. */ - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) {} - -}; - -} // end namespace io -} // end namespace irr - -#endif - diff --git a/include/IAttributes.h b/include/IAttributes.h index 270bd0e4..dfc744bf 100644 --- a/include/IAttributes.h +++ b/include/IAttributes.h @@ -125,133 +125,9 @@ public: //! Sets an attribute as float value virtual void setAttribute(s32 index, f32 value) = 0; - /* - - String Attribute - - */ - - //! Adds an attribute as string - virtual void addString(const c8* attributeName, const c8* value) = 0; - - //! Sets an attribute value as string. - //! \param attributeName: Name for the attribute - //! \param value: Value for the attribute. Set this to 0 to delete the attribute - virtual void setAttribute(const c8* attributeName, const c8* value) = 0; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - //! or defaultNotFound if attribute is not set. - virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) const = 0; - - //! Gets an attribute as string. - //! \param attributeName Name of the attribute to get. - //! \param target Buffer where the string is copied to. - virtual void getAttributeAsString(const c8* attributeName, c8* target) const = 0; - - //! Returns attribute value as string by index. - //! \param index Index value, must be between 0 and getAttributeCount()-1. - virtual core::stringc getAttributeAsString(s32 index) const = 0; - - //! Sets an attribute value as string. - //! \param index Index value, must be between 0 and getAttributeCount()-1. - //! \param value String to which the attribute is set. - virtual void setAttribute(s32 index, const c8* value) = 0; - - // wide strings - - //! Adds an attribute as string - virtual void addString(const c8* attributeName, const wchar_t* value) = 0; - - //! Sets an attribute value as string. - //! \param attributeName: Name for the attribute - //! \param value: Value for the attribute. Set this to 0 to delete the attribute - virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - //! or defaultNotFound if attribute is not set. - virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) const = 0; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param target: Buffer where the string is copied to. - virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) const = 0; - - //! Returns attribute value as string by index. - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::stringw getAttributeAsStringW(s32 index) const = 0; - - //! Sets an attribute value as string. - //! \param index Index value, must be between 0 and getAttributeCount()-1. - //! \param value String to which the attribute is set. - virtual void setAttribute(s32 index, const wchar_t* value) = 0; /* - - Binary Data Attribute - - */ - - //! Adds an attribute as binary data - virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0; - - //! Sets an attribute as binary data - virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0; - - //! Gets an attribute as binary data - /** \param attributeName: Name of the attribute to get. - \param outData Pointer to buffer where data shall be stored. - \param maxSizeInBytes Maximum number of bytes to write into outData. - */ - virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const = 0; - - //! Gets an attribute as binary data - /** \param index: Index value, must be between 0 and getAttributeCount()-1. - \param outData Pointer to buffer where data shall be stored. - \param maxSizeInBytes Maximum number of bytes to write into outData. - */ - virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const = 0; - - //! Sets an attribute as binary data - virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0; - - - /* - Array Attribute - */ - - //! Adds an attribute as wide string array - virtual void addArray(const c8* attributeName, const core::array& value) = 0; - - //! Sets an attribute value as a wide string array. - //! \param attributeName: Name for the attribute - //! \param value: Value for the attribute. Set this to 0 to delete the attribute - virtual void setAttribute(const c8* attributeName, const core::array& value) = 0; - - //! Gets an attribute as an array of wide strings. - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - //! or defaultNotFound if attribute is not set. - virtual core::array getAttributeAsArray(const c8* attributeName, const core::array& defaultNotFound = core::array()) const = 0; - - //! Returns attribute value as an array of wide strings by index. - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::array getAttributeAsArray(s32 index) const = 0; - - //! Sets an attribute as an array of wide strings - virtual void setAttribute(s32 index, const core::array& value) = 0; - - - /* - Bool Attribute - */ //! Adds an attribute as bool @@ -273,476 +149,9 @@ public: //! Sets an attribute as boolean value virtual void setAttribute(s32 index, bool value) = 0; - /* - - Enumeration Attribute - - */ - - //! Adds an attribute as enum - virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0; - - //! Adds an attribute as enum - virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0; - - //! Sets an attribute as enumeration - virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0; - - //! Gets an attribute as enumeration - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) const = 0; - - //! Gets an attribute as enumeration - /** \param attributeName: Name of the attribute to get. - \param enumerationLiteralsToUse: Use these enumeration literals to get - the index value instead of the set ones. This is useful when the - attribute list maybe was read from an xml file, and only contains the - enumeration string, but no information about its index. - \return Returns value of the attribute previously set by setAttribute() - */ - virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0; - - //! Gets an attribute as enumeration - /** \param index: Index value, must be between 0 and getAttributeCount()-1. - \param enumerationLiteralsToUse: Use these enumeration literals to get - the index value instead of the set ones. This is useful when the - attribute list maybe was read from an xml file, and only contains the - enumeration string, but no information about its index. - \param defaultNotFound Value returned when the attribute referenced by the index was not found. - \return Returns value of the attribute previously set by setAttribute() - */ - virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0; - - //! Gets an attribute as enumeration - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual const c8* getAttributeAsEnumeration(s32 index) const = 0; - - //! Gets the list of enumeration literals of an enumeration attribute - //! \param attributeName Name of the attribute to get. - //! \param outLiterals Set of strings to choose the enum name from. - virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array& outLiterals) const = 0; - - //! Gets the list of enumeration literals of an enumeration attribute - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - //! \param outLiterals Set of strings to choose the enum name from. - virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array& outLiterals) const = 0; - - //! Sets an attribute as enumeration - virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0; - - - /* - - SColor Attribute - - */ - - //! Adds an attribute as color - virtual void addColor(const c8* attributeName, video::SColor value) = 0; - - - //! Sets a attribute as color - virtual void setAttribute(const c8* attributeName, video::SColor color) = 0; - - //! Gets an attribute as color - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) const = 0; - - //! Gets an attribute as color - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual video::SColor getAttributeAsColor(s32 index) const = 0; - - //! Sets an attribute as color - virtual void setAttribute(s32 index, video::SColor color) = 0; - - /* - - SColorf Attribute - - */ - - //! Adds an attribute as floating point color - virtual void addColorf(const c8* attributeName, video::SColorf value) = 0; - - //! Sets a attribute as floating point color - virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0; - - //! Gets an attribute as floating point color - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) const = 0; - - //! Gets an attribute as floating point color - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual video::SColorf getAttributeAsColorf(s32 index) const = 0; - - //! Sets an attribute as floating point color - virtual void setAttribute(s32 index, video::SColorf color) = 0; - - - /* - - Vector3d Attribute - - */ - - //! Adds an attribute as 3d vector - virtual void addVector3d(const c8* attributeName, const core::vector3df& value) = 0; - - //! Sets a attribute as 3d vector - virtual void setAttribute(const c8* attributeName, const core::vector3df& v) = 0; - - //! Gets an attribute as 3d vector - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) const = 0; - - //! Gets an attribute as 3d vector - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::vector3df getAttributeAsVector3d(s32 index) const = 0; - - //! Sets an attribute as vector - virtual void setAttribute(s32 index, const core::vector3df& v) = 0; - - /* - - Vector2d Attribute - - */ - - //! Adds an attribute as 2d vector - virtual void addVector2d(const c8* attributeName, const core::vector2df& value) = 0; - - //! Sets a attribute as 2d vector - virtual void setAttribute(const c8* attributeName, const core::vector2df& v) = 0; - - //! Gets an attribute as vector - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) const = 0; - - //! Gets an attribute as position - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::vector2df getAttributeAsVector2d(s32 index) const = 0; - - //! Sets an attribute as 2d vector - virtual void setAttribute(s32 index, const core::vector2df& v) = 0; - - /* - - Position2d Attribute - - */ - - //! Adds an attribute as 2d position - virtual void addPosition2d(const c8* attributeName, const core::position2di& value) = 0; - - //! Sets a attribute as 2d position - virtual void setAttribute(const c8* attributeName, const core::position2di& v) = 0; - - //! Gets an attribute as position - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) const = 0; - - //! Gets an attribute as position - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::position2di getAttributeAsPosition2d(s32 index) const = 0; - - //! Sets an attribute as 2d position - virtual void setAttribute(s32 index, const core::position2di& v) = 0; - - /* - - Rectangle Attribute - - */ - - //! Adds an attribute as rectangle - virtual void addRect(const c8* attributeName, const core::rect& value) = 0; - - //! Sets an attribute as rectangle - virtual void setAttribute(const c8* attributeName, const core::rect& v) = 0; - - //! Gets an attribute as rectangle - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::rect getAttributeAsRect(const c8* attributeName, const core::rect& defaultNotFound = core::rect()) const = 0; - - //! Gets an attribute as rectangle - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::rect getAttributeAsRect(s32 index) const = 0; - - //! Sets an attribute as rectangle - virtual void setAttribute(s32 index, const core::rect& v) = 0; - - - /* - - Dimension2d Attribute - - */ - - //! Adds an attribute as dimension2d - virtual void addDimension2d(const c8* attributeName, const core::dimension2d& value) = 0; - - //! Sets an attribute as dimension2d - virtual void setAttribute(const c8* attributeName, const core::dimension2d& v) = 0; - - //! Gets an attribute as dimension2d - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::dimension2d getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d& defaultNotFound = core::dimension2d()) const = 0; - - //! Gets an attribute as dimension2d - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::dimension2d getAttributeAsDimension2d(s32 index) const = 0; - - //! Sets an attribute as dimension2d - virtual void setAttribute(s32 index, const core::dimension2d& v) = 0; - - - /* - matrix attribute - */ - - //! Adds an attribute as matrix - virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0; - - //! Sets an attribute as matrix - virtual void setAttribute(const c8* attributeName, const core::matrix4& v) = 0; - - //! Gets an attribute as a matrix4 - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) const = 0; - - //! Gets an attribute as matrix - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::matrix4 getAttributeAsMatrix(s32 index) const = 0; - - //! Sets an attribute as matrix - virtual void setAttribute(s32 index, const core::matrix4& v) = 0; - - /* - quaternion attribute - - */ - - //! Adds an attribute as quaternion - virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) = 0; - - //! Sets an attribute as quaternion - virtual void setAttribute(const c8* attributeName, const core::quaternion& v) = 0; - - //! Gets an attribute as a quaternion - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) const = 0; - - //! Gets an attribute as quaternion - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::quaternion getAttributeAsQuaternion(s32 index) const = 0; - - //! Sets an attribute as quaternion - virtual void setAttribute(s32 index, const core::quaternion& v) = 0; - - /* - - 3d bounding box - - */ - - //! Adds an attribute as axis aligned bounding box - virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) = 0; - - //! Sets an attribute as axis aligned bounding box - virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) = 0; - - //! Gets an attribute as a axis aligned bounding box - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) const = 0; - - //! Gets an attribute as axis aligned bounding box - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::aabbox3df getAttributeAsBox3d(s32 index) const = 0; - - //! Sets an attribute as axis aligned bounding box - virtual void setAttribute(s32 index, const core::aabbox3df& v) = 0; - - /* - - plane - - */ - - //! Adds an attribute as 3d plane - virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) = 0; - - //! Sets an attribute as 3d plane - virtual void setAttribute(const c8* attributeName, const core::plane3df& v) = 0; - - //! Gets an attribute as a 3d plane - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) const = 0; - - //! Gets an attribute as 3d plane - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::plane3df getAttributeAsPlane3d(s32 index) const = 0; - - //! Sets an attribute as 3d plane - virtual void setAttribute(s32 index, const core::plane3df& v) = 0; - - - /* - - 3d triangle - - */ - - //! Adds an attribute as 3d triangle - virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) = 0; - - //! Sets an attribute as 3d trianle - virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) = 0; - - //! Gets an attribute as a 3d triangle - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound = core::triangle3df(core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(0,0,0))) const = 0; - - //! Gets an attribute as 3d triangle - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const = 0; - - //! Sets an attribute as 3d triangle - virtual void setAttribute(s32 index, const core::triangle3df& v) = 0; - - - /* - - line 2d - - */ - - //! Adds an attribute as a 2d line - virtual void addLine2d(const c8* attributeName, const core::line2df& v) = 0; - - //! Sets an attribute as a 2d line - virtual void setAttribute(const c8* attributeName, const core::line2df& v) = 0; - - //! Gets an attribute as a 2d line - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) const = 0; - - //! Gets an attribute as a 2d line - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::line2df getAttributeAsLine2d(s32 index) const = 0; - - //! Sets an attribute as a 2d line - virtual void setAttribute(s32 index, const core::line2df& v) = 0; - - - /* - - line 3d - - */ - - //! Adds an attribute as a 3d line - virtual void addLine3d(const c8* attributeName, const core::line3df& v) = 0; - - //! Sets an attribute as a 3d line - virtual void setAttribute(const c8* attributeName, const core::line3df& v) = 0; - - //! Gets an attribute as a 3d line - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) const = 0; - - //! Gets an attribute as a 3d line - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::line3df getAttributeAsLine3d(s32 index) const = 0; - - //! Sets an attribute as a 3d line - virtual void setAttribute(s32 index, const core::line3df& v) = 0; - - - /* - - Texture Attribute - - */ - - //! Adds an attribute as texture reference - virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0; - - //! Sets an attribute as texture reference - virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0; - - //! Gets an attribute as texture reference - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) const = 0; - - //! Gets an attribute as texture reference - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual video::ITexture* getAttributeAsTexture(s32 index) const = 0; - - //! Sets an attribute as texture reference - virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") = 0; - - - /* - - User Pointer Attribute - - */ - - //! Adds an attribute as user pointer - virtual void addUserPointer(const c8* attributeName, void* userPointer) = 0; - - //! Sets an attribute as user pointer - virtual void setAttribute(const c8* attributeName, void* userPointer) = 0; - - //! Gets an attribute as user pointer - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) const = 0; - - //! Gets an attribute as user pointer - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual void* getAttributeAsUserPointer(s32 index) const = 0; - - //! Sets an attribute as user pointer - virtual void setAttribute(s32 index, void* userPointer) = 0; - }; } // end namespace io } // end namespace irr #endif - - - diff --git a/include/ICameraSceneNode.h b/include/ICameraSceneNode.h index a157aac8..8e7a78fe 100644 --- a/include/ICameraSceneNode.h +++ b/include/ICameraSceneNode.h @@ -172,27 +172,6 @@ namespace scene /** @see bindTargetAndRotation() */ virtual bool getTargetAndRotationBinding(void) const =0; - //! Writes attributes of the camera node - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_ - { - ISceneNode::serializeAttributes(out, options); - - if (!out) - return; - out->addBool("IsOrthogonal", IsOrthogonal); - } - - //! Reads attributes of the camera node - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_ - { - ISceneNode::deserializeAttributes(in, options); - if (!in) - return; - - if ( in->findAttribute("IsOrthogonal") ) - IsOrthogonal = in->getAttributeAsBool("IsOrthogonal"); - } - protected: void cloneMembers(const ICameraSceneNode* toCopyFrom) diff --git a/include/IFileSystem.h b/include/IFileSystem.h index afecaf17..5b528d15 100644 --- a/include/IFileSystem.h +++ b/include/IFileSystem.h @@ -315,14 +315,6 @@ public: /** \param filename is the string identifying the file which should be tested for existence. \return True if file exists, and false if it does not exist or an error occurred. */ virtual bool existFile(const path& filename) const =0; - - //! Creates a new empty collection of attributes, usable for serialization and more. - /** \param driver: Video driver to be used to load textures when specified as attribute values. - Can be null to prevent automatic texture loading by attributes. - \return Pointer to the created object. - If you no longer need the object, you should call IAttributes::drop(). - See IReferenceCounted::drop() for more information. */ - virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0; }; diff --git a/include/IGUIElement.h b/include/IGUIElement.h index c6f275b1..2e76a0f8 100644 --- a/include/IGUIElement.h +++ b/include/IGUIElement.h @@ -5,7 +5,7 @@ #ifndef __I_GUI_ELEMENT_H_INCLUDED__ #define __I_GUI_ELEMENT_H_INCLUDED__ -#include "IAttributeExchangingObject.h" +#include "IReferenceCounted.h" #include "irrList.h" #include "rect.h" #include "irrString.h" @@ -20,7 +20,7 @@ namespace irr namespace gui { //! Base class of all GUI elements. -class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver +class IGUIElement : virtual public IReferenceCounted, public IEventReceiver { public: @@ -210,25 +210,25 @@ public: } //! How left element border is aligned when parent is resized - EGUI_ALIGNMENT getAlignLeft() const + EGUI_ALIGNMENT getAlignLeft() const { return AlignLeft; } //! How right element border is aligned when parent is resized - EGUI_ALIGNMENT getAlignRight() const + EGUI_ALIGNMENT getAlignRight() const { return AlignRight; } //! How top element border is aligned when parent is resized - EGUI_ALIGNMENT getAlignTop() const + EGUI_ALIGNMENT getAlignTop() const { return AlignTop; } //! How bottom element border is aligned when parent is resized - EGUI_ALIGNMENT getAlignBottom() const + EGUI_ALIGNMENT getAlignBottom() const { return AlignBottom; } @@ -796,62 +796,6 @@ public: } - //! Writes attributes of the scene node. - /** Implement this to expose the attributes of your scene node for - scripting languages, editors, debuggers or xml serialization purposes. */ - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_ - { - out->addString("Name", Name.c_str()); - out->addInt("Id", ID ); - out->addString("Caption", getText()); - out->addString("ToolTip", getToolTipText().c_str()); - out->addRect("Rect", DesiredRect); - out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height)); - out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height)); - out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames); - out->addEnum("RightAlign", AlignRight, GUIAlignmentNames); - out->addEnum("TopAlign", AlignTop, GUIAlignmentNames); - out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames); - out->addBool("Visible", IsVisible); - out->addBool("Enabled", IsEnabled); - out->addBool("TabStop", IsTabStop); - out->addBool("TabGroup", IsTabGroup); - out->addInt("TabOrder", TabOrder); - out->addBool("NoClip", NoClip); - } - - - //! Reads attributes of the scene node. - /** Implement this to set the attributes of your scene node for - scripting languages, editors, debuggers or xml deserialization purposes. */ - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_ - { - setName(in->getAttributeAsString("Name", Name)); - setID(in->getAttributeAsInt("Id", ID)); - setText(in->getAttributeAsStringW("Caption", Text).c_str()); - setToolTipText(in->getAttributeAsStringW("ToolTip").c_str()); - setVisible(in->getAttributeAsBool("Visible", IsVisible)); - setEnabled(in->getAttributeAsBool("Enabled", IsEnabled)); - IsTabStop = in->getAttributeAsBool("TabStop", IsTabStop); - IsTabGroup = in->getAttributeAsBool("TabGroup", IsTabGroup); - TabOrder = in->getAttributeAsInt("TabOrder", TabOrder); - - core::position2di p = in->getAttributeAsPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height)); - setMaxSize(core::dimension2du(p.X,p.Y)); - - p = in->getAttributeAsPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height)); - setMinSize(core::dimension2du(p.X,p.Y)); - - setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames, AlignLeft), - (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames, AlignRight), - (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames, AlignTop), - (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames, AlignBottom)); - - setRelativePosition(in->getAttributeAsRect("Rect", DesiredRect)); - - setNotClipped(in->getAttributeAsBool("NoClip", NoClip)); - } - protected: // not virtual because needed in constructor void addChildToEnd(IGUIElement* child) diff --git a/include/IGUIEnvironment.h b/include/IGUIEnvironment.h index 3de1d876..f00a8f6b 100644 --- a/include/IGUIEnvironment.h +++ b/include/IGUIEnvironment.h @@ -618,12 +618,6 @@ public: \return True if loading succeeded, else false. */ virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0; - //! Writes attributes of the gui environment - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0; - - //! Reads attributes of the gui environment - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0; - //! Find the next element which would be selected when pressing the tab-key /** If you set the focus for the result you can manually force focus-changes like they would happen otherwise by the tab-keys. diff --git a/include/IGUISkin.h b/include/IGUISkin.h index e685a1ed..f41357a7 100644 --- a/include/IGUISkin.h +++ b/include/IGUISkin.h @@ -5,7 +5,7 @@ #ifndef __I_GUI_SKIN_H_INCLUDED__ #define __I_GUI_SKIN_H_INCLUDED__ -#include "IAttributeExchangingObject.h" +#include "IReferenceCounted.h" #include "EGUIAlignment.h" #include "SColor.h" #include "rect.h" @@ -381,7 +381,7 @@ namespace gui }; //! A skin modifies the look of the GUI elements. - class IGUISkin : public virtual io::IAttributeExchangingObject + class IGUISkin : virtual public IReferenceCounted { public: diff --git a/include/ISceneLoader.h b/include/ISceneLoader.h deleted file mode 100644 index c71c15dd..00000000 --- a/include/ISceneLoader.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2010-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __I_SCENE_LOADER_H_INCLUDED__ -#define __I_SCENE_LOADER_H_INCLUDED__ - -#include "IReferenceCounted.h" -#include "path.h" - -namespace irr -{ -namespace io -{ - class IReadFile; -} // end namespace io -namespace scene -{ - class ISceneNode; - class ISceneUserDataSerializer; - -//! Class which can load a scene into the scene manager. -/** If you want Irrlicht to be able to load currently unsupported -scene file formats (e.g. .vrml), then implement this and add your -new Sceneloader to the engine with ISceneManager::addExternalSceneLoader(). */ -class ISceneLoader : public virtual IReferenceCounted -{ -public: - - //! Returns true if the class might be able to load this file. - /** This decision should be based on the file extension (e.g. ".vrml") - only. - \param filename Name of the file to test. - \return True if the extension is a recognised type. */ - virtual bool isALoadableFileExtension(const io::path& filename) const = 0; - - //! Returns true if the class might be able to load this file. - /** This decision will be based on a quick look at the contents of the file. - \param file The file to test. - \return True if the extension is a recognised type. */ - virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0; - - //! Loads the scene into the scene manager. - /** \param file File which contains the scene. - \param userDataSerializer: If you want to load user data which may be attached - to some some scene nodes in the file, implement the ISceneUserDataSerializer - interface and provide it as parameter here. Otherwise, simply specify 0 as this - parameter. - \param rootNode The node to load the scene into, if none is provided then the - scene will be loaded into the root node. - \return Returns true on success, false on failure. Returns 0 if loading failed. */ - virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, - ISceneNode* rootNode=0) = 0; - -}; - - -} // end namespace scene -} // end namespace irr - -#endif - diff --git a/include/ISceneManager.h b/include/ISceneManager.h index e3d6b4b4..f98e7881 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -110,10 +110,8 @@ namespace scene class IMeshManipulator; class IMeshSceneNode; class IMeshWriter; - class ISceneLoader; class ISceneNode; class ISceneNodeFactory; - class ISceneUserDataSerializer; //! The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff. /** All Scene nodes can be created only here. @@ -560,24 +558,6 @@ namespace scene \return A pointer to the specified loader, 0 if the index is incorrect. */ virtual IMeshLoader* getMeshLoader(u32 index) const = 0; - //! Adds an external scene loader for extending the engine with new file formats. - /** If you want the engine to be extended with - file formats it currently is not able to load (e.g. .vrml), just implement - the ISceneLoader interface in your loading class and add it with this method. - Using this method it is also possible to override the built-in scene loaders - with newer or updated versions without the need to recompile the engine. - \param externalLoader: Implementation of a new mesh loader. */ - virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0; - - //! Returns the number of scene loaders supported by Irrlicht at this time - virtual u32 getSceneLoaderCount() const = 0; - - //! Retrieve the given scene loader - /** \param index The index of the loader to retrieve. This parameter is an 0-based - array index. - \return A pointer to the specified loader, 0 if the index is incorrect. */ - virtual ISceneLoader* getSceneLoader(u32 index) const = 0; - //! Get pointer to the scene collision manager. /** \return Pointer to the collision manager This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ @@ -669,80 +649,6 @@ namespace scene See IReferenceCounted::drop() for more information. */ virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0; - //! Saves the current scene into a file. - /** Scene nodes with the option isDebugObject set to true are - not being saved. The scene is usually written to an .irr file, - an xml based format. .irr files can Be edited with the Irrlicht - Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To - load .irr files again, see ISceneManager::loadScene(). - \param filename Name of the file. - \param userDataSerializer If you want to save some user data - for every scene node into the file, implement the - ISceneUserDataSerializer interface and provide it as parameter - here. Otherwise, simply specify 0 as this parameter. - \param node Node which is taken as the top node of the scene. - This node and all of its descendants are saved into the scene - file. Pass 0 or the scene manager to save the full scene (which - is also the default). - \return True if successful. */ - virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; - - //! Saves the current scene into a file. - /** Scene nodes with the option isDebugObject set to true are - not being saved. The scene is usually written to an .irr file, - an xml based format. .irr files can Be edited with the Irrlicht - Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To - load .irr files again, see ISceneManager::loadScene(). - \param file File where the scene is saved into. - \param userDataSerializer If you want to save some user data - for every scene node into the file, implement the - ISceneUserDataSerializer interface and provide it as parameter - here. Otherwise, simply specify 0 as this parameter. - \param node Node which is taken as the top node of the scene. - This node and all of its descendants are saved into the scene - file. Pass 0 or the scene manager to save the full scene (which - is also the default). - \return True if successful. */ - virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; - - //! Loads a scene. Note that the current scene is not cleared before. - /** The scene is usually loaded from an .irr file, an xml based - format, but other scene formats can be added to the engine via - ISceneManager::addExternalSceneLoader. .irr files can Be edited - with the Irrlicht Engine Editor, irrEdit - (http://www.ambiera.com/irredit/) or saved directly by the engine - using ISceneManager::saveScene(). - \param filename Name of the file to load from. - \param userDataSerializer If you want to load user data - possibily saved in that file for some scene nodes in the file, - implement the ISceneUserDataSerializer interface and provide it - as parameter here. Otherwise, simply specify 0 as this - parameter. - \param rootNode Node which is taken as the root node of the - scene. Pass 0 to add the scene directly to the scene manager - (which is also the default). - \return True if successful. */ - virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0; - - //! Loads a scene. Note that the current scene is not cleared before. - /** The scene is usually loaded from an .irr file, an xml based - format, but other scene formats can be added to the engine via - ISceneManager::addExternalSceneLoader. .irr files can Be edited - with the Irrlicht Engine Editor, irrEdit - (http://www.ambiera.com/irredit/) or saved directly by the engine - using ISceneManager::saveScene(). - \param file File where the scene is loaded from. - \param userDataSerializer If you want to load user data - saved in that file for some scene nodes in the file, - implement the ISceneUserDataSerializer interface and provide it - as parameter here. Otherwise, simply specify 0 as this - parameter. - \param rootNode Node which is taken as the root node of the - scene. Pass 0 to add the scene directly to the scene manager - (which is also the default). - \return True if successful. */ - virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0; - //! Get a mesh writer implementation if available /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop() for details. */ diff --git a/include/ISceneNode.h b/include/ISceneNode.h index 63d1566b..3f50c6e9 100644 --- a/include/ISceneNode.h +++ b/include/ISceneNode.h @@ -5,7 +5,7 @@ #ifndef __I_SCENE_NODE_H_INCLUDED__ #define __I_SCENE_NODE_H_INCLUDED__ -#include "IAttributeExchangingObject.h" +#include "IReferenceCounted.h" #include "ESceneNodeTypes.h" #include "ECullingTypes.h" #include "EDebugSceneTypes.h" @@ -34,7 +34,7 @@ namespace scene example easily possible to attach a light to a moving car, or to place a walking character on a moving platform on a moving ship. */ - class ISceneNode : virtual public io::IAttributeExchangingObject + class ISceneNode : virtual public IReferenceCounted { public: @@ -571,67 +571,6 @@ namespace scene return ESNT_UNKNOWN; } - - //! Writes attributes of the scene node. - /** Implement this to expose the attributes of your scene node - for scripting languages, editors, debuggers or xml - serialization purposes. - \param out The attribute container to write into. - \param options Additional options which might influence the - serialization. */ - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_ - { - if (!out) - return; - out->addString("Name", Name.c_str()); - out->addInt("Id", ID ); - - out->addVector3d("Position", getPosition() ); - out->addVector3d("Rotation", getRotation() ); - out->addVector3d("Scale", getScale() ); - - out->addBool("Visible", IsVisible ); - out->addInt("AutomaticCulling", AutomaticCullingState); - out->addInt("DebugDataVisible", DebugDataVisible ); - out->addBool("IsDebugObject", IsDebugObject ); - } - - - //! Reads attributes of the scene node. - /** Implement this to set the attributes of your scene node for - scripting languages, editors, debuggers or xml deserialization - purposes. - \param in The attribute container to read from. - \param options Additional options which might influence the - deserialization. */ - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_ - { - if (!in) - return; - Name = in->getAttributeAsString("Name", Name); - ID = in->getAttributeAsInt("Id", ID); - - setPosition(in->getAttributeAsVector3d("Position", RelativeTranslation)); - setRotation(in->getAttributeAsVector3d("Rotation", RelativeRotation)); - setScale(in->getAttributeAsVector3d("Scale", RelativeScale)); - - IsVisible = in->getAttributeAsBool("Visible", IsVisible); - if (in->existsAttribute("AutomaticCulling")) - { - s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling", - scene::AutomaticCullingNames); - if (tmpState != -1) - AutomaticCullingState = (u32)tmpState; - else - AutomaticCullingState = in->getAttributeAsInt("AutomaticCulling"); - } - - DebugDataVisible = in->getAttributeAsInt("DebugDataVisible", DebugDataVisible); - IsDebugObject = in->getAttributeAsBool("IsDebugObject", IsDebugObject); - - updateAbsolutePosition(); - } - //! Creates a clone of this scene node and its children. /** \param newParent An optional new parent. \param newManager An optional new scene manager. diff --git a/include/ISceneUserDataSerializer.h b/include/ISceneUserDataSerializer.h deleted file mode 100644 index 46b15b53..00000000 --- a/include/ISceneUserDataSerializer.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2002-2012 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__ -#define __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__ - -#include "IReferenceCounted.h" - -namespace irr -{ -namespace io -{ - class IAttributes; -} // end namespace io -namespace scene -{ - class ISceneNode; - -//! Interface to read and write user data to and from .irr files. -/** This interface is to be implemented by the user, to make it possible to read -and write user data when reading or writing .irr files via ISceneManager. -To be used with ISceneManager::loadScene() and ISceneManager::saveScene() */ -class ISceneUserDataSerializer -{ -public: - - virtual ~ISceneUserDataSerializer() {} - - //! Called when the scene manager create a scene node while loading a file. - virtual void OnCreateNode(ISceneNode* node) = 0; - - //! Called when the scene manager read a scene node while loading a file. - /** The userData pointer contains a list of attributes with userData which - were attached to the scene node in the read scene file.*/ - virtual void OnReadUserData(ISceneNode* forSceneNode, io::IAttributes* userData) = 0; - - //! Called when the scene manager is writing a scene node to an xml file for example. - /** Implement this method and return a list of attributes containing the user data - you want to be saved together with the scene node. Return 0 if no user data should - be added. Please note that the scene manager will call drop() to the returned pointer - after it no longer needs it, so if you didn't create a new object for the return value - and returning a longer existing IAttributes object, simply call grab() before returning it. */ - virtual io::IAttributes* createUserData(ISceneNode* forSceneNode) = 0; -}; - -} // end namespace scene -} // end namespace irr - -#endif - diff --git a/include/IVideoDriver.h b/include/IVideoDriver.h index eac3670c..744bcc93 100644 --- a/include/IVideoDriver.h +++ b/include/IVideoDriver.h @@ -25,7 +25,6 @@ namespace irr namespace io { class IAttributes; - struct SAttributeReadWriteOptions; class IReadFile; class IWriteFile; } // end namespace io @@ -1341,28 +1340,6 @@ namespace video When false the names will stay at the original index */ virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames=true) = 0; - //! Creates material attributes list from a material - /** This method is useful for serialization and more. - Please note that the video driver will use the material - renderer names from getMaterialRendererName() to write out the - material type name, so they should be set before. - \param material The material to serialize. - \param options Additional options which might influence the - serialization. - \return The io::IAttributes container holding the material - properties. */ - virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material, - io::SAttributeReadWriteOptions* options=0) =0; - - //! Fills an SMaterial structure from attributes. - /** Please note that for setting material types of the - material, the video driver will need to query the material - renderers for their names, so all non built-in materials must - have been created before calling this method. - \param outMaterial The material to set the properties for. - \param attributes The attributes to read from. */ - virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) =0; - //! Returns driver and operating system specific data about the IVideoDriver. /** This method should only be used if the engine should be extended without having to modify the source of the engine. diff --git a/include/SceneParameters.h b/include/SceneParameters.h index 88e2a6de..e6a6827c 100644 --- a/include/SceneParameters.h +++ b/include/SceneParameters.h @@ -48,32 +48,6 @@ namespace scene **/ const c8* const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles"; - - //! Flag to ignore the b3d file's mipmapping flag - /** Instead Irrlicht's texture creation flag is used. Use it like this: - \code - SceneManager->getParameters()->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true); - \endcode - **/ - const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag"; - - //! Name of the parameter for setting the length of debug normals. - /** Use it like this: - \code - SceneManager->getParameters()->setAttribute(scene::DEBUG_NORMAL_LENGTH, 1.5f); - \endcode - **/ - const c8* const DEBUG_NORMAL_LENGTH = "DEBUG_Normal_Length"; - - //! Name of the parameter for setting the color of debug normals. - /** Use it like this: - \code - SceneManager->getParameters()->setAttributeAsColor(scene::DEBUG_NORMAL_COLOR, video::SColor(255, 255, 255, 255)); - \endcode - **/ - const c8* const DEBUG_NORMAL_COLOR = "DEBUG_Normal_Color"; - - } // end namespace scene } // end namespace irr diff --git a/include/irrlicht.h b/include/irrlicht.h index 15a8eca2..eb60806c 100644 --- a/include/irrlicht.h +++ b/include/irrlicht.h @@ -53,7 +53,6 @@ #include "heapsort.h" #include "IAnimatedMesh.h" #include "IAnimatedMeshSceneNode.h" -#include "IAttributeExchangingObject.h" #include "IAttributes.h" #include "IBillboardSceneNode.h" #include "IBoneSceneNode.h" @@ -120,11 +119,9 @@ #include "irrTypes.h" #include "path.h" #include "ISceneCollisionManager.h" -#include "ISceneLoader.h" #include "ISceneManager.h" #include "ISceneNode.h" #include "ISceneNodeFactory.h" -#include "ISceneUserDataSerializer.h" #include "IShaderConstantSetCallBack.h" #include "ISkinnedMesh.h" #include "ITexture.h" diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/source/Irrlicht/CAnimatedMeshSceneNode.cpp index 21733a0e..085ba631 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.cpp +++ b/source/Irrlicht/CAnimatedMeshSceneNode.cpp @@ -343,8 +343,8 @@ void CAnimatedMeshSceneNode::render() // show normals if (DebugDataVisible & scene::EDS_NORMALS) { - const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH); - const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR); + const f32 debugNormalLength = 1.f; + const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221); const u32 count = m->getMeshBufferCount(); // draw normals @@ -652,54 +652,6 @@ bool CAnimatedMeshSceneNode::isReadOnlyMaterials() const } -//! Writes attributes of the scene node. -void CAnimatedMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IAnimatedMeshSceneNode::serializeAttributes(out, options); - - if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename) - { - const io::path path = SceneManager->getFileSystem()->getRelativeFilename( - SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()), - options->Filename); - out->addString("Mesh", path.c_str()); - } - else - out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str()); - out->addBool("Looping", Looping); - out->addBool("ReadOnlyMaterials", ReadOnlyMaterials); - out->addFloat("FramesPerSecond", FramesPerSecond); - out->addInt("StartFrame", StartFrame); - out->addInt("EndFrame", EndFrame); -} - - -//! Reads attributes of the scene node. -void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - IAnimatedMeshSceneNode::deserializeAttributes(in, options); - - io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh); - io::path newMeshStr = in->getAttributeAsString("Mesh"); - - Looping = in->getAttributeAsBool("Looping"); - ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials"); - FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond"); - StartFrame = in->getAttributeAsInt("StartFrame"); - EndFrame = in->getAttributeAsInt("EndFrame"); - - if (newMeshStr != "" && oldMeshStr != newMeshStr) - { - IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str()); - - if (newAnimatedMesh) - setMesh(newAnimatedMesh); - } - - // TODO: read animation names instead of frame begin and ends -} - - //! Sets a new mesh void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh) { diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.h b/source/Irrlicht/CAnimatedMeshSceneNode.h index 6bf057b4..ba5df880 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.h +++ b/source/Irrlicht/CAnimatedMeshSceneNode.h @@ -114,12 +114,6 @@ namespace scene //! Returns the current mesh virtual IAnimatedMesh* getMesh(void) _IRR_OVERRIDE_ { return Mesh; } - //! Writes attributes of the scene node. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the scene node. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_ANIMATED_MESH; } diff --git a/source/Irrlicht/CAttributeImpl.h b/source/Irrlicht/CAttributeImpl.h index 3796fed9..df9102a8 100644 --- a/source/Irrlicht/CAttributeImpl.h +++ b/source/Irrlicht/CAttributeImpl.h @@ -42,11 +42,6 @@ public: return BoolValue; } - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - return core::stringw( BoolValue ? L"true" : L"false" ); - } - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ { BoolValue = (intValue != 0); @@ -62,11 +57,6 @@ public: BoolValue = boolValue; } - virtual void setString(const char* string) _IRR_OVERRIDE_ - { - BoolValue = strcmp(string, "true") == 0; - } - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ { return EAT_BOOL; @@ -101,16 +91,6 @@ public: return (f32)Value; } - virtual bool getBool() const _IRR_OVERRIDE_ - { - return (Value != 0); - } - - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - return core::stringw(Value); - } - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ { Value = intValue; @@ -121,17 +101,11 @@ public: Value = (s32)floatValue; }; - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - Value = atoi(text); - } - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ { return EAT_INT; } - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ { return L"int"; @@ -161,16 +135,6 @@ public: return Value; } - virtual bool getBool() const _IRR_OVERRIDE_ - { - return (Value != 0); - } - - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - return core::stringw((double)Value); - } - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ { Value = (f32)intValue; @@ -181,17 +145,11 @@ public: Value = floatValue; } - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - Value = core::fast_atof(text); - } - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ { return EAT_FLOAT; } - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ { return L"float"; @@ -200,1894 +158,5 @@ public: f32 Value; }; - - -/* - Types which can be represented as a list of numbers -*/ - -// Base class for all attributes which are a list of numbers- -// vectors, colors, positions, triangles, etc -class CNumbersAttribute : public IAttribute -{ -public: - - CNumbersAttribute(const char* name, video::SColorf value) : - ValueI(), ValueF(), Count(4), IsFloat(true) - { - Name = name; - ValueF.push_back(value.r); - ValueF.push_back(value.g); - ValueF.push_back(value.b); - ValueF.push_back(value.a); - } - - CNumbersAttribute(const char* name, video::SColor value) : - ValueI(), ValueF(), Count(4), IsFloat(false) - { - Name = name; - ValueI.push_back(value.getRed()); - ValueI.push_back(value.getGreen()); - ValueI.push_back(value.getBlue()); - ValueI.push_back(value.getAlpha()); - } - - - CNumbersAttribute(const char* name, const core::vector3df& value) : - ValueI(), ValueF(), Count(3), IsFloat(true) - { - Name = name; - ValueF.push_back(value.X); - ValueF.push_back(value.Y); - ValueF.push_back(value.Z); - } - - CNumbersAttribute(const char* name, const core::rect& value) : - ValueI(), ValueF(), Count(4), IsFloat(false) - { - Name = name; - ValueI.push_back(value.UpperLeftCorner.X); - ValueI.push_back(value.UpperLeftCorner.Y); - ValueI.push_back(value.LowerRightCorner.X); - ValueI.push_back(value.LowerRightCorner.Y); - } - - CNumbersAttribute(const char* name, const core::rect& value) : - ValueI(), ValueF(), Count(4), IsFloat(true) - { - Name = name; - ValueF.push_back(value.UpperLeftCorner.X); - ValueF.push_back(value.UpperLeftCorner.Y); - ValueF.push_back(value.LowerRightCorner.X); - ValueF.push_back(value.LowerRightCorner.Y); - } - - CNumbersAttribute(const char* name, const core::matrix4& value) : - ValueI(), ValueF(), Count(16), IsFloat(true) - { - Name = name; - for (s32 r=0; r<4; ++r) - for (s32 c=0; c<4; ++c) - ValueF.push_back(value(r,c)); - } - - CNumbersAttribute(const char* name, const core::quaternion& value) : - ValueI(), ValueF(), Count(4), IsFloat(true) - { - Name = name; - ValueF.push_back(value.X); - ValueF.push_back(value.Y); - ValueF.push_back(value.Z); - ValueF.push_back(value.W); - } - - CNumbersAttribute(const char* name, const core::aabbox3d& value) : - ValueI(), ValueF(), Count(6), IsFloat(true) - { - Name = name; - ValueF.push_back(value.MinEdge.X); - ValueF.push_back(value.MinEdge.Y); - ValueF.push_back(value.MinEdge.Z); - ValueF.push_back(value.MaxEdge.X); - ValueF.push_back(value.MaxEdge.Y); - ValueF.push_back(value.MaxEdge.Z); - } - - CNumbersAttribute(const char* name, const core::plane3df& value) : - ValueI(), ValueF(), Count(4), IsFloat(true) - { - Name = name; - ValueF.push_back(value.Normal.X); - ValueF.push_back(value.Normal.Y); - ValueF.push_back(value.Normal.Z); - ValueF.push_back(value.D); - } - - CNumbersAttribute(const char* name, const core::triangle3df& value) : - ValueI(), ValueF(), Count(9), IsFloat(true) - { - Name = name; - ValueF.push_back(value.pointA.X); - ValueF.push_back(value.pointA.Y); - ValueF.push_back(value.pointA.Z); - ValueF.push_back(value.pointB.X); - ValueF.push_back(value.pointB.Y); - ValueF.push_back(value.pointB.Z); - ValueF.push_back(value.pointC.X); - ValueF.push_back(value.pointC.Y); - ValueF.push_back(value.pointC.Z); - } - - CNumbersAttribute(const char* name, const core::vector2df& value) : - ValueI(), ValueF(), Count(2), IsFloat(true) - { - Name = name; - ValueF.push_back(value.X); - ValueF.push_back(value.Y); - } - - CNumbersAttribute(const char* name, const core::vector2di& value) : - ValueI(), ValueF(), Count(2), IsFloat(false) - { - Name = name; - ValueI.push_back(value.X); - ValueI.push_back(value.Y); - } - - CNumbersAttribute(const char* name, const core::line2di& value) : - ValueI(), ValueF(), Count(4), IsFloat(false) - { - Name = name; - ValueI.push_back(value.start.X); - ValueI.push_back(value.start.Y); - ValueI.push_back(value.end.X); - ValueI.push_back(value.end.Y); - } - - CNumbersAttribute(const char* name, const core::line2df& value) : - ValueI(), ValueF(), Count(4), IsFloat(true) - { - Name = name; - ValueF.push_back(value.start.X); - ValueF.push_back(value.start.Y); - ValueF.push_back(value.end.X); - ValueF.push_back(value.end.Y); - } - - CNumbersAttribute(const char* name, const core::line3df& value) : - ValueI(), ValueF(), Count(6), IsFloat(true) - { - Name = name; - ValueF.push_back(value.start.X); - ValueF.push_back(value.start.Y); - ValueF.push_back(value.start.Z); - ValueF.push_back(value.end.X); - ValueF.push_back(value.end.Y); - ValueF.push_back(value.end.Z); - } - - CNumbersAttribute(const char* name, const core::dimension2du& value) : - ValueI(), ValueF(), Count(2), IsFloat(false) - { - Name = name; - ValueI.push_back(value.Width); - ValueI.push_back(value.Height); - } - - - CNumbersAttribute(const char* name, const core::dimension2df& value) : - ValueI(), ValueF(), Count(2), IsFloat(true) - { - Name = name; - ValueF.push_back(value.Width); - ValueF.push_back(value.Height); - } - - // getting values - virtual s32 getInt() const _IRR_OVERRIDE_ - { - if (Count==0) - return 0; - - if (IsFloat) - return (s32)ValueF[0]; - else - return ValueI[0]; - } - - virtual f32 getFloat() const _IRR_OVERRIDE_ - { - if (Count==0) - return 0.0f; - - if (IsFloat) - return ValueF[0]; - else - return (f32)ValueI[0]; - } - - virtual bool getBool() const _IRR_OVERRIDE_ - { - // return true if any number is nonzero - bool ret=false; - - for (u32 i=0; i < Count; ++i) - if ( IsFloat ? (ValueF[i] != 0) : (ValueI[i] != 0) ) - { - ret=true; - break; - } - - return ret; - } - - - virtual core::stringc getString() const _IRR_OVERRIDE_ - { - core::stringc outstr; - - for (u32 i=0; i 0 ? ValueF[0] : 0); - p.Y = (s32)(Count > 1 ? ValueF[1] : 0); - } - else - { - p.X = Count > 0 ? ValueI[0] : 0; - p.Y = Count > 1 ? ValueI[1] : 0; - } - - return p; - } - - virtual core::vector3df getVector() const _IRR_OVERRIDE_ - { - core::vector3df v; - - if (IsFloat) - { - v.X = Count > 0 ? ValueF[0] : 0; - v.Y = Count > 1 ? ValueF[1] : 0; - v.Z = Count > 2 ? ValueF[2] : 0; - } - else - { - v.X = (f32)(Count > 0 ? ValueI[0] : 0); - v.Y = (f32)(Count > 1 ? ValueI[1] : 0); - v.Z = (f32)(Count > 2 ? ValueI[2] : 0); - } - - return v; - } - - virtual core::vector2df getVector2d() const _IRR_OVERRIDE_ - { - core::vector2df v; - - if (IsFloat) - { - v.X = Count > 0 ? ValueF[0] : 0; - v.Y = Count > 1 ? ValueF[1] : 0; - } - else - { - v.X = (f32)(Count > 0 ? ValueI[0] : 0); - v.Y = (f32)(Count > 1 ? ValueI[1] : 0); - } - - return v; - } - - virtual video::SColorf getColorf() const _IRR_OVERRIDE_ - { - video::SColorf c; - if (IsFloat) - { - c.setColorComponentValue(0, Count > 0 ? ValueF[0] : 0); - c.setColorComponentValue(1, Count > 1 ? ValueF[1] : 0); - c.setColorComponentValue(2, Count > 2 ? ValueF[2] : 0); - c.setColorComponentValue(3, Count > 3 ? ValueF[3] : 0); - } - else - { - c.setColorComponentValue(0, Count > 0 ? (f32)(ValueI[0]) / 255.0f : 0); - c.setColorComponentValue(1, Count > 1 ? (f32)(ValueI[1]) / 255.0f : 0); - c.setColorComponentValue(2, Count > 2 ? (f32)(ValueI[2]) / 255.0f : 0); - c.setColorComponentValue(3, Count > 3 ? (f32)(ValueI[3]) / 255.0f : 0); - } - - return c; - } - - virtual video::SColor getColor() const _IRR_OVERRIDE_ - { - return getColorf().toSColor(); - } - - - virtual core::rect getRect() const _IRR_OVERRIDE_ - { - core::rect r; - - if (IsFloat) - { - r.UpperLeftCorner.X = (s32)(Count > 0 ? ValueF[0] : 0); - r.UpperLeftCorner.Y = (s32)(Count > 1 ? ValueF[1] : 0); - r.LowerRightCorner.X = (s32)(Count > 2 ? ValueF[2] : r.UpperLeftCorner.X); - r.LowerRightCorner.Y = (s32)(Count > 3 ? ValueF[3] : r.UpperLeftCorner.Y); - } - else - { - r.UpperLeftCorner.X = Count > 0 ? ValueI[0] : 0; - r.UpperLeftCorner.Y = Count > 1 ? ValueI[1] : 0; - r.LowerRightCorner.X = Count > 2 ? ValueI[2] : r.UpperLeftCorner.X; - r.LowerRightCorner.Y = Count > 3 ? ValueI[3] : r.UpperLeftCorner.Y; - } - return r; - } - - virtual core::dimension2du getDimension2d() const _IRR_OVERRIDE_ - { - core::dimension2d dim; - - if (IsFloat) - { - dim.Width = (u32)(Count > 0 ? ValueF[0] : 0); - dim.Height = (u32)(Count > 1 ? ValueF[1] : 0); - } - else - { - dim.Width = (u32)(Count > 0 ? ValueI[0] : 0); - dim.Height = (u32)(Count > 1 ? ValueI[1] : 0); - } - return dim; - } - - virtual core::matrix4 getMatrix() const _IRR_OVERRIDE_ - { - core::matrix4 ret; - if (IsFloat) - { - for (u32 r=0; r<4; ++r) - for (u32 c=0; c<4; ++c) - if (Count > c+r*4) - ret(r,c) = ValueF[c+r*4]; - } - else - { - for (u32 r=0; r<4; ++r) - for (u32 c=0; c<4; ++c) - if (Count > c+r*4) - ret(r,c) = (f32)ValueI[c+r*4]; - } - return ret; - } - - virtual core::quaternion getQuaternion() const _IRR_OVERRIDE_ - { - core::quaternion ret; - if (IsFloat) - { - ret.X = Count > 0 ? ValueF[0] : 0.0f; - ret.Y = Count > 1 ? ValueF[1] : 0.0f; - ret.Z = Count > 2 ? ValueF[2] : 0.0f; - ret.W = Count > 3 ? ValueF[3] : 0.0f; - } - else - { - ret.X = Count > 0 ? (f32)ValueI[0] : 0.0f; - ret.Y = Count > 1 ? (f32)ValueI[1] : 0.0f; - ret.Z = Count > 2 ? (f32)ValueI[2] : 0.0f; - ret.W = Count > 3 ? (f32)ValueI[3] : 0.0f; - } - return ret; - } - - virtual core::triangle3df getTriangle() const _IRR_OVERRIDE_ - { - core::triangle3df ret; - - if (IsFloat) - { - ret.pointA.X = Count > 0 ? ValueF[0] : 0.0f; - ret.pointA.Y = Count > 1 ? ValueF[1] : 0.0f; - ret.pointA.Z = Count > 2 ? ValueF[2] : 0.0f; - ret.pointB.X = Count > 3 ? ValueF[3] : 0.0f; - ret.pointB.Y = Count > 4 ? ValueF[4] : 0.0f; - ret.pointB.Z = Count > 5 ? ValueF[5] : 0.0f; - ret.pointC.X = Count > 6 ? ValueF[6] : 0.0f; - ret.pointC.Y = Count > 7 ? ValueF[7] : 0.0f; - ret.pointC.Z = Count > 8 ? ValueF[8] : 0.0f; - } - else - { - ret.pointA.X = Count > 0 ? (f32)ValueI[0] : 0.0f; - ret.pointA.Y = Count > 1 ? (f32)ValueI[1] : 0.0f; - ret.pointA.Z = Count > 2 ? (f32)ValueI[2] : 0.0f; - ret.pointB.X = Count > 3 ? (f32)ValueI[3] : 0.0f; - ret.pointB.Y = Count > 4 ? (f32)ValueI[4] : 0.0f; - ret.pointB.Z = Count > 5 ? (f32)ValueI[5] : 0.0f; - ret.pointC.X = Count > 6 ? (f32)ValueI[6] : 0.0f; - ret.pointC.Y = Count > 7 ? (f32)ValueI[7] : 0.0f; - ret.pointC.Z = Count > 8 ? (f32)ValueI[8] : 0.0f; - } - - return ret; - } - - virtual core::plane3df getPlane() const _IRR_OVERRIDE_ - { - core::plane3df ret; - - if (IsFloat) - { - ret.Normal.X = Count > 0 ? ValueF[0] : 0.0f; - ret.Normal.Y = Count > 1 ? ValueF[1] : 0.0f; - ret.Normal.Z = Count > 2 ? ValueF[2] : 0.0f; - ret.D = Count > 3 ? ValueF[3] : 0.0f; - } - else - { - ret.Normal.X = Count > 0 ? (f32)ValueI[0] : 0.0f; - ret.Normal.Y = Count > 1 ? (f32)ValueI[1] : 0.0f; - ret.Normal.Z = Count > 2 ? (f32)ValueI[2] : 0.0f; - ret.D = Count > 3 ? (f32)ValueI[3] : 0.0f; - } - - return ret; - } - - virtual core::aabbox3df getBBox() const _IRR_OVERRIDE_ - { - core::aabbox3df ret; - if (IsFloat) - { - ret.MinEdge.X = Count > 0 ? ValueF[0] : 0.0f; - ret.MinEdge.Y = Count > 1 ? ValueF[1] : 0.0f; - ret.MinEdge.Z = Count > 2 ? ValueF[2] : 0.0f; - ret.MaxEdge.X = Count > 3 ? ValueF[3] : 0.0f; - ret.MaxEdge.Y = Count > 4 ? ValueF[4] : 0.0f; - ret.MaxEdge.Z = Count > 5 ? ValueF[5] : 0.0f; - } - else - { - ret.MinEdge.X = Count > 0 ? (f32)ValueI[0] : 0.0f; - ret.MinEdge.Y = Count > 1 ? (f32)ValueI[1] : 0.0f; - ret.MinEdge.Z = Count > 2 ? (f32)ValueI[2] : 0.0f; - ret.MaxEdge.X = Count > 3 ? (f32)ValueI[3] : 0.0f; - ret.MaxEdge.Y = Count > 4 ? (f32)ValueI[4] : 0.0f; - ret.MaxEdge.Z = Count > 5 ? (f32)ValueI[5] : 0.0f; - } - return ret; - - } - - virtual core::line2df getLine2d() const _IRR_OVERRIDE_ - { - core::line2df ret; - if (IsFloat) - { - ret.start.X = Count > 0 ? ValueF[0] : 0.0f; - ret.start.Y = Count > 1 ? ValueF[1] : 0.0f; - ret.end.X = Count > 2 ? ValueF[2] : 0.0f; - ret.end.Y = Count > 3 ? ValueF[3] : 0.0f; - } - else - { - ret.start.X = Count > 0 ? (f32)ValueI[0] : 0.0f; - ret.start.Y = Count > 1 ? (f32)ValueI[1] : 0.0f; - ret.end.X = Count > 2 ? (f32)ValueI[2] : 0.0f; - ret.end.Y = Count > 3 ? (f32)ValueI[3] : 0.0f; - } - return ret; - } - - virtual core::line3df getLine3d() const _IRR_OVERRIDE_ - { - core::line3df ret; - if (IsFloat) - { - ret.start.X = Count > 0 ? ValueF[0] : 0.0f; - ret.start.Y = Count > 1 ? ValueF[1] : 0.0f; - ret.start.Z = Count > 2 ? ValueF[2] : 0.0f; - ret.end.X = Count > 3 ? ValueF[3] : 0.0f; - ret.end.Y = Count > 4 ? ValueF[4] : 0.0f; - ret.end.Z = Count > 5 ? ValueF[5] : 0.0f; - } - else - { - ret.start.X = Count > 0 ? (f32)ValueI[0] : 0.0f; - ret.start.Y = Count > 1 ? (f32)ValueI[1] : 0.0f; - ret.start.Z = Count > 2 ? (f32)ValueI[2] : 0.0f; - ret.end.X = Count > 3 ? (f32)ValueI[3] : 0.0f; - ret.end.Y = Count > 4 ? (f32)ValueI[4] : 0.0f; - ret.end.Z = Count > 5 ? (f32)ValueI[5] : 0.0f; - } - return ret; - } - - //! get float array - virtual core::array getFloatArray() - { - if (!IsFloat) - { - ValueF.clear(); - for (u32 i=0; i getIntArray() - { - if (IsFloat) - { - ValueI.clear(); - for (u32 i=0; i '9') ) ) - ++P; - - // set value - if ( *P) - { - if (IsFloat) - { - f32 c = 0; - P = core::fast_atof_move(P, c); - ValueF[i] = c; - } - else - { - // todo: fix this to read ints properly - f32 c = 0; - P = core::fast_atof_move(P, c); - ValueI[i] = (s32)c; - - } - } - } - // todo: warning message - //if (i < Count-1) - //{ - // - //} - } - - virtual void setPosition(const core::position2di& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = (f32)v.X; - if (Count > 1) ValueF[1] = (f32)v.Y; - } - else - { - if (Count > 0) ValueI[0] = v.X; - if (Count > 1) ValueI[1] = v.Y; - } - } - - virtual void setVector(const core::vector3df& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = v.X; - if (Count > 1) ValueF[1] = v.Y; - if (Count > 2) ValueF[2] = v.Z; - } - else - { - if (Count > 0) ValueI[0] = (s32)v.X; - if (Count > 1) ValueI[1] = (s32)v.Y; - if (Count > 2) ValueI[2] = (s32)v.Z; - } - } - - virtual void setColor(video::SColorf color) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = color.r; - if (Count > 1) ValueF[1] = color.g; - if (Count > 2) ValueF[2] = color.b; - if (Count > 3) ValueF[3] = color.a; - } - else - { - if (Count > 0) ValueI[0] = (s32)(color.r * 255); - if (Count > 1) ValueI[1] = (s32)(color.g * 255); - if (Count > 2) ValueI[2] = (s32)(color.b * 255); - if (Count > 3) ValueI[3] = (s32)(color.a * 255); - } - - } - - virtual void setColor(video::SColor color) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = (f32)color.getRed() / 255.0f; - if (Count > 1) ValueF[1] = (f32)color.getGreen() / 255.0f; - if (Count > 2) ValueF[2] = (f32)color.getBlue() / 255.0f; - if (Count > 3) ValueF[3] = (f32)color.getAlpha() / 255.0f; - } - else - { - if (Count > 0) ValueI[0] = color.getRed(); - if (Count > 1) ValueI[1] = color.getGreen(); - if (Count > 2) ValueI[2] = color.getBlue(); - if (Count > 3) ValueI[3] = color.getAlpha(); - } - } - - virtual void setRect(const core::rect& value) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = (f32)value.UpperLeftCorner.X; - if (Count > 1) ValueF[1] = (f32)value.UpperLeftCorner.Y; - if (Count > 2) ValueF[2] = (f32)value.LowerRightCorner.X; - if (Count > 3) ValueF[3] = (f32)value.LowerRightCorner.Y; - } - else - { - if (Count > 0) ValueI[0] = value.UpperLeftCorner.X; - if (Count > 1) ValueI[1] = value.UpperLeftCorner.Y; - if (Count > 2) ValueI[2] = value.LowerRightCorner.X; - if (Count > 3) ValueI[3] = value.LowerRightCorner.Y; - } - } - - virtual void setMatrix(const core::matrix4& value) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - for (u32 r=0; r<4; ++r) - for (u32 c=0; c<4; ++c) - if (Count > c+r*4) - ValueF[c+r*4] = value(r,c); - } - else - { - for (u32 r=0; r<4; ++r) - for (u32 c=0; c<4; ++c) - if (Count > c+r*4) - ValueI[c+r*4] = (s32)value(r,c); - } - } - - virtual void setQuaternion(const core::quaternion& value) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = value.X; - if (Count > 1) ValueF[1] = value.Y; - if (Count > 2) ValueF[2] = value.Z; - if (Count > 3) ValueF[3] = value.W; - } - else - { - if (Count > 0) ValueI[0] = (s32)value.X; - if (Count > 1) ValueI[1] = (s32)value.Y; - if (Count > 2) ValueI[2] = (s32)value.Z; - if (Count > 3) ValueI[3] = (s32)value.W; - } - } - - virtual void setBoundingBox(const core::aabbox3d& value) - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = value.MinEdge.X; - if (Count > 1) ValueF[1] = value.MinEdge.Y; - if (Count > 2) ValueF[2] = value.MinEdge.Z; - if (Count > 3) ValueF[3] = value.MaxEdge.X; - if (Count > 4) ValueF[4] = value.MaxEdge.Y; - if (Count > 5) ValueF[5] = value.MaxEdge.Z; - } - else - { - if (Count > 0) ValueI[0] = (s32)value.MinEdge.X; - if (Count > 1) ValueI[1] = (s32)value.MinEdge.Y; - if (Count > 2) ValueI[2] = (s32)value.MinEdge.Z; - if (Count > 3) ValueI[3] = (s32)value.MaxEdge.X; - if (Count > 4) ValueI[4] = (s32)value.MaxEdge.Y; - if (Count > 5) ValueI[5] = (s32)value.MaxEdge.Z; - } - } - - virtual void setPlane(const core::plane3df& value) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = value.Normal.X; - if (Count > 1) ValueF[1] = value.Normal.Y; - if (Count > 2) ValueF[2] = value.Normal.Z; - if (Count > 3) ValueF[3] = value.D; - } - else - { - if (Count > 0) ValueI[0] = (s32)value.Normal.X; - if (Count > 1) ValueI[1] = (s32)value.Normal.Y; - if (Count > 2) ValueI[2] = (s32)value.Normal.Z; - if (Count > 3) ValueI[3] = (s32)value.D; - } - } - - virtual void setTriangle3d(const core::triangle3df& value) - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = value.pointA.X; - if (Count > 1) ValueF[1] = value.pointA.Y; - if (Count > 2) ValueF[2] = value.pointA.Z; - if (Count > 3) ValueF[3] = value.pointB.X; - if (Count > 4) ValueF[4] = value.pointB.Y; - if (Count > 5) ValueF[5] = value.pointB.Z; - if (Count > 6) ValueF[6] = value.pointC.X; - if (Count > 7) ValueF[7] = value.pointC.Y; - if (Count > 8) ValueF[8] = value.pointC.Z; - } - else - { - if (Count > 0) ValueI[0] = (s32)value.pointA.X; - if (Count > 1) ValueI[1] = (s32)value.pointA.Y; - if (Count > 2) ValueI[2] = (s32)value.pointA.Z; - if (Count > 3) ValueI[3] = (s32)value.pointB.X; - if (Count > 4) ValueI[4] = (s32)value.pointB.Y; - if (Count > 5) ValueI[5] = (s32)value.pointB.Z; - if (Count > 6) ValueI[6] = (s32)value.pointC.X; - if (Count > 7) ValueI[7] = (s32)value.pointC.Y; - if (Count > 8) ValueI[8] = (s32)value.pointC.Z; - } - } - - virtual void setVector2d(const core::vector2df& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = v.X; - if (Count > 1) ValueF[1] = v.Y; - } - else - { - if (Count > 0) ValueI[0] = (s32)v.X; - if (Count > 1) ValueI[1] = (s32)v.Y; - } - } - - virtual void setVector2d(const core::vector2di& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = (f32)v.X; - if (Count > 1) ValueF[1] = (f32)v.Y; - } - else - { - if (Count > 0) ValueI[0] = v.X; - if (Count > 1) ValueI[1] = v.Y; - } - } - - virtual void setLine2d(const core::line2di& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = (f32)v.start.X; - if (Count > 1) ValueF[1] = (f32)v.start.Y; - if (Count > 2) ValueF[2] = (f32)v.end.X; - if (Count > 3) ValueF[3] = (f32)v.end.Y; - } - else - { - if (Count > 0) ValueI[0] = v.start.X; - if (Count > 1) ValueI[1] = v.start.Y; - if (Count > 2) ValueI[2] = v.end.X; - if (Count > 3) ValueI[3] = v.end.Y; - } - } - - virtual void setLine2d(const core::line2df& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = v.start.X; - if (Count > 1) ValueF[1] = v.start.Y; - if (Count > 2) ValueF[2] = v.end.X; - if (Count > 3) ValueF[3] = v.end.Y; - } - else - { - if (Count > 0) ValueI[0] = (s32)v.start.X; - if (Count > 1) ValueI[1] = (s32)v.start.Y; - if (Count > 2) ValueI[2] = (s32)v.end.X; - if (Count > 3) ValueI[3] = (s32)v.end.Y; - } - } - - virtual void setDimension2d(const core::dimension2du& v) _IRR_OVERRIDE_ - { - reset(); - if (IsFloat) - { - if (Count > 0) ValueF[0] = (f32)v.Width; - if (Count > 1) ValueF[1] = (f32)v.Height; - } - else - { - if (Count > 0) ValueI[0] = (s32)v.Width; - if (Count > 1) ValueI[1] = (s32)v.Height; - } - } - - //! set float array - virtual void setFloatArray(core::array &vals) - { - reset(); - - for (u32 i=0; i &vals) - { - reset(); - - for (u32 i=0; i ValueI; - core::array ValueF; - u32 Count; - bool IsFloat; -}; - - -// Attribute implemented for floating point colors -class CColorfAttribute : public CNumbersAttribute -{ -public: - - CColorfAttribute(const char* name, video::SColorf value) : CNumbersAttribute(name, value) {} - - virtual s32 getInt() const _IRR_OVERRIDE_ - { - return getColor().color; - } - - virtual f32 getFloat() const _IRR_OVERRIDE_ - { - return (f32)getColor().color; - } - - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ - { - video::SColorf c = video::SColor(intValue); - ValueF[0] = c.r; - ValueF[1] = c.g; - ValueF[2] = c.b; - ValueF[3] = c.a; - } - - virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_ - { - setInt((s32)floatValue); - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_COLORF; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"colorf"; - } -}; - - - -// Attribute implemented for colors -class CColorAttribute : public CNumbersAttribute -{ -public: - - CColorAttribute(const char* name, const video::SColorf& value) : CNumbersAttribute(name, value) {} - - CColorAttribute(const char* name, const video::SColor& value) : CNumbersAttribute(name, value) {} - - virtual s32 getInt() const _IRR_OVERRIDE_ - { - return getColor().color; - } - - virtual f32 getFloat() const _IRR_OVERRIDE_ - { - return (f32)getColor().color; - } - - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ - { - video::SColorf c = video::SColor(intValue); - ValueF[0] = c.r; - ValueF[1] = c.g; - ValueF[2] = c.b; - ValueF[3] = c.a; - } - - virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_ - { - setInt((s32)floatValue); - } - - virtual core::stringc getString() const _IRR_OVERRIDE_ - { - char tmp[10]; - const video::SColor c = getColor(); - sprintf(tmp, "%02x%02x%02x%02x", c.getAlpha(), c.getRed(), c.getGreen(), c.getBlue()); - return core::stringc(tmp); - } - - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - char tmp[10]; - const video::SColor c = getColor(); - sprintf(tmp, "%02x%02x%02x%02x", c.getAlpha(), c.getRed(), c.getGreen(), c.getBlue()); - return core::stringw(tmp); - } - - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - u32 c; - int characters; - const int items = sscanf(text, "%08x%n", &c, &characters); - if (items != 1 || characters != 8 ) - { - CNumbersAttribute::setString(text); - } - else - setColor(c); - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_COLOR; - } - - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"color"; - } - -}; - - -// Attribute implemented for 3d vectors -class CVector3DAttribute : public CNumbersAttribute -{ -public: - - CVector3DAttribute(const char* name, const core::vector3df& value) : CNumbersAttribute(name, value) {} - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_VECTOR3D; - } - - virtual core::matrix4 getMatrix() const _IRR_OVERRIDE_ - { - core::matrix4 ret; - ret.makeIdentity(); - ret.setTranslation( core::vector3df(ValueF[0],ValueF[1],ValueF[2]) ); - return ret; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"vector3d"; - } -}; - -// Attribute implemented for 2d vectors -class CVector2DAttribute : public CNumbersAttribute -{ -public: - - CVector2DAttribute(const char* name, const core::vector2df& value) : CNumbersAttribute(name, value) {} - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_VECTOR2D; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"vector2d"; - } -}; - -// Attribute implemented for 2d vectors -class CPosition2DAttribute : public CNumbersAttribute -{ -public: - - CPosition2DAttribute(const char* name, const core::position2di& value) : CNumbersAttribute(name, value) {} - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_POSITION2D; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"position"; - } -}; - - - -// Attribute implemented for rectangles -class CRectAttribute : public CNumbersAttribute -{ -public: - - CRectAttribute(const char* name, const core::rect& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_RECT; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"rect"; - } -}; - - -// Attribute implemented for dimension -class CDimension2dAttribute : public CNumbersAttribute -{ -public: - - CDimension2dAttribute (const char* name, const core::dimension2d& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_DIMENSION2D; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"dimension2d"; - } -}; - -// Attribute implemented for matrices -class CMatrixAttribute : public CNumbersAttribute -{ -public: - - CMatrixAttribute(const char* name, const core::matrix4& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_MATRIX; - } - - virtual core::quaternion getQuaternion() const _IRR_OVERRIDE_ - { - return core::quaternion(getMatrix()); - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"matrix"; - } -}; - -// Attribute implemented for quaternions -class CQuaternionAttribute : public CNumbersAttribute -{ -public: - - CQuaternionAttribute(const char* name, const core::quaternion& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_QUATERNION; - } - - virtual core::matrix4 getMatrix() const _IRR_OVERRIDE_ - { - return getQuaternion().getMatrix(); - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"quaternion"; - } -}; - - -// Attribute implemented for bounding boxes -class CBBoxAttribute : public CNumbersAttribute -{ -public: - - CBBoxAttribute(const char* name, const core::aabbox3df& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_BBOX; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"box3d"; - } -}; - -// Attribute implemented for planes -class CPlaneAttribute : public CNumbersAttribute -{ -public: - - CPlaneAttribute(const char* name, const core::plane3df& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_PLANE; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"plane"; - } -}; - -// Attribute implemented for triangles -class CTriangleAttribute : public CNumbersAttribute -{ -public: - - CTriangleAttribute(const char* name, const core::triangle3df& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_TRIANGLE3D; - } - - virtual core::plane3df getPlane() const _IRR_OVERRIDE_ - { - return getTriangle().getPlane(); - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"triangle"; - } -}; - - -// Attribute implemented for 2d lines -class CLine2dAttribute : public CNumbersAttribute -{ -public: - - CLine2dAttribute(const char* name, const core::line2df& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_LINE2D; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"line2d"; - } -}; - -// Attribute implemented for 3d lines -class CLine3dAttribute : public CNumbersAttribute -{ -public: - - CLine3dAttribute(const char* name, const core::line3df& value) : CNumbersAttribute(name, value) { } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_LINE3D; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"line3d"; - } -}; - - -// vector2df -// dimension2du - -/* - Special attributes -*/ - -// Attribute implemented for enumeration literals -class CEnumAttribute : public IAttribute -{ -public: - - CEnumAttribute(const char* name, const char* value, const char* const* literals) - { - Name = name; - setEnum(value, literals); - } - - virtual void setEnum(const char* enumValue, const char* const* enumerationLiterals) _IRR_OVERRIDE_ - { - u32 literalCount = 0; - - if (enumerationLiterals) - { - s32 i; - for (i=0; enumerationLiterals[i]; ++i) - ++literalCount; - - EnumLiterals.reallocate(literalCount); - for (i=0; enumerationLiterals[i]; ++i) - EnumLiterals.push_back(enumerationLiterals[i]); - } - - setString(enumValue); - } - - virtual s32 getInt() const _IRR_OVERRIDE_ - { - for (u32 i=0; i < EnumLiterals.size(); ++i) - { - if (Value.equals_ignore_case(EnumLiterals[i])) - { - return (s32)i; - } - } - - return -1; - } - - virtual f32 getFloat() const _IRR_OVERRIDE_ - { - return (f32)getInt(); - } - - virtual bool getBool() const _IRR_OVERRIDE_ - { - return (getInt() != 0); // does not make a lot of sense, I know - } - - virtual core::stringc getString() const _IRR_OVERRIDE_ - { - return Value; - } - - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - return core::stringw(Value.c_str()); - } - - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ - { - if (intValue>=0 && intValue<(s32)EnumLiterals.size()) - Value = EnumLiterals[intValue]; - else - Value = ""; - } - - virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_ - { - setInt((s32)floatValue); - }; - - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - Value = text; - } - - virtual const char* getEnum() const _IRR_OVERRIDE_ - { - return Value.c_str(); - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_ENUM; - } - - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"enum"; - } - - core::stringc Value; - core::array EnumLiterals; -}; - - - - - -// Attribute implemented for strings -class CStringAttribute : public IAttribute -{ -public: - - CStringAttribute(const char* name, const char* value) - { - IsStringW=false; - Name = name; - setString(value); - } - - CStringAttribute(const char* name, const wchar_t* value) - { - IsStringW = true; - Name = name; - setString(value); - } - - CStringAttribute(const char* name, void* binaryData, s32 lengthInBytes) - { - IsStringW=false; - Name = name; - setBinary(binaryData, lengthInBytes); - } - - virtual s32 getInt() const _IRR_OVERRIDE_ - { - if (IsStringW) - return atoi(core::stringc(ValueW.c_str()).c_str()); - else - return atoi(Value.c_str()); - } - - virtual f32 getFloat() const _IRR_OVERRIDE_ - { - if (IsStringW) - return core::fast_atof(core::stringc(ValueW.c_str()).c_str()); - else - return core::fast_atof(Value.c_str()); - } - - virtual bool getBool() const _IRR_OVERRIDE_ - { - if (IsStringW) - return ValueW.equals_ignore_case(L"true"); - else - return Value.equals_ignore_case("true"); - } - - virtual core::stringc getString() const _IRR_OVERRIDE_ - { - if (IsStringW) - return core::stringc(ValueW.c_str()); - else - return Value; - } - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - if (IsStringW) - return ValueW; - else - return core::stringw(Value.c_str()); - } - - virtual void setInt(s32 intValue) _IRR_OVERRIDE_ - { - if (IsStringW) - ValueW = core::stringw(intValue); - else - Value = core::stringc(intValue); - } - - virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_ - { - if (IsStringW) - { - ValueW = core::stringw((double)floatValue); - } - else - { - Value = core::stringc((double)floatValue); - } - }; - - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - if (IsStringW) - ValueW = core::stringw(text); - else - Value = text; - } - - virtual void setString(const wchar_t* text) _IRR_OVERRIDE_ - { - if (IsStringW) - ValueW = text; - else - Value = core::stringc(text); - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_STRING; - } - - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"string"; - } - - virtual void getBinary(void* outdata, s32 maxLength) const _IRR_OVERRIDE_ - { - const s32 dataSize = maxLength; - c8* datac8 = (c8*)(outdata); - s32 p = 0; - const c8* dataString = Value.c_str(); - - for (s32 i=0; i= '0' && h <='9') - return h-'0'; - - if (h >= 'a' && h <='f') - return h-'a' + 10; - - return 0; - } - - static inline void getHexStrFromByte(c8 byte, c8* out) - { - s32 b = (byte & 0xf0) >> 4; - - for (s32 i=0; i<2; ++i) - { - if (b >=0 && b <= 9) - out[i] = b+'0'; - if (b >=10 && b <= 15) - out[i] = (b-10)+'a'; - - b = byte & 0x0f; - } - } -}; - -// Attribute implemented for binary data -class CBinaryAttribute : public CStringAttribute -{ -public: - - CBinaryAttribute(const char* name, void* binaryData, s32 lengthInBytes) - : CStringAttribute(name, binaryData, lengthInBytes) - { - - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_BINARY; - } - - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"binary"; - } -}; - - - -// Attribute implemented for texture references -class CTextureAttribute : public IAttribute -{ -public: - - CTextureAttribute(const char* name, video::ITexture* value, video::IVideoDriver* driver, const io::path& filename) - : Value(0), Driver(driver), OverrideName(filename) - { - if (Driver) - Driver->grab(); - - Name = name; - setTexture(value); - } - - virtual ~CTextureAttribute() - { - if (Driver) - Driver->drop(); - - if (Value) - Value->drop(); - } - - virtual video::ITexture* getTexture() const _IRR_OVERRIDE_ - { - return Value; - } - - virtual bool getBool() const _IRR_OVERRIDE_ - { - return (Value != 0); - } - - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - // (note: don't try to put all this in some ?: operators, or c++ builder will choke) - if ( OverrideName.size() ) - return core::stringw(OverrideName); - - if ( Value ) - return core::stringw(Value->getName().getPath().c_str()); - - return core::stringw(); - } - - virtual core::stringc getString() const _IRR_OVERRIDE_ - { - // since texture names can be stringw we are careful with the types - if ( OverrideName.size() ) - return core::stringc(OverrideName); - - if ( Value ) - return core::stringc(Value->getName().getPath().c_str()); - - return core::stringc(); - } - - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - if (Driver) - { - if (text && *text) - { - setTexture(Driver->getTexture(text)); - OverrideName=text; - } - else - setTexture(0); - } - } - - virtual void setTexture(video::ITexture* texture, const path& filename) _IRR_OVERRIDE_ - { - OverrideName = filename; - setTexture(texture); - }; - - void setTexture(video::ITexture* value) - { - if ( value == Value ) - return; - - if (Value) - Value->drop(); - - Value = value; - - if (Value) - Value->grab(); - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_TEXTURE; - } - - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"texture"; - } - - video::ITexture* Value; - video::IVideoDriver* Driver; - io::path OverrideName; -}; - - - -// Attribute implemented for array of stringw -class CStringWArrayAttribute : public IAttribute -{ -public: - - CStringWArrayAttribute(const char* name, const core::array& value) - { - Name = name; - setArray(value); - } - - virtual core::array getArray() const _IRR_OVERRIDE_ - { - return Value; - } - - virtual void setArray(const core::array& value) _IRR_OVERRIDE_ - { - Value = value; - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_STRINGWARRAY; - } - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"stringwarray"; - } - - core::array Value; -}; - - -// Attribute implemented for user pointers -class CUserPointerAttribute : public IAttribute -{ -public: - - CUserPointerAttribute(const char* name, void* value) - { - Name = name; - Value = value; - } - - virtual s32 getInt() const _IRR_OVERRIDE_ - { - return *static_cast(Value); - } - - virtual bool getBool() const _IRR_OVERRIDE_ - { - return (Value != 0); - } - - virtual core::stringw getStringW() const _IRR_OVERRIDE_ - { - wchar_t buf[32]; - swprintf_irr(buf, 32, L"%p", Value); - - return core::stringw(buf); - } - - virtual void setString(const char* text) _IRR_OVERRIDE_ - { - size_t val = 0; - switch ( sizeof(void*) ) - { - case 4: - { - unsigned int tmp; // not using an irrlicht type - sscanf with %x needs always unsigned int - sscanf(text, "%x", &tmp); - val = (size_t)tmp; - } - break; - case 8: - { -#ifdef _MSC_VER - const unsigned __int64 tmp = _strtoui64(text, NULL, 16); -#else - const unsigned long long tmp = strtoull(text, NULL, 16); -#endif - val = (size_t)tmp; - } - break; - } - Value = (void *)val; - } - - virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_ - { - return EAT_USER_POINTER; - } - - virtual void setUserPointer(void* v) _IRR_OVERRIDE_ - { - Value = v; - } - - virtual void* getUserPointer() const _IRR_OVERRIDE_ - { - return Value; - } - - - virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_ - { - return L"userPointer"; - } - - void* Value; -}; - - - -// todo: CGUIFontAttribute - } // end namespace io } // end namespace irr diff --git a/source/Irrlicht/CAttributes.cpp b/source/Irrlicht/CAttributes.cpp index e044b6db..a4bc0433 100644 --- a/source/Irrlicht/CAttributes.cpp +++ b/source/Irrlicht/CAttributes.cpp @@ -41,189 +41,6 @@ void CAttributes::clear() Attributes.clear(); } - -//! Sets a string attribute. -//! \param attributeName: Name for the attribute -//! \param value: Value for the attribute. Set this to 0 to delete the attribute -void CAttributes::setAttribute(const c8* attributeName, const c8* value) -{ - for (u32 i=0; iName == attributeName) - { - if (!value) - { - Attributes[i]->drop(); - Attributes.erase(i); - } - else - Attributes[i]->setString(value); - - return; - } - - if (value) - { - Attributes.push_back(new CStringAttribute(attributeName, value)); - } -} - -//! Gets a string attribute. -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setStringAttribute() -//! or 0 if attribute is not set. -core::stringc CAttributes::getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getString(); - else - return defaultNotFound; -} - -//! Gets a string attribute. -//! \param attributeName: Name of the attribute to get. -//! \param target: Buffer where the string is copied to. -void CAttributes::getAttributeAsString(const c8* attributeName, char* target) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - { - core::stringc str = att->getString(); - strcpy(target,str.c_str()); - } - else - target[0] = 0; -} - -//! Returns string attribute value by index. -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -core::stringc CAttributes::getAttributeAsString(s32 index) const -{ - core::stringc str; - - if ((u32)index < Attributes.size()) - return Attributes[index]->getString(); - - return str; -} - - -//! Sets a string attribute. -//! \param attributeName: Name for the attribute -//! \param value: Value for the attribute. Set this to 0 to delete the attribute -void CAttributes::setAttribute(const c8* attributeName, const wchar_t* value) -{ - for (u32 i=0; iName == attributeName) - { - if (!value) - { - Attributes[i]->drop(); - Attributes.erase(i); - } - else - Attributes[i]->setString(value); - - return; - } - } - - if (value) - { - Attributes.push_back(new CStringAttribute(attributeName, value)); - } -} - -//! Gets a string attribute. -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setStringAttribute() -//! or 0 if attribute is not set. -core::stringw CAttributes::getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getStringW(); - else - return defaultNotFound; -} - -//! Gets a string attribute. -//! \param attributeName: Name of the attribute to get. -//! \param target: Buffer where the string is copied to. -void CAttributes::getAttributeAsStringW(const c8* attributeName, wchar_t* target) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - { - core::stringw str = att->getStringW(); - wcscpy(target,str.c_str()); - } - else - target[0] = 0; -} - -//! Returns string attribute value by index. -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -core::stringw CAttributes::getAttributeAsStringW(s32 index) const -{ - - if ((u32)index < Attributes.size()) - return Attributes[index]->getStringW(); - else - return core::stringw(); -} - - -//! Adds an attribute as an array of wide strings -void CAttributes::addArray(const c8* attributeName, const core::array& value) -{ - Attributes.push_back(new CStringWArrayAttribute(attributeName, value)); -} - -//! Sets an attribute value as an array of wide strings. -void CAttributes::setAttribute(const c8* attributeName, const core::array& value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setArray(value); - else - { - Attributes.push_back(new CStringWArrayAttribute(attributeName, value)); - } -} - -//! Gets an attribute as an array of wide strings. -core::array CAttributes::getAttributeAsArray(const c8* attributeName, const core::array& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getArray(); - else - return defaultNotFound; -} - -//! Returns attribute value as an array of wide strings by index. -core::array CAttributes::getAttributeAsArray(s32 index) const -{ - core::array ret; - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getArray(); - - return ret; -} - -//! Sets an attribute as an array of wide strings -void CAttributes::setAttribute(s32 index, const core::array& value) -{ - if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setArray(value); -} - - - - //! Returns attribute index from name, -1 if not found s32 CAttributes::findAttribute(const c8* attributeName) const { @@ -244,7 +61,6 @@ IAttribute* CAttributes::getAttributeP(const c8* attributeName) const return 0; } - //! Sets a attribute as boolean value void CAttributes::setAttribute(const c8* attributeName, bool value) { @@ -318,261 +134,6 @@ f32 CAttributes::getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNo return defaultNotFound; } -//! Sets a attribute as color -void CAttributes::setAttribute(const c8* attributeName, video::SColor value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setColor(value); - else - Attributes.push_back(new CColorAttribute(attributeName, value)); -} - -//! Gets an attribute as color -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -video::SColor CAttributes::getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getColor(); - else - return defaultNotFound; -} - -//! Sets a attribute as floating point color -void CAttributes::setAttribute(const c8* attributeName, video::SColorf value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setColor(value); - else - Attributes.push_back(new CColorfAttribute(attributeName, value)); -} - -//! Gets an attribute as floating point color -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -video::SColorf CAttributes::getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getColorf(); - else - return defaultNotFound; -} - -//! Sets a attribute as 2d position -void CAttributes::setAttribute(const c8* attributeName, const core::position2di& value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setPosition(value); - else - Attributes.push_back(new CPosition2DAttribute(attributeName, value)); -} - -//! Gets an attribute as 2d position -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -core::position2di CAttributes::getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getPosition(); - else - return defaultNotFound; -} - -//! Sets a attribute as rectangle -void CAttributes::setAttribute(const c8* attributeName, const core::rect& value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setRect(value); - else - Attributes.push_back(new CRectAttribute(attributeName, value)); -} - -//! Gets an attribute as rectangle -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -core::rect CAttributes::getAttributeAsRect(const c8* attributeName, const core::rect& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getRect(); - else - return defaultNotFound; -} - -//! Sets a attribute as dimension2d -void CAttributes::setAttribute(const c8* attributeName, const core::dimension2d& value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setDimension2d(value); - else - Attributes.push_back(new CDimension2dAttribute(attributeName, value)); -} - -//! Gets an attribute as dimension2d -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -core::dimension2d CAttributes::getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getDimension2d(); - else - return defaultNotFound; -} - -//! Sets a attribute as vector -void CAttributes::setAttribute(const c8* attributeName, const core::vector3df& value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setVector(value); - else - Attributes.push_back(new CVector3DAttribute(attributeName, value)); -} - -//! Sets a attribute as vector -void CAttributes::setAttribute(const c8* attributeName, const core::vector2df& value) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setVector2d(value); - else - Attributes.push_back(new CVector2DAttribute(attributeName, value)); -} - -//! Gets an attribute as vector -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -core::vector3df CAttributes::getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getVector(); - else - return defaultNotFound; -} - -//! Gets an attribute as vector -core::vector2df CAttributes::getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getVector2d(); - else - return defaultNotFound; -} - -//! Sets an attribute as binary data -void CAttributes::setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setBinary(data, dataSizeInBytes); - else - Attributes.push_back(new CBinaryAttribute(attributeName, data, dataSizeInBytes)); -} - -//! Gets an attribute as binary data -//! \param attributeName: Name of the attribute to get. -void CAttributes::getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - att->getBinary(outData, maxSizeInBytes); -} - -//! Sets an attribute as enumeration -void CAttributes::setAttribute(const c8* attributeName, const char* enumValue, const char* const* enumerationLiterals) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setEnum(enumValue, enumerationLiterals); - else - Attributes.push_back(new CEnumAttribute(attributeName, enumValue, enumerationLiterals)); -} - -//! Gets an attribute as enumeration -//! \param attributeName: Name of the attribute to get. -//! \return Returns value of the attribute previously set by setAttribute() -const char* CAttributes::getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getEnum(); - else - return defaultNotFound; -} - -//! Gets an attribute as enumeration -s32 CAttributes::getAttributeAsEnumeration(const c8* attributeName, const char* const* enumerationLiteralsToUse, s32 defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - - if (enumerationLiteralsToUse && att) - { - const char* value = att->getEnum(); - if (value) - { - for (s32 i=0; enumerationLiteralsToUse[i]; ++i) - if (!strcmp(value, enumerationLiteralsToUse[i])) - return i; - } - } - - return defaultNotFound; -} - -//! Gets the list of enumeration literals of an enumeration attribute -//! \param attributeName: Name of the attribute to get. -void CAttributes::getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array& outLiterals) const -{ - const IAttribute* att = getAttributeP(attributeName); - - if (att && att->getType() == EAT_ENUM) - outLiterals = ((CEnumAttribute*)att)->EnumLiterals; -} - -//! Sets an attribute as texture reference -void CAttributes::setAttribute(const c8* attributeName, video::ITexture* value, const io::path& filename) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setTexture(value, filename); - else - Attributes.push_back(new CTextureAttribute(attributeName, value, Driver, filename)); -} - - -//! Gets an attribute as texture reference -//! \param attributeName: Name of the attribute to get. -video::ITexture* CAttributes::getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getTexture(); - else - return defaultNotFound; -} - -//! Gets an attribute as texture reference -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -video::ITexture* CAttributes::getAttributeAsTexture(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getTexture(); - else - return 0; -} - - //! Returns amount of string attributes set in this scene manager. u32 CAttributes::getAttributeCount() const { @@ -631,18 +192,6 @@ const wchar_t* CAttributes::getAttributeTypeString(s32 index, const wchar_t* def return Attributes[index]->getTypeString(); } -//! Gets an attribute as boolean value -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -bool CAttributes::getAttributeAsBool(s32 index) const -{ - bool ret = false; - - if ((u32)index < Attributes.size()) - ret = Attributes[index]->getBool(); - - return ret; -} - //! Gets an attribute as integer value //! \param index: Index value, must be between 0 and getAttributeCount()-1. s32 CAttributes::getAttributeAsInt(s32 index) const @@ -663,131 +212,18 @@ f32 CAttributes::getAttributeAsFloat(s32 index) const return 0.f; } -//! Gets an attribute as color +//! Gets an attribute as boolean value //! \param index: Index value, must be between 0 and getAttributeCount()-1. -video::SColor CAttributes::getAttributeAsColor(s32 index) const +bool CAttributes::getAttributeAsBool(s32 index) const { - video::SColor ret(0); + bool ret = false; if ((u32)index < Attributes.size()) - ret = Attributes[index]->getColor(); + ret = Attributes[index]->getBool(); return ret; } -//! Gets an attribute as floating point color -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -video::SColorf CAttributes::getAttributeAsColorf(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getColorf(); - - return video::SColorf(); -} - -//! Gets an attribute as 3d vector -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -core::vector3df CAttributes::getAttributeAsVector3d(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getVector(); - else - return core::vector3df(); -} - -//! Gets an attribute as 2d vector -core::vector2df CAttributes::getAttributeAsVector2d(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getVector2d(); - else - return core::vector2df(); -} - -//! Gets an attribute as position2d -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -core::position2di CAttributes::getAttributeAsPosition2d(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getPosition(); - else - return core::position2di(); -} - -//! Gets an attribute as rectangle -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -core::rect CAttributes::getAttributeAsRect(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getRect(); - else - return core::rect(); -} - -//! Gets an attribute as dimension2d -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -core::dimension2d CAttributes::getAttributeAsDimension2d(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getDimension2d(); - else - return core::dimension2d(); -} - - -//! Gets an attribute as binary data -///! \param index: Index value, must be between 0 and getAttributeCount()-1. -void CAttributes::getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const -{ - if ((u32)index < Attributes.size()) - Attributes[index]->getBinary(outData, maxSizeInBytes); -} - - -//! Gets an attribute as enumeration -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -const char* CAttributes::getAttributeAsEnumeration(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getEnum(); - else - return 0; -} - - -//! Gets an attribute as enumeration -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -s32 CAttributes::getAttributeAsEnumeration(s32 index, const char* const* enumerationLiteralsToUse, s32 defaultNotFound) const -{ - if ((u32)index < Attributes.size()) - { - const IAttribute* att = Attributes[index]; - - if (enumerationLiteralsToUse && att) - { - const char* value = att->getEnum(); - if (value) - { - for (s32 i=0; enumerationLiteralsToUse[i]; ++i) - if (!strcmp(value, enumerationLiteralsToUse[i])) - return i; - } - } - } - - return defaultNotFound; -} - -//! Gets the list of enumeration literals of an enumeration attribute -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -void CAttributes::getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array& outLiterals) const -{ - if ((u32)index < Attributes.size() && - Attributes[index]->getType() == EAT_ENUM) - outLiterals = ((CEnumAttribute*)Attributes[index])->EnumLiterals; -} - - //! Adds an attribute as integer void CAttributes::addInt(const c8* attributeName, s32 value) { @@ -800,114 +236,18 @@ void CAttributes::addFloat(const c8* attributeName, f32 value) Attributes.push_back(new CFloatAttribute(attributeName, value)); } -//! Adds an attribute as string -void CAttributes::addString(const c8* attributeName, const char* value) -{ - Attributes.push_back(new CStringAttribute(attributeName, value)); -} - -//! Adds an attribute as wchar string -void CAttributes::addString(const c8* attributeName, const wchar_t* value) -{ - Attributes.push_back(new CStringAttribute(attributeName, value)); -} - //! Adds an attribute as bool void CAttributes::addBool(const c8* attributeName, bool value) { Attributes.push_back(new CBoolAttribute(attributeName, value)); } -//! Adds an attribute as enum -void CAttributes::addEnum(const c8* attributeName, const char* enumValue, const char* const* enumerationLiterals) -{ - Attributes.push_back(new CEnumAttribute(attributeName, enumValue, enumerationLiterals)); -} - -//! Adds an attribute as enum -void CAttributes::addEnum(const c8* attributeName, s32 enumValue, const char* const* enumerationLiterals) -{ - addEnum(attributeName, "", enumerationLiterals); - Attributes.getLast()->setInt(enumValue); -} - -//! Adds an attribute as color -void CAttributes::addColor(const c8* attributeName, video::SColor value) -{ - Attributes.push_back(new CColorAttribute(attributeName, value)); -} - -//! Adds an attribute as floating point color -void CAttributes::addColorf(const c8* attributeName, video::SColorf value) -{ - Attributes.push_back(new CColorfAttribute(attributeName, value)); -} - -//! Adds an attribute as 3d vector -void CAttributes::addVector3d(const c8* attributeName, const core::vector3df& value) -{ - Attributes.push_back(new CVector3DAttribute(attributeName, value)); -} - -//! Adds an attribute as 2d vector -void CAttributes::addVector2d(const c8* attributeName, const core::vector2df& value) -{ - Attributes.push_back(new CVector2DAttribute(attributeName, value)); -} - - -//! Adds an attribute as 2d position -void CAttributes::addPosition2d(const c8* attributeName, const core::position2di& value) -{ - Attributes.push_back(new CPosition2DAttribute(attributeName, value)); -} - -//! Adds an attribute as rectangle -void CAttributes::addRect(const c8* attributeName, const core::rect& value) -{ - Attributes.push_back(new CRectAttribute(attributeName, value)); -} - -//! Adds an attribute as dimension2d -void CAttributes::addDimension2d(const c8* attributeName, const core::dimension2d& value) -{ - Attributes.push_back(new CDimension2dAttribute(attributeName, value)); -} - -//! Adds an attribute as binary data -void CAttributes::addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) -{ - Attributes.push_back(new CBinaryAttribute(attributeName, data, dataSizeInBytes)); -} - -//! Adds an attribute as texture reference -void CAttributes::addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename) -{ - Attributes.push_back(new CTextureAttribute(attributeName, texture, Driver, filename)); -} - //! Returns if an attribute with a name exists bool CAttributes::existsAttribute(const c8* attributeName) const { return getAttributeP(attributeName) != 0; } -//! Sets an attribute value as string. -//! \param attributeName: Name for the attribute -void CAttributes::setAttribute(s32 index, const c8* value) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setString(value); -} - -//! Sets an attribute value as string. -//! \param attributeName: Name for the attribute -void CAttributes::setAttribute(s32 index, const wchar_t* value) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setString(value); -} - //! Sets an attribute as boolean value void CAttributes::setAttribute(s32 index, bool value) { @@ -929,453 +269,6 @@ void CAttributes::setAttribute(s32 index, f32 value) Attributes[index]->setFloat(value); } -//! Sets a attribute as color -void CAttributes::setAttribute(s32 index, video::SColor color) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setColor(color); -} - -//! Sets a attribute as floating point color -void CAttributes::setAttribute(s32 index, video::SColorf color) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setColor(color); -} - -//! Sets a attribute as vector -void CAttributes::setAttribute(s32 index, const core::vector3df& v) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setVector(v); -} - -//! Sets a attribute as vector -void CAttributes::setAttribute(s32 index, const core::vector2df& v) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setVector2d(v); -} - -//! Sets a attribute as position -void CAttributes::setAttribute(s32 index, const core::position2di& v) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setPosition(v); -} - -//! Sets a attribute as rectangle -void CAttributes::setAttribute(s32 index, const core::rect& v) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setRect(v); -} - -//! Sets a attribute as dimension2d -void CAttributes::setAttribute(s32 index, const core::dimension2d& v) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setDimension2d(v); -} - -//! Sets an attribute as binary data -void CAttributes::setAttribute(s32 index, void* data, s32 dataSizeInBytes ) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setBinary(data, dataSizeInBytes); -} - - -//! Sets an attribute as enumeration -void CAttributes::setAttribute(s32 index, const char* enumValue, const char* const* enumerationLiterals) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setEnum(enumValue, enumerationLiterals); -} - - -//! Sets an attribute as texture reference -void CAttributes::setAttribute(s32 index, video::ITexture* texture, const io::path& filename) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setTexture(texture, filename); -} - - -//! Adds an attribute as matrix -void CAttributes::addMatrix(const c8* attributeName, const core::matrix4& v) -{ - Attributes.push_back(new CMatrixAttribute(attributeName, v)); -} - - -//! Sets an attribute as matrix -void CAttributes::setAttribute(const c8* attributeName, const core::matrix4& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setMatrix(v); - else - Attributes.push_back(new CMatrixAttribute(attributeName, v)); -} - -//! Gets an attribute as a matrix4 -core::matrix4 CAttributes::getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getMatrix(); - else - return defaultNotFound; - -} - -//! Gets an attribute as matrix -core::matrix4 CAttributes::getAttributeAsMatrix(s32 index) const -{ - if ((u32)index < Attributes.size()) - return Attributes[index]->getMatrix(); - else - return core::matrix4(); -} - -//! Sets an attribute as matrix -void CAttributes::setAttribute(s32 index, const core::matrix4& v) -{ - if ((u32)index < Attributes.size()) - Attributes[index]->setMatrix(v); -} - - -//! Adds an attribute as quaternion -void CAttributes::addQuaternion(const c8* attributeName, const core::quaternion& v) -{ - Attributes.push_back(new CQuaternionAttribute(attributeName, v)); -} - - -//! Sets an attribute as quaternion -void CAttributes::setAttribute(const c8* attributeName, const core::quaternion& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setQuaternion(v); - else - { - Attributes.push_back(new CQuaternionAttribute(attributeName, v)); - } -} - -//! Gets an attribute as a quaternion -core::quaternion CAttributes::getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getQuaternion(); - else - return defaultNotFound; -} - -//! Gets an attribute as quaternion -core::quaternion CAttributes::getAttributeAsQuaternion(s32 index) const -{ - core::quaternion ret(0,1,0, 0); - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getQuaternion(); - - return ret; -} - -//! Sets an attribute as quaternion -void CAttributes::setAttribute(s32 index, const core::quaternion& v) -{ -if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setQuaternion(v); -} - -//! Adds an attribute as axis aligned bounding box -void CAttributes::addBox3d(const c8* attributeName, const core::aabbox3df& v) -{ - Attributes.push_back(new CBBoxAttribute(attributeName, v)); -} - -//! Sets an attribute as axis aligned bounding box -void CAttributes::setAttribute(const c8* attributeName, const core::aabbox3df& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setBBox(v); - else - { - Attributes.push_back(new CBBoxAttribute(attributeName, v)); - } -} - -//! Gets an attribute as a axis aligned bounding box -core::aabbox3df CAttributes::getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getBBox(); - else - return defaultNotFound; -} - -//! Gets an attribute as axis aligned bounding box -core::aabbox3df CAttributes::getAttributeAsBox3d(s32 index) const -{ - core::aabbox3df ret(0,0,0, 0,0,0); - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getBBox(); - - return ret; -} - -//! Sets an attribute as axis aligned bounding box -void CAttributes::setAttribute(s32 index, const core::aabbox3df& v) -{ -if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setBBox(v); -} - -//! Adds an attribute as 3d plane -void CAttributes::addPlane3d(const c8* attributeName, const core::plane3df& v) -{ - Attributes.push_back(new CPlaneAttribute(attributeName, v)); -} - -//! Sets an attribute as 3d plane -void CAttributes::setAttribute(const c8* attributeName, const core::plane3df& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setPlane(v); - else - { - Attributes.push_back(new CPlaneAttribute(attributeName, v)); - } -} - -//! Gets an attribute as a 3d plane -core::plane3df CAttributes::getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getPlane(); - else - return defaultNotFound; -} - -//! Gets an attribute as 3d plane -core::plane3df CAttributes::getAttributeAsPlane3d(s32 index) const -{ - core::plane3df ret(0,0,0, 0,1,0); - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getPlane(); - - return ret; -} - -//! Sets an attribute as 3d plane -void CAttributes::setAttribute(s32 index, const core::plane3df& v) -{ - if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setPlane(v); -} - -//! Adds an attribute as 3d triangle -void CAttributes::addTriangle3d(const c8* attributeName, const core::triangle3df& v) -{ - Attributes.push_back(new CTriangleAttribute(attributeName, v)); -} - -//! Sets an attribute as 3d triangle -void CAttributes::setAttribute(const c8* attributeName, const core::triangle3df& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setTriangle(v); - else - { - Attributes.push_back(new CTriangleAttribute(attributeName, v)); - } -} - -//! Gets an attribute as a 3d triangle -core::triangle3df CAttributes::getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getTriangle(); - else - return defaultNotFound; -} - -//! Gets an attribute as 3d triangle -core::triangle3df CAttributes::getAttributeAsTriangle3d(s32 index) const -{ - core::triangle3df ret; - ret.pointA = ret.pointB = ret.pointC = core::vector3df(0,0,0); - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getTriangle(); - - return ret; -} - -//! Sets an attribute as 3d triangle -void CAttributes::setAttribute(s32 index, const core::triangle3df& v) -{ - if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setTriangle(v); -} - -//! Adds an attribute as a 2d line -void CAttributes::addLine2d(const c8* attributeName, const core::line2df& v) -{ - Attributes.push_back(new CLine2dAttribute(attributeName, v)); -} - -//! Sets an attribute as a 2d line -void CAttributes::setAttribute(const c8* attributeName, const core::line2df& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setLine2d(v); - else - { - Attributes.push_back(new CLine2dAttribute(attributeName, v)); - } -} - -//! Gets an attribute as a 2d line -core::line2df CAttributes::getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getLine2d(); - else - return defaultNotFound; -} - -//! Gets an attribute as a 2d line -core::line2df CAttributes::getAttributeAsLine2d(s32 index) const -{ - core::line2df ret(0,0, 0,0); - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getLine2d(); - - return ret; -} - -//! Sets an attribute as a 2d line -void CAttributes::setAttribute(s32 index, const core::line2df& v) -{ - if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setLine2d(v); -} - -//! Adds an attribute as a 3d line -void CAttributes::addLine3d(const c8* attributeName, const core::line3df& v) -{ - Attributes.push_back(new CLine3dAttribute(attributeName, v)); -} - -//! Sets an attribute as a 3d line -void CAttributes::setAttribute(const c8* attributeName, const core::line3df& v) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setLine3d(v); - else - { - Attributes.push_back(new CLine3dAttribute(attributeName, v)); - } -} - -//! Gets an attribute as a 3d line -core::line3df CAttributes::getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getLine3d(); - else - return defaultNotFound; -} - -//! Gets an attribute as a 3d line -core::line3df CAttributes::getAttributeAsLine3d(s32 index) const -{ - core::line3df ret(0,0,0, 0,0,0); - - if (index >= 0 && index < (s32)Attributes.size()) - ret = Attributes[index]->getLine3d(); - - return ret; -} - -//! Sets an attribute as a 3d line -void CAttributes::setAttribute(s32 index, const core::line3df& v) -{ - if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setLine3d(v); - -} - - -//! Adds an attribute as user pointer -void CAttributes::addUserPointer(const c8* attributeName, void* userPointer) -{ - Attributes.push_back(new CUserPointerAttribute(attributeName, userPointer)); -} - -//! Sets an attribute as user pointer -void CAttributes::setAttribute(const c8* attributeName, void* userPointer) -{ - IAttribute* att = getAttributeP(attributeName); - if (att) - att->setUserPointer(userPointer); - else - { - Attributes.push_back(new CUserPointerAttribute(attributeName, userPointer)); - } -} - -//! Gets an attribute as user pointer -//! \param attributeName: Name of the attribute to get. -void* CAttributes::getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound) const -{ - const IAttribute* att = getAttributeP(attributeName); - if (att) - return att->getUserPointer(); - else - return defaultNotFound; -} - -//! Gets an attribute as user pointer -//! \param index: Index value, must be between 0 and getAttributeCount()-1. -void* CAttributes::getAttributeAsUserPointer(s32 index) const -{ - void* value = 0; - - if (index >= 0 && index < (s32)Attributes.size()) - value = Attributes[index]->getUserPointer(); - - return value; -} - -//! Sets an attribute as user pointer -void CAttributes::setAttribute(s32 index, void* userPointer) -{ - if (index >= 0 && index < (s32)Attributes.size() ) - Attributes[index]->setUserPointer(userPointer); -} - - } // end namespace io } // end namespace irr diff --git a/source/Irrlicht/CAttributes.h b/source/Irrlicht/CAttributes.h index 169fe950..966d31cb 100644 --- a/source/Irrlicht/CAttributes.h +++ b/source/Irrlicht/CAttributes.h @@ -113,126 +113,9 @@ public: //! Sets an attribute as float value virtual void setAttribute(s32 index, f32 value) _IRR_OVERRIDE_; - /* - - String Attribute - - */ - - //! Adds an attribute as string - virtual void addString(const c8* attributeName, const c8* value) _IRR_OVERRIDE_; - - //! Sets an attribute value as string. - //! \param attributeName: Name for the attribute - //! \param value: Value for the attribute. Set this to 0 to delete the attribute - virtual void setAttribute(const c8* attributeName, const c8* value) _IRR_OVERRIDE_; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - //! or defaultNotFound if attribute is not set. - virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) const _IRR_OVERRIDE_; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param target: Buffer where the string is copied to. - virtual void getAttributeAsString(const c8* attributeName, c8* target) const _IRR_OVERRIDE_; - - //! Returns attribute value as string by index. - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::stringc getAttributeAsString(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute value as string. - //! \param attributeName: Name for the attribute - virtual void setAttribute(s32 index, const c8* value) _IRR_OVERRIDE_; - - // wide strings - - //! Adds an attribute as string - virtual void addString(const c8* attributeName, const wchar_t* value) _IRR_OVERRIDE_; - - //! Sets an attribute value as string. - //! \param attributeName: Name for the attribute - //! \param value: Value for the attribute. Set this to 0 to delete the attribute - virtual void setAttribute(const c8* attributeName, const wchar_t* value) _IRR_OVERRIDE_; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - //! or defaultNotFound if attribute is not set. - virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) const _IRR_OVERRIDE_; - - //! Gets an attribute as string. - //! \param attributeName: Name of the attribute to get. - //! \param target: Buffer where the string is copied to. - virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) const _IRR_OVERRIDE_; - - //! Returns attribute value as string by index. - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::stringw getAttributeAsStringW(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute value as string. - //! \param attributeName: Name for the attribute - virtual void setAttribute(s32 index, const wchar_t* value) _IRR_OVERRIDE_; /* - - Binary Data Attribute - - */ - - //! Adds an attribute as binary data - virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_; - - //! Sets an attribute as binary data - virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_; - - //! Gets an attribute as binary data - //! \param attributeName: Name of the attribute to get. - virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const _IRR_OVERRIDE_; - - //! Gets an attribute as binary data - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const _IRR_OVERRIDE_; - - //! Sets an attribute as binary data - virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_; - - - /* - - Array Attribute - - */ - - //! Adds an attribute as wide string array - virtual void addArray(const c8* attributeName, const core::array& value) _IRR_OVERRIDE_; - - //! Sets an attribute value as a wide string array. - //! \param attributeName: Name for the attribute - //! \param value: Value for the attribute. Set this to 0 to delete the attribute - virtual void setAttribute(const c8* attributeName, const core::array& value) _IRR_OVERRIDE_; - - //! Gets an attribute as an array of wide strings. - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - //! or defaultNotFound if attribute is not set. - virtual core::array getAttributeAsArray(const c8* attributeName, const core::array& defaultNotFound = core::array()) const _IRR_OVERRIDE_; - - //! Returns attribute value as an array of wide strings by index. - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::array getAttributeAsArray(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as an array of wide strings - virtual void setAttribute(s32 index, const core::array& value) _IRR_OVERRIDE_; - - /* - Bool Attribute - */ //! Adds an attribute as bool @@ -254,463 +137,6 @@ public: //! Sets an attribute as boolean value virtual void setAttribute(s32 index, bool value) _IRR_OVERRIDE_; - /* - - Enumeration Attribute - - */ - - //! Adds an attribute as enum - virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_; - - //! Adds an attribute as enum - virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_; - - //! Sets an attribute as enumeration - virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_; - - //! Gets an attribute as enumeration - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) const _IRR_OVERRIDE_; - - //! Gets an attribute as enumeration - //! \param attributeName: Name of the attribute to get. - //! \param enumerationLiteralsToUse: Use these enumeration literals to get the index value instead of the set ones. - //! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but - //! no information about its index. - //! \return Returns value of the attribute previously set by setAttribute() - virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound ) const _IRR_OVERRIDE_; - - //! Gets an attribute as enumeration - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound) const _IRR_OVERRIDE_; - - //! Gets an attribute as enumeration - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual const c8* getAttributeAsEnumeration(s32 index) const _IRR_OVERRIDE_; - - //! Gets the list of enumeration literals of an enumeration attribute - //! \param attributeName: Name of the attribute to get. - virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array& outLiterals) const _IRR_OVERRIDE_; - - //! Gets the list of enumeration literals of an enumeration attribute - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array& outLiterals) const _IRR_OVERRIDE_; - - //! Sets an attribute as enumeration - virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_; - - - /* - - SColor Attribute - - */ - - //! Adds an attribute as color - virtual void addColor(const c8* attributeName, video::SColor value) _IRR_OVERRIDE_; - - //! Sets a attribute as color - virtual void setAttribute(const c8* attributeName, video::SColor color) _IRR_OVERRIDE_; - - //! Gets an attribute as color - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as color - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual video::SColor getAttributeAsColor(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as color - virtual void setAttribute(s32 index, video::SColor color) _IRR_OVERRIDE_; - - /* - - SColorf Attribute - - */ - - //! Adds an attribute as floating point color - virtual void addColorf(const c8* attributeName, video::SColorf value) _IRR_OVERRIDE_; - - //! Sets a attribute as floating point color - virtual void setAttribute(const c8* attributeName, video::SColorf color) _IRR_OVERRIDE_; - - //! Gets an attribute as floating point color - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as floating point color - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual video::SColorf getAttributeAsColorf(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as floating point color - virtual void setAttribute(s32 index, video::SColorf color) _IRR_OVERRIDE_; - - - /* - - Vector3d Attribute - - */ - - //! Adds an attribute as 3d vector - virtual void addVector3d(const c8* attributeName, const core::vector3df& value) _IRR_OVERRIDE_; - - //! Sets a attribute as 3d vector - virtual void setAttribute(const c8* attributeName, const core::vector3df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as 3d vector - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as 3d vector - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::vector3df getAttributeAsVector3d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as vector - virtual void setAttribute(s32 index, const core::vector3df& v) _IRR_OVERRIDE_; - - - /* - - Vector2d Attribute - - */ - - //! Adds an attribute as 2d vector - virtual void addVector2d(const c8* attributeName, const core::vector2df& value) _IRR_OVERRIDE_; - - //! Sets a attribute as 2d vector - virtual void setAttribute(const c8* attributeName, const core::vector2df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as 2d vector - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as 3d vector - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::vector2df getAttributeAsVector2d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as vector - virtual void setAttribute(s32 index, const core::vector2df& v) _IRR_OVERRIDE_; - - - /* - - Position2d Attribute - - */ - - //! Adds an attribute as 2d position - virtual void addPosition2d(const c8* attributeName, const core::position2di& value) _IRR_OVERRIDE_; - - //! Sets a attribute as 2d position - virtual void setAttribute(const c8* attributeName, const core::position2di& v) _IRR_OVERRIDE_; - - //! Gets an attribute as position - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as position - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::position2di getAttributeAsPosition2d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as 2d position - virtual void setAttribute(s32 index, const core::position2di& v) _IRR_OVERRIDE_; - - /* - - Rectangle Attribute - - */ - - //! Adds an attribute as rectangle - virtual void addRect(const c8* attributeName, const core::rect& value) _IRR_OVERRIDE_; - - //! Sets an attribute as rectangle - virtual void setAttribute(const c8* attributeName, const core::rect& v) _IRR_OVERRIDE_; - - //! Gets an attribute as rectangle - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::rect getAttributeAsRect(const c8* attributeName, const core::rect& defaultNotFound = core::rect()) const _IRR_OVERRIDE_; - - //! Gets an attribute as rectangle - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::rect getAttributeAsRect(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as rectangle - virtual void setAttribute(s32 index, const core::rect& v) _IRR_OVERRIDE_; - - - /* - - Dimension2d Attribute - - */ - - //! Adds an attribute as dimension2d - virtual void addDimension2d(const c8* attributeName, const core::dimension2d& value) _IRR_OVERRIDE_; - - //! Sets an attribute as dimension2d - virtual void setAttribute(const c8* attributeName, const core::dimension2d& v) _IRR_OVERRIDE_; - - //! Gets an attribute as dimension2d - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::dimension2d getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d& defaultNotFound = core::dimension2d()) const _IRR_OVERRIDE_; - - //! Gets an attribute as dimension2d - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::dimension2d getAttributeAsDimension2d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as dimension2d - virtual void setAttribute(s32 index, const core::dimension2d& v) _IRR_OVERRIDE_; - - - /* - - matrix attribute - - */ - - //! Adds an attribute as matrix - virtual void addMatrix(const c8* attributeName, const core::matrix4& v) _IRR_OVERRIDE_; - - //! Sets an attribute as matrix - virtual void setAttribute(const c8* attributeName, const core::matrix4& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a matrix4 - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) const _IRR_OVERRIDE_; - - //! Gets an attribute as matrix - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::matrix4 getAttributeAsMatrix(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as matrix - virtual void setAttribute(s32 index, const core::matrix4& v) _IRR_OVERRIDE_; - - /* - quaternion attribute - - */ - - //! Adds an attribute as quaternion - virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) _IRR_OVERRIDE_; - - //! Sets an attribute as quaternion - virtual void setAttribute(const c8* attributeName, const core::quaternion& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a quaternion - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as quaternion - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::quaternion getAttributeAsQuaternion(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as quaternion - virtual void setAttribute(s32 index, const core::quaternion& v) _IRR_OVERRIDE_; - - /* - - 3d bounding box - - */ - - //! Adds an attribute as axis aligned bounding box - virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) _IRR_OVERRIDE_; - - //! Sets an attribute as axis aligned bounding box - virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a axis aligned bounding box - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as axis aligned bounding box - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::aabbox3df getAttributeAsBox3d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as axis aligned bounding box - virtual void setAttribute(s32 index, const core::aabbox3df& v) _IRR_OVERRIDE_; - - /* - - plane - - */ - - //! Adds an attribute as 3d plane - virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) _IRR_OVERRIDE_; - - //! Sets an attribute as 3d plane - virtual void setAttribute(const c8* attributeName, const core::plane3df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a 3d plane - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as 3d plane - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::plane3df getAttributeAsPlane3d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as 3d plane - virtual void setAttribute(s32 index, const core::plane3df& v) _IRR_OVERRIDE_; - - - /* - - 3d triangle - - */ - - //! Adds an attribute as 3d triangle - virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) _IRR_OVERRIDE_; - - //! Sets an attribute as 3d triangle - virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a 3d triangle - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound = core::triangle3df(core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(0,0,0))) const _IRR_OVERRIDE_; - - //! Gets an attribute as 3d triangle - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as 3d triangle - virtual void setAttribute(s32 index, const core::triangle3df& v) _IRR_OVERRIDE_; - - - /* - - line 2d - - */ - - //! Adds an attribute as a 2d line - virtual void addLine2d(const c8* attributeName, const core::line2df& v) _IRR_OVERRIDE_; - - //! Sets an attribute as a 2d line - virtual void setAttribute(const c8* attributeName, const core::line2df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a 2d line - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as a 2d line - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::line2df getAttributeAsLine2d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as a 2d line - virtual void setAttribute(s32 index, const core::line2df& v) _IRR_OVERRIDE_; - - - /* - - line 3d - - */ - - //! Adds an attribute as a 3d line - virtual void addLine3d(const c8* attributeName, const core::line3df& v) _IRR_OVERRIDE_; - - //! Sets an attribute as a 3d line - virtual void setAttribute(const c8* attributeName, const core::line3df& v) _IRR_OVERRIDE_; - - //! Gets an attribute as a 3d line - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - //! \return Returns value of the attribute previously set by setAttribute() - virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) const _IRR_OVERRIDE_; - - //! Gets an attribute as a 3d line - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual core::line3df getAttributeAsLine3d(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as a 3d line - virtual void setAttribute(s32 index, const core::line3df& v) _IRR_OVERRIDE_; - - - /* - - Texture Attribute - - */ - - //! Adds an attribute as texture reference - virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_; - - //! Sets an attribute as texture reference - virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_; - - //! Gets an attribute as texture reference - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) const _IRR_OVERRIDE_; - - //! Gets an attribute as texture reference - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual video::ITexture* getAttributeAsTexture(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as texture reference - virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_; - - - - /* - - User Pointer Attribute - - */ - - //! Adds an attribute as user pointer - virtual void addUserPointer(const c8* attributeName, void* userPointer) _IRR_OVERRIDE_; - - //! Sets an attribute as user pointer - virtual void setAttribute(const c8* attributeName, void* userPointer) _IRR_OVERRIDE_; - - //! Gets an attribute as user pointer - //! \param attributeName: Name of the attribute to get. - //! \param defaultNotFound Value returned when attributeName was not found - virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) const _IRR_OVERRIDE_; - - //! Gets an attribute as user pointer - //! \param index: Index value, must be between 0 and getAttributeCount()-1. - virtual void* getAttributeAsUserPointer(s32 index) const _IRR_OVERRIDE_; - - //! Sets an attribute as user pointer - virtual void setAttribute(s32 index, void* userPointer) _IRR_OVERRIDE_; - protected: core::array Attributes; diff --git a/source/Irrlicht/CBillboardSceneNode.cpp b/source/Irrlicht/CBillboardSceneNode.cpp index 9eddb985..a1464eb1 100644 --- a/source/Irrlicht/CBillboardSceneNode.cpp +++ b/source/Irrlicht/CBillboardSceneNode.cpp @@ -220,42 +220,6 @@ void CBillboardSceneNode::getSize(f32& height, f32& bottomEdgeWidth, } -//! Writes attributes of the scene node. -void CBillboardSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IBillboardSceneNode::serializeAttributes(out, options); - - out->addFloat("Width", Size.Width); - out->addFloat("TopEdgeWidth", TopEdgeWidth); - out->addFloat("Height", Size.Height); - out->addColor("Shade_Top", Buffer->Vertices[1].Color); - out->addColor("Shade_Down", Buffer->Vertices[0].Color); -} - - -//! Reads attributes of the scene node. -void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - IBillboardSceneNode::deserializeAttributes(in, options); - - Size.Width = in->getAttributeAsFloat("Width"); - Size.Height = in->getAttributeAsFloat("Height"); - - if (in->existsAttribute("TopEdgeWidth")) - { - TopEdgeWidth = in->getAttributeAsFloat("TopEdgeWidth"); - if (Size.Width != TopEdgeWidth) - setSize(Size.Height, Size.Width, TopEdgeWidth); - } - else - setSize(Size); - Buffer->Vertices[1].Color = in->getAttributeAsColor("Shade_Top"); - Buffer->Vertices[0].Color = in->getAttributeAsColor("Shade_Down"); - Buffer->Vertices[2].Color = Buffer->Vertices[1].Color; - Buffer->Vertices[3].Color = Buffer->Vertices[0].Color; -} - - //! Set the color of all vertices of the billboard //! \param overallColor: the color to set void CBillboardSceneNode::setColor(const video::SColor& overallColor) diff --git a/source/Irrlicht/CBillboardSceneNode.h b/source/Irrlicht/CBillboardSceneNode.h index 73ae6d07..98e965be 100644 --- a/source/Irrlicht/CBillboardSceneNode.h +++ b/source/Irrlicht/CBillboardSceneNode.h @@ -72,12 +72,6 @@ public: //! Get the real boundingbox used by the billboard (which depends on the active camera) virtual const core::aabbox3d& getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode* camera) _IRR_OVERRIDE_; - //! Writes attributes of the scene node. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the scene node. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_BILLBOARD; } diff --git a/source/Irrlicht/CBoneSceneNode.cpp b/source/Irrlicht/CBoneSceneNode.cpp index 87955423..ccce9820 100644 --- a/source/Irrlicht/CBoneSceneNode.cpp +++ b/source/Irrlicht/CBoneSceneNode.cpp @@ -96,26 +96,6 @@ void CBoneSceneNode::updateAbsolutePositionOfAllChildren() } -void CBoneSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IBoneSceneNode::serializeAttributes(out, options); - out->addInt("BoneIndex", BoneIndex); - out->addEnum("AnimationMode", AnimationMode, BoneAnimationModeNames); -} - - -void CBoneSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - BoneIndex = in->getAttributeAsInt("BoneIndex"); - AnimationMode = (E_BONE_ANIMATION_MODE)in->getAttributeAsEnumeration("AnimationMode", BoneAnimationModeNames); - // for legacy files (before 1.5) - const core::stringc boneName = in->getAttributeAsString("BoneName"); - setName(boneName); - IBoneSceneNode::deserializeAttributes(in, options); - // TODO: add/replace bone in parent with bone from mesh -} - - } // namespace scene } // namespace irr diff --git a/source/Irrlicht/CBoneSceneNode.h b/source/Irrlicht/CBoneSceneNode.h index 711849ba..358fefc2 100644 --- a/source/Irrlicht/CBoneSceneNode.h +++ b/source/Irrlicht/CBoneSceneNode.h @@ -43,12 +43,6 @@ namespace scene virtual void updateAbsolutePositionOfAllChildren() _IRR_OVERRIDE_; - //! Writes attributes of the scene node. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the scene node. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! How the relative transformation of the bone is used virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) _IRR_OVERRIDE_ { diff --git a/source/Irrlicht/CCameraSceneNode.cpp b/source/Irrlicht/CCameraSceneNode.cpp index 8592dcc3..aaa752f4 100644 --- a/source/Irrlicht/CCameraSceneNode.cpp +++ b/source/Irrlicht/CCameraSceneNode.cpp @@ -300,41 +300,6 @@ void CCameraSceneNode::recalculateViewArea() } -//! Writes attributes of the scene node. -void CCameraSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - ICameraSceneNode::serializeAttributes(out, options); - - out->addVector3d("Target", Target); - out->addVector3d("UpVector", UpVector); - out->addFloat("Fovy", Fovy); - out->addFloat("Aspect", Aspect); - out->addFloat("ZNear", ZNear); - out->addFloat("ZFar", ZFar); - out->addBool("Binding", TargetAndRotationAreBound); - out->addBool("ReceiveInput", InputReceiverEnabled); -} - -//! Reads attributes of the scene node. -void CCameraSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - ICameraSceneNode::deserializeAttributes(in, options); - - Target = in->getAttributeAsVector3d("Target"); - UpVector = in->getAttributeAsVector3d("UpVector"); - Fovy = in->getAttributeAsFloat("Fovy"); - Aspect = in->getAttributeAsFloat("Aspect"); - ZNear = in->getAttributeAsFloat("ZNear"); - ZFar = in->getAttributeAsFloat("ZFar"); - TargetAndRotationAreBound = in->getAttributeAsBool("Binding"); - if ( in->findAttribute("ReceiveInput") ) - InputReceiverEnabled = in->getAttributeAsBool("ReceiveInput"); - - recalculateProjectionMatrix(); - recalculateViewArea(); -} - - //! Set the binding between the camera's rotation adn target. void CCameraSceneNode::bindTargetAndRotation(bool bound) { diff --git a/source/Irrlicht/CCameraSceneNode.h b/source/Irrlicht/CCameraSceneNode.h index 4916a472..234f615f 100644 --- a/source/Irrlicht/CCameraSceneNode.h +++ b/source/Irrlicht/CCameraSceneNode.h @@ -130,12 +130,6 @@ namespace scene //! Returns if the input receiver of the camera is currently enabled. virtual bool isInputReceiverEnabled() const _IRR_OVERRIDE_; - //! Writes attributes of the scene node. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the scene node. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_CAMERA; } diff --git a/source/Irrlicht/CFileSystem.cpp b/source/Irrlicht/CFileSystem.cpp index 5a9e1f4d..78603b89 100644 --- a/source/Irrlicht/CFileSystem.cpp +++ b/source/Irrlicht/CFileSystem.cpp @@ -12,7 +12,6 @@ #include "CFileList.h" #include "stdio.h" #include "os.h" -#include "CAttributes.h" #include "CReadFile.h" #include "CMemoryFile.h" #include "CLimitReadFile.h" @@ -939,12 +938,5 @@ IFileSystem* createFileSystem() } -//! Creates a new empty collection of attributes, usable for serialization and more. -IAttributes* CFileSystem::createEmptyAttributes(video::IVideoDriver* driver) -{ - return new CAttributes(driver); -} - - } // end namespace irr } // end namespace io diff --git a/source/Irrlicht/CFileSystem.h b/source/Irrlicht/CFileSystem.h index d4740103..d5e9ec5c 100644 --- a/source/Irrlicht/CFileSystem.h +++ b/source/Irrlicht/CFileSystem.h @@ -127,9 +127,6 @@ public: //! determines if a file exists and would be able to be opened. virtual bool existFile(const io::path& filename) const _IRR_OVERRIDE_; - //! Creates a new empty collection of attributes, usable for serialization and more. - virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver) _IRR_OVERRIDE_; - private: // don't expose, needs refactoring diff --git a/source/Irrlicht/CGUIButton.cpp b/source/Irrlicht/CGUIButton.cpp index 95d2b37d..704fd3d2 100644 --- a/source/Irrlicht/CGUIButton.cpp +++ b/source/Irrlicht/CGUIButton.cpp @@ -556,103 +556,6 @@ bool CGUIButton::isDrawingBorder() const } -//! Writes attributes of the element. -void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIButton::serializeAttributes(out,options); - - out->addBool ("PushButton", IsPushButton ); - if (IsPushButton) - out->addBool("Pressed", Pressed); - - for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i ) - { - if ( ButtonImages[i].Texture ) - { - core::stringc name( GUIButtonImageStateNames[i] ); - out->addTexture(name.c_str(), ButtonImages[i].Texture); - name += "Rect"; - out->addRect(name.c_str(), ButtonImages[i].SourceRect); - } - } - - out->addBool ("UseAlphaChannel", UseAlphaChannel); - out->addBool ("Border", DrawBorder); - out->addBool ("ScaleImage", ScaleImage); - - for ( u32 i=0; i<(u32)EGBS_COUNT; ++i ) - { - if ( ButtonSprites[i].Index >= 0 ) - { - core::stringc nameIndex( GUIButtonStateNames[i] ); - nameIndex += "Index"; - out->addInt(nameIndex.c_str(), ButtonSprites[i].Index ); - - core::stringc nameColor( GUIButtonStateNames[i] ); - nameColor += "Color"; - out->addColor(nameColor.c_str(), ButtonSprites[i].Color ); - - core::stringc nameLoop( GUIButtonStateNames[i] ); - nameLoop += "Loop"; - out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop ); - - core::stringc nameScale( GUIButtonStateNames[i] ); - nameScale += "Scale"; - out->addBool(nameScale.c_str(), ButtonSprites[i].Scale ); - } - } - - // out->addString ("OverrideFont", OverrideFont); -} - - -//! Reads attributes of the element -void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIButton::deserializeAttributes(in,options); - - IsPushButton = in->getAttributeAsBool("PushButton", IsPushButton); - Pressed = IsPushButton ? in->getAttributeAsBool("Pressed", Pressed) : false; - - for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i ) - { - core::stringc nameRect( GUIButtonImageStateNames[i] ); - nameRect += "Rect"; - - setImage((EGUI_BUTTON_IMAGE_STATE)i, - in->getAttributeAsTexture(GUIButtonImageStateNames[i], ButtonImages[i].Texture), - in->getAttributeAsRect(nameRect.c_str(), ButtonImages[i].SourceRect) ); - } - - setDrawBorder(in->getAttributeAsBool("Border", DrawBorder)); - setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel)); - setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage)); - - for ( u32 i=0; i<(u32)EGBS_COUNT; ++i ) - { - core::stringc nameIndex( GUIButtonStateNames[i] ); - nameIndex += "Index"; - ButtonSprites[i].Index = in->getAttributeAsInt(nameIndex.c_str(), ButtonSprites[i].Index ); - - core::stringc nameColor( GUIButtonStateNames[i] ); - nameColor += "Color"; - ButtonSprites[i].Color = in->getAttributeAsColor(nameColor.c_str(), ButtonSprites[i].Color ); - - core::stringc nameLoop( GUIButtonStateNames[i] ); - nameLoop += "Loop"; - ButtonSprites[i].Loop = in->getAttributeAsBool(nameLoop.c_str(), ButtonSprites[i].Loop ); - - core::stringc nameScale( GUIButtonStateNames[i] ); - nameScale += "Scale"; - ButtonSprites[i].Scale = in->getAttributeAsBool(nameScale.c_str(), ButtonSprites[i].Scale ); - } - - // setOverrideFont(in->getAttributeAsString("OverrideFont")); - - updateAbsolutePosition(); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIButton.h b/source/Irrlicht/CGUIButton.h index 88ca8f44..4a6d770d 100644 --- a/source/Irrlicht/CGUIButton.h +++ b/source/Irrlicht/CGUIButton.h @@ -155,12 +155,6 @@ namespace gui return ClickControlState; } - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - protected: void drawSprite(EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center); EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const; diff --git a/source/Irrlicht/CGUICheckBox.cpp b/source/Irrlicht/CGUICheckBox.cpp index 9fc6dc79..48ec5e8a 100644 --- a/source/Irrlicht/CGUICheckBox.cpp +++ b/source/Irrlicht/CGUICheckBox.cpp @@ -225,28 +225,6 @@ bool CGUICheckBox::isDrawBorderEnabled() const } -//! Writes attributes of the element. -void CGUICheckBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUICheckBox::serializeAttributes(out,options); - - out->addBool("Checked", Checked); - out->addBool("Border", Border); - out->addBool("Background", Background); -} - - -//! Reads attributes of the element -void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - Checked = in->getAttributeAsBool ("Checked"); - Border = in->getAttributeAsBool ("Border", Border); - Background = in->getAttributeAsBool ("Background", Background); - - IGUICheckBox::deserializeAttributes(in,options); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUICheckBox.h b/source/Irrlicht/CGUICheckBox.h index 47260a92..366b7628 100644 --- a/source/Irrlicht/CGUICheckBox.h +++ b/source/Irrlicht/CGUICheckBox.h @@ -48,12 +48,6 @@ namespace gui //! draws the element and its children virtual void draw() _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: u32 CheckTime; diff --git a/source/Irrlicht/CGUIComboBox.cpp b/source/Irrlicht/CGUIComboBox.cpp index 1efd345b..b35b47a6 100644 --- a/source/Irrlicht/CGUIComboBox.cpp +++ b/source/Irrlicht/CGUIComboBox.cpp @@ -486,52 +486,6 @@ void CGUIComboBox::openCloseMenu() } -//! Writes attributes of the element. -void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIComboBox::serializeAttributes(out,options); - - out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames); - out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames); - out->addInt("MaxSelectionRows", (s32)MaxSelectionRows ); - - out->addInt ("Selected", Selected ); - out->addInt ("ItemCount", Items.size()); - for (u32 i=0; i < Items.size(); ++i) - { - core::stringc s = "Item"; - s += i; - s += "Text"; - out->addString(s.c_str(), Items[i].Name.c_str()); - } -} - - -//! Reads attributes of the element -void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIComboBox::deserializeAttributes(in,options); - - setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames), - (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames)); - setMaxSelectionRows( (u32)(in->getAttributeAsInt("MaxSelectionRows")) ); - - // clear the list - clear(); - // get item count - u32 c = in->getAttributeAsInt("ItemCount"); - // add items - for (u32 i=0; i < c; ++i) - { - core::stringc s = "Item"; - s += i; - s += "Text"; - addItem(in->getAttributeAsStringW(s.c_str()).c_str(), 0); - } - - setSelected(in->getAttributeAsInt("Selected")); -} - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIComboBox.h b/source/Irrlicht/CGUIComboBox.h index 5aa5de6d..a3e39b88 100644 --- a/source/Irrlicht/CGUIComboBox.h +++ b/source/Irrlicht/CGUIComboBox.h @@ -74,12 +74,6 @@ namespace gui //! draws the element and its children virtual void draw() _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: void openCloseMenu(); diff --git a/source/Irrlicht/CGUIContextMenu.cpp b/source/Irrlicht/CGUIContextMenu.cpp index d38ceeda..74e7687b 100644 --- a/source/Irrlicht/CGUIContextMenu.cpp +++ b/source/Irrlicht/CGUIContextMenu.cpp @@ -735,113 +735,6 @@ void CGUIContextMenu::setItemCommandId(u32 idx, s32 id) } -//! Writes attributes of the element. -void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIElement::serializeAttributes(out,options); - out->addPosition2d("Position", Pos); - - if (Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) - { - const IGUIContextMenu* const ptr = (const IGUIContextMenu*)Parent; - // find the position of this item in its parent's list - u32 i; - // VC6 needs the cast for this - for (i=0; (igetItemCount()) && (ptr->getSubMenu(i) != (const IGUIContextMenu*)this); ++i) - ; // do nothing - - out->addInt("ParentItem", i); - } - - out->addInt("CloseHandling", (s32)CloseHandling); - - // write out the item list - out->addInt("ItemCount", Items.size()); - - core::stringc tmp; - - for (u32 i=0; i < Items.size(); ++i) - { - tmp = "IsSeparator"; tmp += i; - out->addBool(tmp.c_str(), Items[i].IsSeparator); - - if (!Items[i].IsSeparator) - { - tmp = "Text"; tmp += i; - out->addString(tmp.c_str(), Items[i].Text.c_str()); - tmp = "CommandID"; tmp += i; - out->addInt(tmp.c_str(), Items[i].CommandId); - tmp = "Enabled"; tmp += i; - out->addBool(tmp.c_str(), Items[i].Enabled); - tmp = "Checked"; tmp += i; - out->addBool(tmp.c_str(), Items[i].Checked); - tmp = "AutoChecking"; tmp += i; - out->addBool(tmp.c_str(), Items[i].AutoChecking); - } - } -} - - -//! Reads attributes of the element -void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIElement::deserializeAttributes(in,options); - - Pos = in->getAttributeAsPosition2d("Position"); - - // link to this item's parent - if (Parent && ( Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) ) - ((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this); - - CloseHandling = (ECONTEXT_MENU_CLOSE)in->getAttributeAsInt("CloseHandling"); - - removeAllItems(); - - // read the item list - const s32 count = in->getAttributeAsInt("ItemCount"); - - for (s32 i=0; iexistsAttribute(tmp.c_str()) && in->getAttributeAsBool(tmp.c_str()) ) - addSeparator(); - else - { - tmp = "Text"; tmp += i; - if ( in->existsAttribute(tmp.c_str()) ) - txt = in->getAttributeAsStringW(tmp.c_str()); - - tmp = "CommandID"; tmp += i; - if ( in->existsAttribute(tmp.c_str()) ) - commandid = in->getAttributeAsInt(tmp.c_str()); - - tmp = "Enabled"; tmp += i; - if ( in->existsAttribute(tmp.c_str()) ) - enabled = in->getAttributeAsBool(tmp.c_str()); - - tmp = "Checked"; tmp += i; - if ( in->existsAttribute(tmp.c_str()) ) - checked = in->getAttributeAsBool(tmp.c_str()); - - tmp = "AutoChecking"; tmp += i; - if ( in->existsAttribute(tmp.c_str()) ) - autochecking = in->getAttributeAsBool(tmp.c_str()); - - addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked, autochecking); - } - } - - recalculateSize(); -} - - // because sometimes the element has no parent at click time void CGUIContextMenu::setEventParent(IGUIElement *parent) { diff --git a/source/Irrlicht/CGUIContextMenu.h b/source/Irrlicht/CGUIContextMenu.h index 80ddf325..f2780e82 100644 --- a/source/Irrlicht/CGUIContextMenu.h +++ b/source/Irrlicht/CGUIContextMenu.h @@ -112,12 +112,6 @@ namespace gui //! When an eventparent is set it receives events instead of the usual parent element virtual void setEventParent(IGUIElement *parent) _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - protected: void closeAllSubMenus(); diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp index 9c95eff4..a3851e60 100644 --- a/source/Irrlicht/CGUIEditBox.cpp +++ b/source/Irrlicht/CGUIEditBox.cpp @@ -1650,60 +1650,6 @@ bool CGUIEditBox::acceptsIME() return isEnabled(); } -//! Writes attributes of the element. -void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - // IGUIEditBox::serializeAttributes(out,options); - - out->addBool ("Border", Border); - out->addBool ("Background", Background); - out->addBool ("OverrideColorEnabled", OverrideColorEnabled ); - out->addColor ("OverrideColor", OverrideColor); - // out->addFont("OverrideFont", OverrideFont); - out->addInt ("MaxChars", Max); - out->addBool ("WordWrap", WordWrap); - out->addBool ("MultiLine", MultiLine); - out->addBool ("AutoScroll", AutoScroll); - out->addBool ("PasswordBox", PasswordBox); - core::stringw ch = L" "; - ch[0] = PasswordChar; - out->addString("PasswordChar", ch.c_str()); - out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames); - out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames); - - IGUIEditBox::serializeAttributes(out,options); -} - - -//! Reads attributes of the element -void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIEditBox::deserializeAttributes(in,options); - - setDrawBorder( in->getAttributeAsBool("Border", Border) ); - setDrawBackground( in->getAttributeAsBool("Background", Background) ); - setOverrideColor(in->getAttributeAsColor("OverrideColor", OverrideColor)); - enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled)); - setMax(in->getAttributeAsInt("MaxChars", Max)); - setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap)); - setMultiLine(in->getAttributeAsBool("MultiLine", MultiLine)); - setAutoScroll(in->getAttributeAsBool("AutoScroll", AutoScroll)); - core::stringw ch = L" "; - ch[0] = PasswordChar; - ch = in->getAttributeAsStringW("PasswordChar", ch); - - if (!ch.size()) - setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox)); - else - setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox), ch[0]); - - setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign), - (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign)); - - // setOverrideFont(in->getAttributeAsFont("OverrideFont")); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIEditBox.h b/source/Irrlicht/CGUIEditBox.h index 49435672..60a189da 100644 --- a/source/Irrlicht/CGUIEditBox.h +++ b/source/Irrlicht/CGUIEditBox.h @@ -142,13 +142,6 @@ namespace gui //! Returns whether the element takes input from the IME virtual bool acceptsIME() _IRR_OVERRIDE_; - - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - protected: //! Breaks the single text line. void breakText(); diff --git a/source/Irrlicht/CGUIEnvironment.cpp b/source/Irrlicht/CGUIEnvironment.cpp index 2553133f..040cbff1 100644 --- a/source/Irrlicht/CGUIEnvironment.cpp +++ b/source/Irrlicht/CGUIEnvironment.cpp @@ -811,49 +811,6 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent) return false; } - -//! Writes attributes of the environment -void CGUIEnvironment::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IGUISkin* skin = getSkin(); - - if (skin) - { - out->addEnum("Skin", getSkin()->getType(), GUISkinTypeNames); - skin->serializeAttributes(out, options); - } -} - - -//! Reads attributes of the environment -void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - if (in->existsAttribute("Skin")) - { - IGUISkin *skin = getSkin(); - - EGUI_SKIN_TYPE t = (EGUI_SKIN_TYPE) in->getAttributeAsEnumeration("Skin",GUISkinTypeNames); - if ( !skin || t != skin->getType()) - { - skin = createSkin(t); - setSkin(skin); - skin->drop(); - } - - skin = getSkin(); - - if (skin) - { - skin->deserializeAttributes(in, options); - } - - } - - RelativeRect = AbsoluteRect = - core::rect(Driver ? core::dimension2di(Driver->getScreenSize()) : core::dimension2d(0,0)); -} - - //! adds a button. The returned pointer must not be dropped. IGUIButton* CGUIEnvironment::addButton(const core::rect& rectangle, IGUIElement* parent, s32 id, const wchar_t* text, const wchar_t *tooltiptext) { diff --git a/source/Irrlicht/CGUIEnvironment.h b/source/Irrlicht/CGUIEnvironment.h index b49f25e7..87694e95 100644 --- a/source/Irrlicht/CGUIEnvironment.h +++ b/source/Irrlicht/CGUIEnvironment.h @@ -248,12 +248,6 @@ public: if not specified, the root element will be used */ virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) _IRR_OVERRIDE_; - //! Writes attributes of the environment - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the environment. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! Find the next element which would be selected when pressing the tab-key virtual IGUIElement* getNextElement(bool reverse=false, bool group=false) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CGUIFileOpenDialog.cpp b/source/Irrlicht/CGUIFileOpenDialog.cpp index 52b6808d..9e46d80d 100644 --- a/source/Irrlicht/CGUIFileOpenDialog.cpp +++ b/source/Irrlicht/CGUIFileOpenDialog.cpp @@ -348,36 +348,6 @@ void CGUIFileOpenDialog::draw() IGUIElement::draw(); } - -//! Writes attributes of the element. -/* Not sure if this will really work out properly. Saving paths can be -rather problematic. */ -void CGUIFileOpenDialog::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IGUIFileOpenDialog::serializeAttributes(out,options); - - out->addString("StartDirectory", StartDirectory.c_str()); - out->addBool("RestoreDirectory", (RestoreDirectory.size()!=0)); -} - - -//! Reads attributes of the element -/* Note that these paths changes will happen at arbitrary places upon -load of the gui description. This may be undesired. */ -void CGUIFileOpenDialog::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - StartDirectory = in->getAttributeAsString("StartDirectory"); - const bool restore = in->getAttributeAsBool("RestoreDirectory"); - if (restore) - RestoreDirectory = FileSystem->getWorkingDirectory(); - else - RestoreDirectory = ""; - if (StartDirectory.size()) - FileSystem->changeWorkingDirectoryTo(StartDirectory); - - IGUIFileOpenDialog::deserializeAttributes(in,options); -} - void CGUIFileOpenDialog::pathToStringW(irr::core::stringw& result, const irr::io::path& p) { core::multibyteToWString(result, p); diff --git a/source/Irrlicht/CGUIFileOpenDialog.h b/source/Irrlicht/CGUIFileOpenDialog.h index aec04898..9af576df 100644 --- a/source/Irrlicht/CGUIFileOpenDialog.h +++ b/source/Irrlicht/CGUIFileOpenDialog.h @@ -49,9 +49,6 @@ namespace gui //! draws the element and its children virtual void draw() _IRR_OVERRIDE_; - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - protected: void setFileName(const irr::io::path& name); diff --git a/source/Irrlicht/CGUIImage.cpp b/source/Irrlicht/CGUIImage.cpp index 87e5818d..2d2a08cb 100644 --- a/source/Irrlicht/CGUIImage.cpp +++ b/source/Irrlicht/CGUIImage.cpp @@ -174,44 +174,6 @@ core::rect CGUIImage::getDrawBounds() const return DrawBounds; } -//! Writes attributes of the element. -void CGUIImage::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIImage::serializeAttributes(out,options); - - out->addTexture ("Texture", Texture); - out->addBool ("UseAlphaChannel", UseAlphaChannel); - out->addColor ("Color", Color); - out->addBool ("ScaleImage", ScaleImage); - out->addRect ("SourceRect", SourceRect); - out->addFloat ("DrawBoundsX1", DrawBounds.UpperLeftCorner.X); - out->addFloat ("DrawBoundsY1", DrawBounds.UpperLeftCorner.Y); - out->addFloat ("DrawBoundsX2", DrawBounds.LowerRightCorner.X); - out->addFloat ("DrawBoundsY2", DrawBounds.LowerRightCorner.Y); - out->addBool ("DrawBackground", DrawBackground); -} - - -//! Reads attributes of the element -void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIImage::deserializeAttributes(in,options); - - setImage(in->getAttributeAsTexture("Texture", Texture)); - setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel)); - setColor(in->getAttributeAsColor("Color", Color)); - setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage)); - setSourceRect(in->getAttributeAsRect("SourceRect", SourceRect)); - - DrawBounds.UpperLeftCorner.X = in->getAttributeAsFloat("DrawBoundsX1", DrawBounds.UpperLeftCorner.X); - DrawBounds.UpperLeftCorner.Y = in->getAttributeAsFloat("DrawBoundsY1", DrawBounds.UpperLeftCorner.Y); - DrawBounds.LowerRightCorner.X = in->getAttributeAsFloat("DrawBoundsX2", DrawBounds.LowerRightCorner.X); - DrawBounds.LowerRightCorner.Y = in->getAttributeAsFloat("DrawBoundsY2", DrawBounds.LowerRightCorner.Y); - setDrawBounds(DrawBounds); - - setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground)); -} - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIImage.h b/source/Irrlicht/CGUIImage.h index 034a8903..7b08b459 100644 --- a/source/Irrlicht/CGUIImage.h +++ b/source/Irrlicht/CGUIImage.h @@ -76,12 +76,6 @@ namespace gui return DrawBackground; } - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - protected: void checkBounds(core::rect& rect) { diff --git a/source/Irrlicht/CGUIInOutFader.cpp b/source/Irrlicht/CGUIInOutFader.cpp index 0239db1c..e909e0e4 100644 --- a/source/Irrlicht/CGUIInOutFader.cpp +++ b/source/Irrlicht/CGUIInOutFader.cpp @@ -149,28 +149,6 @@ void CGUIInOutFader::fadeOut(u32 time) setColor(Color[0],Color[1]); } - -//! Writes attributes of the element. -void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIInOutFader::serializeAttributes(out,options); - - out->addColor ("FullColor", FullColor); - out->addColor ("TransColor", TransColor); - -} - - -//! Reads attributes of the element -void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIInOutFader::deserializeAttributes(in,options); - - FullColor = in->getAttributeAsColor("FullColor"); - TransColor = in->getAttributeAsColor("TransColor"); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIInOutFader.h b/source/Irrlicht/CGUIInOutFader.h index 1fdb6bb3..2321c85e 100644 --- a/source/Irrlicht/CGUIInOutFader.h +++ b/source/Irrlicht/CGUIInOutFader.h @@ -42,12 +42,6 @@ namespace gui //! Returns if the fade in or out process is done. virtual bool isReady() const _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: enum EFadeAction diff --git a/source/Irrlicht/CGUIListBox.cpp b/source/Irrlicht/CGUIListBox.cpp index 65434fac..f6f0e778 100644 --- a/source/Irrlicht/CGUIListBox.cpp +++ b/source/Irrlicht/CGUIListBox.cpp @@ -685,86 +685,6 @@ bool CGUIListBox::getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::str } -//! Writes attributes of the element. -void CGUIListBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIListBox::serializeAttributes(out,options); - - // todo: out->addString ("IconBank", IconBank->getName?); - out->addBool ("DrawBack", DrawBack); - out->addBool ("MoveOverSelect", MoveOverSelect); - out->addBool ("AutoScroll", AutoScroll); - - out->addInt("ItemCount", Items.size()); - for (u32 i=0;iaddString(label.c_str(), Items[i].Text.c_str() ); - - for ( s32 c=0; c < (s32)EGUI_LBC_COUNT; ++c ) - { - core::stringc useColorLabel, colorLabel; - if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) ) - return; - label = useColorLabel; label += i; - if ( Items[i].OverrideColors[c].Use ) - { - out->addBool(label.c_str(), true ); - label = colorLabel; label += i; - out->addColor(label.c_str(), Items[i].OverrideColors[c].Color); - } - else - { - out->addBool(label.c_str(), false ); - } - } - } - out->addInt("Selected", Selected); -} - - -//! Reads attributes of the element -void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - clear(); - - DrawBack = in->getAttributeAsBool("DrawBack", DrawBack); - MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect); - AutoScroll = in->getAttributeAsBool("AutoScroll", AutoScroll); - - IGUIListBox::deserializeAttributes(in,options); - - const s32 count = in->getAttributeAsInt("ItemCount"); - for (s32 i=0; igetAttributeAsStringW(label.c_str()); - - addItem(item.Text.c_str(), item.Icon); - - for ( u32 c=0; c < EGUI_LBC_COUNT; ++c ) - { - core::stringc useColorLabel, colorLabel; - if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) ) - return; - label = useColorLabel; label += i; - Items[i].OverrideColors[c].Use = in->getAttributeAsBool(label.c_str()); - if ( Items[i].OverrideColors[c].Use ) - { - label = colorLabel; label += i; - Items[i].OverrideColors[c].Color = in->getAttributeAsColor(label.c_str()); - } - } - } - Selected = in->getAttributeAsInt("Selected", Selected); - recalculateScrollPos(); -} - - void CGUIListBox::recalculateItemWidth(s32 icon) { if (IconBank && icon > -1 && diff --git a/source/Irrlicht/CGUIListBox.h b/source/Irrlicht/CGUIListBox.h index 4fc61220..0742c0db 100644 --- a/source/Irrlicht/CGUIListBox.h +++ b/source/Irrlicht/CGUIListBox.h @@ -88,12 +88,6 @@ namespace gui //! Update the position and size of the listbox, and update the scrollbar virtual void updateAbsolutePosition() _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - //! set all item colors at given index to color virtual void setItemOverrideColor(u32 index, video::SColor color) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CGUIMessageBox.cpp b/source/Irrlicht/CGUIMessageBox.cpp index 57b383db..f6281af7 100644 --- a/source/Irrlicht/CGUIMessageBox.cpp +++ b/source/Irrlicht/CGUIMessageBox.cpp @@ -413,49 +413,6 @@ bool CGUIMessageBox::OnEvent(const SEvent& event) return CGUIWindow::OnEvent(event); } - -//! Writes attributes of the element. -void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - CGUIWindow::serializeAttributes(out,options); - - out->addBool ("OkayButton", (Flags & EMBF_OK) != 0 ); - out->addBool ("CancelButton", (Flags & EMBF_CANCEL) != 0 ); - out->addBool ("YesButton", (Flags & EMBF_YES) != 0 ); - out->addBool ("NoButton", (Flags & EMBF_NO) != 0 ); - out->addTexture ("Texture", IconTexture); - - out->addString ("MessageText", MessageText.c_str()); -} - - -//! Reads attributes of the element -void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - Flags = 0; - - Flags = in->getAttributeAsBool("OkayButton") ? EMBF_OK : 0; - Flags |= in->getAttributeAsBool("CancelButton")? EMBF_CANCEL : 0; - Flags |= in->getAttributeAsBool("YesButton") ? EMBF_YES : 0; - Flags |= in->getAttributeAsBool("NoButton") ? EMBF_NO : 0; - - if ( IconTexture ) - { - IconTexture->drop(); - IconTexture = NULL; - } - IconTexture = in->getAttributeAsTexture("Texture"); - if ( IconTexture ) - IconTexture->grab(); - - MessageText = in->getAttributeAsStringW("MessageText").c_str(); - - CGUIWindow::deserializeAttributes(in,options); - - refreshControls(); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIMessageBox.h b/source/Irrlicht/CGUIMessageBox.h index 91d98860..d51861ca 100644 --- a/source/Irrlicht/CGUIMessageBox.h +++ b/source/Irrlicht/CGUIMessageBox.h @@ -32,12 +32,6 @@ namespace gui //! called if an event happened. virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: void refreshControls(); diff --git a/source/Irrlicht/CGUIModalScreen.cpp b/source/Irrlicht/CGUIModalScreen.cpp index 66f769ec..ce8b32e1 100644 --- a/source/Irrlicht/CGUIModalScreen.cpp +++ b/source/Irrlicht/CGUIModalScreen.cpp @@ -230,24 +230,6 @@ void CGUIModalScreen::updateAbsolutePosition() IGUIElement::updateAbsolutePosition(); } - -//! Writes attributes of the element. -void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIElement::serializeAttributes(out,options); - - out->addInt("BlinkMode", BlinkMode ); -} - -//! Reads attributes of the element -void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIElement::deserializeAttributes(in, options); - - BlinkMode = in->getAttributeAsInt("BlinkMode", BlinkMode); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIModalScreen.h b/source/Irrlicht/CGUIModalScreen.h index c9ab8921..0f3a973a 100644 --- a/source/Irrlicht/CGUIModalScreen.h +++ b/source/Irrlicht/CGUIModalScreen.h @@ -46,12 +46,6 @@ namespace gui //! Modals are infinite so every point is inside virtual bool isPointInside(const core::position2d& point) const _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - //! Set when to blink. //! Bitset of following values (can be combined) //! 0 = never diff --git a/source/Irrlicht/CGUIScrollBar.cpp b/source/Irrlicht/CGUIScrollBar.cpp index a1779bde..6d6d3675 100644 --- a/source/Irrlicht/CGUIScrollBar.cpp +++ b/source/Irrlicht/CGUIScrollBar.cpp @@ -532,39 +532,6 @@ void CGUIScrollBar::refreshControls() } } - -//! Writes attributes of the element. -void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIScrollBar::serializeAttributes(out,options); - - out->addBool("Horizontal", Horizontal); - out->addInt ("Value", Pos); - out->addInt ("Min", Min); - out->addInt ("Max", Max); - out->addInt ("SmallStep", SmallStep); - out->addInt ("LargeStep", LargeStep); - // CurrentIconColor - not serialized as continuously updated -} - - -//! Reads attributes of the element -void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIScrollBar::deserializeAttributes(in,options); - - Horizontal = in->getAttributeAsBool("Horizontal", Horizontal); - setMin(in->getAttributeAsInt("Min", Min)); - setMax(in->getAttributeAsInt("Max", Max)); - setPos(in->getAttributeAsInt("Value", Pos)); - setSmallStep(in->getAttributeAsInt("SmallStep", SmallStep)); - setLargeStep(in->getAttributeAsInt("LargeStep", LargeStep)); - // CurrentIconColor - not serialized as continuously updated - - refreshControls(); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIScrollBar.h b/source/Irrlicht/CGUIScrollBar.h index 2bbe50ac..198518ea 100644 --- a/source/Irrlicht/CGUIScrollBar.h +++ b/source/Irrlicht/CGUIScrollBar.h @@ -70,12 +70,6 @@ namespace gui //! updates the rectangle virtual void updateAbsolutePosition() _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: void refreshControls(); diff --git a/source/Irrlicht/CGUISkin.cpp b/source/Irrlicht/CGUISkin.cpp index 30573b93..08a59007 100644 --- a/source/Irrlicht/CGUISkin.cpp +++ b/source/Irrlicht/CGUISkin.cpp @@ -971,43 +971,6 @@ void CGUISkin::draw2DRectangle(IGUIElement* element, Driver->draw2DRectangle(color, pos, clip); } - -//! Writes attributes of the skin -void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - u32 i; - for (i=0; iaddColor(GUISkinColorNames[i], Colors[i]); - - for (i=0; iaddInt(GUISkinSizeNames[i], Sizes[i]); - - for (i=0; iaddString(GUISkinTextNames[i], Texts[i].c_str()); - - for (i=0; iaddInt(GUISkinIconNames[i], Icons[i]); -} - - -//! Reads attributes of the skikn -void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - u32 i; - for (i=0; igetAttributeAsColor(GUISkinColorNames[i], Colors[i]); - - for (i=0; igetAttributeAsInt(GUISkinSizeNames[i], Sizes[i]); - - for (i=0; igetAttributeAsStringW(GUISkinTextNames[i], Texts[i]); - - for (i=0; igetAttributeAsInt(GUISkinIconNames[i], Icons[i]); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUISkin.h b/source/Irrlicht/CGUISkin.h index eb58e6be..888c6dc8 100644 --- a/source/Irrlicht/CGUISkin.h +++ b/source/Irrlicht/CGUISkin.h @@ -216,12 +216,6 @@ namespace gui //! get the type of this skin virtual EGUI_SKIN_TYPE getType() const _IRR_OVERRIDE_; - //! Writes attributes of the skin - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the skin - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - private: video::SColor Colors[EGDC_COUNT]; diff --git a/source/Irrlicht/CGUISpinBox.cpp b/source/Irrlicht/CGUISpinBox.cpp index 16e81656..af7ce843 100644 --- a/source/Irrlicht/CGUISpinBox.cpp +++ b/source/Irrlicht/CGUISpinBox.cpp @@ -316,29 +316,6 @@ const wchar_t* CGUISpinBox::getText() const } -//! Writes attributes of the element. -void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IGUIElement::serializeAttributes(out, options); - out->addFloat("Min", getMin()); - out->addFloat("Max", getMax()); - out->addFloat("Step", getStepSize()); - out->addInt("DecimalPlaces", DecimalPlaces); - out->addInt("ValidateOn", (s32)ValidateOn); -} - - -//! Reads attributes of the element -void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - IGUIElement::deserializeAttributes(in, options); - setRange(in->getAttributeAsFloat("Min", RangeMin), in->getAttributeAsFloat("Max", RangeMax)); - setStepSize(in->getAttributeAsFloat("Step", StepSize)); - setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces", DecimalPlaces)); - setValidateOn((u32)in->getAttributeAsInt("ValidateOn", (s32)ValidateOn) ); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUISpinBox.h b/source/Irrlicht/CGUISpinBox.h index 1a84359a..4f77e264 100644 --- a/source/Irrlicht/CGUISpinBox.h +++ b/source/Irrlicht/CGUISpinBox.h @@ -83,12 +83,6 @@ namespace gui //! Gets when the spinbox has to validate entered text. virtual u32 getValidateOn() const _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - protected: virtual void verifyValueRange(); void refreshSprites(); diff --git a/source/Irrlicht/CGUIStaticText.cpp b/source/Irrlicht/CGUIStaticText.cpp index 086c357d..b9ab35a9 100644 --- a/source/Irrlicht/CGUIStaticText.cpp +++ b/source/Irrlicht/CGUIStaticText.cpp @@ -590,51 +590,6 @@ s32 CGUIStaticText::getTextWidth() const } -//! Writes attributes of the element. -//! Implement this to expose the attributes of your element for -//! scripting languages, editors, debuggers or xml serialization purposes. -void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIStaticText::serializeAttributes(out,options); - - out->addBool ("Border", Border); - out->addBool ("OverrideColorEnabled",OverrideColorEnabled); - out->addBool ("OverrideBGColorEnabled",OverrideBGColorEnabled); - out->addBool ("WordWrap", WordWrap); - out->addBool ("Background", Background); - out->addBool ("RightToLeft", RightToLeft); - out->addBool ("RestrainTextInside", RestrainTextInside); - out->addColor ("OverrideColor", OverrideColor); - out->addColor ("BGColor", BGColor); - out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames); - out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames); - - // out->addFont ("OverrideFont", OverrideFont); -} - - -//! Reads attributes of the element -void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUIStaticText::deserializeAttributes(in,options); - - Border = in->getAttributeAsBool("Border", Border); - enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled)); - OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled", OverrideBGColorEnabled); - setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap)); - Background = in->getAttributeAsBool("Background", Background); - RightToLeft = in->getAttributeAsBool("RightToLeft", RightToLeft); - RestrainTextInside = in->getAttributeAsBool("RestrainTextInside", RestrainTextInside); - OverrideColor = in->getAttributeAsColor("OverrideColor", OverrideColor); - BGColor = in->getAttributeAsColor("BGColor", BGColor); - - setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign), - (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign)); - - // OverrideFont = in->getAttributeAsFont("OverrideFont"); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIStaticText.h b/source/Irrlicht/CGUIStaticText.h index b7fbf738..31b7a4a8 100644 --- a/source/Irrlicht/CGUIStaticText.h +++ b/source/Irrlicht/CGUIStaticText.h @@ -112,12 +112,6 @@ namespace gui //! Checks if the text should be interpreted as right-to-left text virtual bool isRightToLeft() const _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: //! Breaks the single text line. diff --git a/source/Irrlicht/CGUITabControl.cpp b/source/Irrlicht/CGUITabControl.cpp index 998856b1..04f36f9a 100644 --- a/source/Irrlicht/CGUITabControl.cpp +++ b/source/Irrlicht/CGUITabControl.cpp @@ -98,45 +98,6 @@ video::SColor CGUITab::getBackgroundColor() const } -//! Writes attributes of the element. -void CGUITab::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUITab::serializeAttributes(out,options); - - IGUITabControl* parentTabControl = Parent && Parent->getType() == EGUIET_TAB_CONTROL ? static_cast(Parent) : 0; - if ( parentTabControl ) - out->addInt ("TabNumber", parentTabControl->getTabIndex(this)); // order of children and tabs can be different, so we save tab-number - out->addBool ("DrawBackground", DrawBackground); - out->addColor ("BackColor", BackColor); - out->addBool ("OverrideTextColorEnabled", OverrideTextColorEnabled); - out->addColor ("TextColor", TextColor); - -} - - -//! Reads attributes of the element -void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - IGUITab::deserializeAttributes(in,options); - - setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground)); - setBackgroundColor(in->getAttributeAsColor("BackColor", BackColor)); - bool overrideColor = in->getAttributeAsBool("OverrideTextColorEnabled", OverrideTextColorEnabled); - setTextColor(in->getAttributeAsColor("TextColor", TextColor)); - OverrideTextColorEnabled = overrideColor; // because setTextColor does set OverrideTextColorEnabled always to true - - IGUITabControl* parentTabControl = Parent && Parent->getType() == EGUIET_TAB_CONTROL ? static_cast(Parent) : 0; - if (parentTabControl) - { - s32 idx = in->getAttributeAsInt("TabNumber", -1); - if ( idx >= 0 ) - parentTabControl->insertTab(idx, this, true); - else - parentTabControl->addTab(this); - } -} - - // ------------------------------------------------------------------ // Tabcontrol // ------------------------------------------------------------------ @@ -1020,38 +981,6 @@ void CGUITabControl::updateAbsolutePosition() } -//! Writes attributes of the element. -void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUITabControl::serializeAttributes(out,options); - - out->addInt ("ActiveTab", ActiveTabIndex); - out->addBool("Border", Border); - out->addBool("FillBackground", FillBackground); - out->addInt ("TabHeight", TabHeight); - out->addInt ("TabMaxWidth", TabMaxWidth); - out->addEnum("TabVerticalAlignment", s32(VerticalAlignment), GUIAlignmentNames); -} - - -//! Reads attributes of the element -void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ - Border = in->getAttributeAsBool("Border"); - FillBackground = in->getAttributeAsBool("FillBackground"); - - ActiveTabIndex = -1; - - setTabHeight(in->getAttributeAsInt("TabHeight")); - TabMaxWidth = in->getAttributeAsInt("TabMaxWidth"); - - IGUITabControl::deserializeAttributes(in,options); - - ActiveTabIndex = in->getAttributeAsInt("ActiveTab", -1); // not setActiveTab as tabs are loaded later - setTabVerticalAlignment( static_cast(in->getAttributeAsEnumeration("TabVerticalAlignment" , GUIAlignmentNames)) ); -} - - } // end namespace irr } // end namespace gui diff --git a/source/Irrlicht/CGUITabControl.h b/source/Irrlicht/CGUITabControl.h index 3752a10f..6fb8068a 100644 --- a/source/Irrlicht/CGUITabControl.h +++ b/source/Irrlicht/CGUITabControl.h @@ -49,12 +49,6 @@ namespace gui virtual video::SColor getTextColor() const _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - private: video::SColor BackColor; @@ -127,14 +121,9 @@ namespace gui //! Removes a child. virtual void removeChild(IGUIElement* child) _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; //! Set the height of the tabs virtual void setTabHeight( s32 height ) _IRR_OVERRIDE_; - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - //! Get the height of the tabs virtual s32 getTabHeight() const _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CGUITable.cpp b/source/Irrlicht/CGUITable.cpp index 206f7ff5..e88e9147 100644 --- a/source/Irrlicht/CGUITable.cpp +++ b/source/Irrlicht/CGUITable.cpp @@ -1135,160 +1135,6 @@ bool CGUITable::isDrawBackgroundEnabled() const return DrawBack; } -//! Writes attributes of the element. -void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IGUITable::serializeAttributes(out, options); - - out->addInt("ColumnCount", Columns.size()); - u32 i; - for (i=0;iaddString(label.c_str(), Columns[i].Name.c_str() ); - label = "Column"; label += i; label += "width"; - out->addInt(label.c_str(), Columns[i].Width ); - label = "Column"; label += i; label += "OrderingMode"; - out->addEnum(label.c_str(), Columns[i].OrderingMode, GUIColumnOrderingNames); - } - - out->addInt("RowCount", Rows.size()); - for (i=0;iaddInt(label.c_str(), Rows[i].Height ); - - //label = "Row"; label += i; label += "ItemCount"; - //out->addInt(label.c_str(), Rows[i].Items.size()); - u32 c; - for ( c=0; c < Rows[i].Items.size(); ++c ) - { - label = "Row"; label += i; label += "cell"; label += c; label += "text"; - out->addString(label.c_str(), Rows[i].Items[c].Text.c_str() ); - // core::stringw BrokenText; // can be recalculated - label = "Row"; label += i; label += "cell"; label += c; label += "color"; - out->addColor(label.c_str(), Rows[i].Items[c].Color ); - label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor"; - out->addColor(label.c_str(), Rows[i].Items[c].IsOverrideColor ); - // void *data; // can't be serialized - } - } - - // s32 ItemHeight; // can be calculated - // TotalItemHeight // calculated - // TotalItemWidth // calculated - // gui::IGUIFont* ActiveFont; // TODO: we don't have a sane font-serialization so far - // gui::IGUIScrollBar* VerticalScrollBar; // not serialized - // gui::IGUIScrollBar* HorizontalScrollBar; // not serialized - - out->addBool ("Clip", Clip); - out->addBool ("DrawBack", DrawBack); - out->addBool ("MoveOverSelect", MoveOverSelect); - - // s32 CurrentResizedColumn; // runtime info - depends on user action - out->addBool ("ResizableColumns", ResizableColumns); - - // s32 Selected; // runtime info - depends on user action - out->addInt("CellWidthPadding", CellWidthPadding ); - out->addInt("CellHeightPadding", CellHeightPadding ); - // s32 ActiveTab; // runtime info - depends on user action - // bool Selecting; // runtime info - depends on user action - out->addEnum("CurrentOrdering", CurrentOrdering, GUIOrderingModeNames); - out->addInt("DrawFlags", DrawFlags); -} - - -//! Reads attributes of the element -void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - IGUITable::deserializeAttributes(in, options); - - Columns.clear(); - u32 columnCount = in->getAttributeAsInt("ColumnCount"); - u32 i; - for (i=0;igetAttributeAsString(label.c_str()).c_str()); - label = "Column"; label += i; label += "width"; - column.Width = in->getAttributeAsInt(label.c_str()); - label = "Column"; label += i; label += "OrderingMode"; - - column.OrderingMode = EGCO_NONE; - s32 co = in->getAttributeAsEnumeration(label.c_str(), GUIColumnOrderingNames); - if (co > 0) - column.OrderingMode = EGUI_COLUMN_ORDERING(co); - - Columns.push_back(column); - } - - Rows.clear(); - u32 rowCount = in->getAttributeAsInt("RowCount"); - for (i=0; igetAttributeAsInt(label.c_str() ); - - Rows.push_back(row); - - //label = "Row"; label += i; label += "ItemCount"; - //u32 itemCount = in->getAttributeAsInt(label.c_str()); - u32 c; - for ( c=0; c < columnCount; ++c ) - { - Cell cell; - - label = "Row"; label += i; label += "cell"; label += c; label += "text"; - cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str()); - breakText( cell.Text, cell.BrokenText, Columns[c].Width ); - label = "Row"; label += i; label += "cell"; label += c; label += "color"; - cell.Color = in->getAttributeAsColor(label.c_str()); - label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor"; - cell.IsOverrideColor = in->getAttributeAsBool(label.c_str()); - - cell.Data = NULL; - - Rows[Rows.size()-1].Items.push_back(cell); - } - } - - ItemHeight = 0; // calculated - TotalItemHeight = 0; // calculated - TotalItemWidth = 0; // calculated - - Clip = in->getAttributeAsBool("Clip", Clip); - DrawBack = in->getAttributeAsBool("DrawBack", DrawBack); - MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect); - - CurrentResizedColumn = -1; - ResizeStart = 0; - ResizableColumns = in->getAttributeAsBool("ResizableColumns", ResizableColumns); - - Selected = -1; - CellWidthPadding = in->getAttributeAsInt("CellWidthPadding", CellWidthPadding); - CellHeightPadding = in->getAttributeAsInt("CellHeightPadding", CellHeightPadding); - ActiveTab = -1; - Selecting = false; - - CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames, (s32)CurrentOrdering); - DrawFlags = in->getAttributeAsInt("DrawFlags", DrawFlags); - - refreshControls(); -} - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUITable.h b/source/Irrlicht/CGUITable.h index f325f49f..b5264a9f 100644 --- a/source/Irrlicht/CGUITable.h +++ b/source/Irrlicht/CGUITable.h @@ -168,16 +168,6 @@ namespace gui /** \return true if background drawing is enabled, false otherwise */ virtual bool isDrawBackgroundEnabled() const _IRR_OVERRIDE_; - //! Writes attributes of the object. - //! Implement this to expose the attributes of your scene node animator for - //! scripting languages, editors, debuggers or xml serialization purposes. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the object. - //! Implement this to set the attributes of your scene node animator for - //! scripting languages, editors, debuggers or xml deserialization purposes. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - protected: void refreshControls(); void checkScrollbars(); diff --git a/source/Irrlicht/CGUIWindow.cpp b/source/Irrlicht/CGUIWindow.cpp index 97697506..1af2d153 100644 --- a/source/Irrlicht/CGUIWindow.cpp +++ b/source/Irrlicht/CGUIWindow.cpp @@ -356,47 +356,6 @@ core::rect CGUIWindow::getClientRect() const return ClientRect; } - -//! Writes attributes of the element. -void CGUIWindow::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const -{ - IGUIWindow::serializeAttributes(out,options); - - out->addBool("IsDraggable", IsDraggable); - out->addBool("DrawBackground", DrawBackground); - out->addBool("DrawTitlebar", DrawTitlebar); - - // Currently we can't just serialize attributes of sub-elements. - // To do this we either - // a) allow further serialization after attribute serialiation (second function, callback or event) - // b) add an IGUIElement attribute - // c) extend the attribute system to allow attributes to have sub-attributes - // We just serialize the most important info for now until we can do one of the above solutions. - out->addBool("IsCloseVisible", CloseButton->isVisible()); - out->addBool("IsMinVisible", MinButton->isVisible()); - out->addBool("IsRestoreVisible", RestoreButton->isVisible()); -} - - -//! Reads attributes of the element -void CGUIWindow::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) -{ -IGUIWindow::deserializeAttributes(in,options); - - Dragging = false; - IsActive = false; - IsDraggable = in->getAttributeAsBool("IsDraggable"); - DrawBackground = in->getAttributeAsBool("DrawBackground"); - DrawTitlebar = in->getAttributeAsBool("DrawTitlebar"); - - CloseButton->setVisible(in->getAttributeAsBool("IsCloseVisible")); - MinButton->setVisible(in->getAttributeAsBool("IsMinVisible")); - RestoreButton->setVisible(in->getAttributeAsBool("IsRestoreVisible")); - - updateClientRect(); -} - - } // end namespace gui } // end namespace irr diff --git a/source/Irrlicht/CGUIWindow.h b/source/Irrlicht/CGUIWindow.h index 8fb4bb24..3024295f 100644 --- a/source/Irrlicht/CGUIWindow.h +++ b/source/Irrlicht/CGUIWindow.h @@ -66,12 +66,6 @@ namespace gui //! Returns the rectangle of the drawable area (without border and without titlebar) virtual core::rect getClientRect() const _IRR_OVERRIDE_; - //! Writes attributes of the element. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; - - //! Reads attributes of the element - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; - protected: void updateClientRect(); diff --git a/source/Irrlicht/CMeshSceneNode.cpp b/source/Irrlicht/CMeshSceneNode.cpp index 0f5abd6b..1331ddae 100644 --- a/source/Irrlicht/CMeshSceneNode.cpp +++ b/source/Irrlicht/CMeshSceneNode.cpp @@ -170,8 +170,8 @@ void CMeshSceneNode::render() if (DebugDataVisible & scene::EDS_NORMALS) { // draw normals - const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH); - const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR); + const f32 debugNormalLength = 1.f; + const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221); const u32 count = Mesh->getMeshBufferCount(); for (u32 i=0; i != count; ++i) @@ -276,75 +276,6 @@ void CMeshSceneNode::copyMaterials() } -//! Writes attributes of the scene node. -void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - IMeshSceneNode::serializeAttributes(out, options); - - if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename) - { - const io::path path = SceneManager->getFileSystem()->getRelativeFilename( - SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()), - options->Filename); - out->addString("Mesh", path.c_str()); - } - else - out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str()); - out->addBool("ReadOnlyMaterials", ReadOnlyMaterials); -} - - -//! Reads attributes of the scene node. -void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh); - io::path newMeshStr = in->getAttributeAsString("Mesh"); - ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials"); - - if (newMeshStr != "" && oldMeshStr != newMeshStr) - { - IMesh* newMesh = 0; - IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str()); - - if (newAnimatedMesh) - newMesh = newAnimatedMesh->getMesh(0); - - if (newMesh) - setMesh(newMesh); - } - - // optional attribute to assign the hint to the whole mesh - if (in->existsAttribute("HardwareMappingHint") && - in->existsAttribute("HardwareMappingBufferType")) - { - scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER; - scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE; - - core::stringc smapping = in->getAttributeAsString("HardwareMappingHint"); - if (smapping.equals_ignore_case("static")) - mapping = scene::EHM_STATIC; - else if (smapping.equals_ignore_case("dynamic")) - mapping = scene::EHM_DYNAMIC; - else if (smapping.equals_ignore_case("stream")) - mapping = scene::EHM_STREAM; - - core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType"); - if (sbufferType.equals_ignore_case("vertex")) - bufferType = scene::EBT_VERTEX; - else if (sbufferType.equals_ignore_case("index")) - bufferType = scene::EBT_INDEX; - else if (sbufferType.equals_ignore_case("vertexindex")) - bufferType = scene::EBT_VERTEX_AND_INDEX; - - IMesh* mesh = getMesh(); - if (mesh) - mesh->setHardwareMappingHint(mapping, bufferType); - } - - IMeshSceneNode::deserializeAttributes(in, options); -} - - //! 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 referencing this mesh to change too. */ diff --git a/source/Irrlicht/CMeshSceneNode.h b/source/Irrlicht/CMeshSceneNode.h index 4da820b2..99e1da34 100644 --- a/source/Irrlicht/CMeshSceneNode.h +++ b/source/Irrlicht/CMeshSceneNode.h @@ -45,12 +45,6 @@ namespace scene //! returns amount of materials used by this scene node. virtual u32 getMaterialCount() const _IRR_OVERRIDE_; - //! Writes attributes of the scene node. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the scene node. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_MESH; } diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index da647797..71fc9a8e 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -14,7 +14,7 @@ #include "IAnimatedMeshSceneNode.h" #include "CMeshManipulator.h" #include "CColorConverter.h" -#include "IAttributeExchangingObject.h" +#include "IReferenceCounted.h" #include "IRenderTarget.h" @@ -2000,193 +2000,6 @@ void CNullDriver::swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames) } } -//! Creates material attributes list from a material, usable for serialization and more. -io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMaterial& material, - io::SAttributeReadWriteOptions* options) -{ - io::CAttributes* attr = new io::CAttributes(this); - - attr->addEnum("Type", material.MaterialType, sBuiltInMaterialTypeNames); - - attr->addColor("Ambient", material.AmbientColor); - attr->addColor("Diffuse", material.DiffuseColor); - attr->addColor("Emissive", material.EmissiveColor); - attr->addColor("Specular", material.SpecularColor); - - attr->addFloat("Shininess", material.Shininess); - attr->addFloat("Param1", material.MaterialTypeParam); - attr->addFloat("Param2", material.MaterialTypeParam2); - attr->addFloat("Thickness", material.Thickness); - - core::stringc prefix="Texture"; - u32 i; - for (i=0; iFlags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename && texture) - { - io::path path = FileSystem->getRelativeFilename( - FileSystem->getAbsolutePath(material.getTexture(i)->getName()), options->Filename); - attr->addTexture((prefix+core::stringc(i+1)).c_str(), material.getTexture(i), path); - } - else - { - attr->addTexture((prefix+core::stringc(i+1)).c_str(), texture); - } - } - - attr->addBool("Wireframe", material.Wireframe); - attr->addBool("PointCloud", material.PointCloud); - attr->addBool("GouraudShading", material.GouraudShading); - attr->addBool("Lighting", material.Lighting); - attr->addEnum("ZWriteEnable", (irr::s32)material.ZWriteEnable, video::ZWriteNames); - attr->addInt("ZBuffer", material.ZBuffer); - attr->addBool("BackfaceCulling", material.BackfaceCulling); - attr->addBool("FrontfaceCulling", material.FrontfaceCulling); - attr->addBool("FogEnable", material.FogEnable); - attr->addBool("NormalizeNormals", material.NormalizeNormals); - attr->addBool("UseMipMaps", material.UseMipMaps); - attr->addInt("AntiAliasing", material.AntiAliasing); - attr->addInt("ColorMask", material.ColorMask); - attr->addInt("ColorMaterial", material.ColorMaterial); - attr->addInt("BlendOperation", material.BlendOperation); - attr->addFloat("BlendFactor", material.BlendFactor); - attr->addInt("PolygonOffsetFactor", material.PolygonOffsetFactor); - attr->addEnum("PolygonOffsetDirection", material.PolygonOffsetDirection, video::PolygonOffsetDirectionNames); - attr->addFloat("PolygonOffsetDepthBias", material.PolygonOffsetDepthBias); - attr->addFloat("PolygonOffsetSlopeScale", material.PolygonOffsetSlopeScale); - - // TODO: Would be nice to have a flag that only serializes rest of texture data when a texture pointer exists. - prefix = "BilinearFilter"; - for (i=0; iaddBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].BilinearFilter); - prefix = "TrilinearFilter"; - for (i=0; iaddBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter); - prefix = "AnisotropicFilter"; - for (i=0; iaddInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter); - prefix="TextureWrapU"; - for (i=0; iaddEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapU, aTextureClampNames); - prefix="TextureWrapV"; - for (i=0; iaddEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapV, aTextureClampNames); - prefix="TextureWrapW"; - for (i=0; iaddEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapW, aTextureClampNames); - prefix="LODBias"; - for (i=0; iaddInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].LODBias); - - return attr; -} - - -//! Fills an SMaterial structure from attributes. -void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attr) -{ - outMaterial.MaterialType = video::EMT_SOLID; - - core::stringc name = attr->getAttributeAsString("Type"); - - u32 i; - - for ( i=0; i < MaterialRenderers.size(); ++i) - if ( name == MaterialRenderers[i].Name ) - { - outMaterial.MaterialType = (video::E_MATERIAL_TYPE)i; - break; - } - - outMaterial.AmbientColor = attr->getAttributeAsColor("Ambient", outMaterial.AmbientColor); - outMaterial.DiffuseColor = attr->getAttributeAsColor("Diffuse", outMaterial.DiffuseColor); - outMaterial.EmissiveColor = attr->getAttributeAsColor("Emissive", outMaterial.EmissiveColor); - outMaterial.SpecularColor = attr->getAttributeAsColor("Specular", outMaterial.SpecularColor); - - outMaterial.Shininess = attr->getAttributeAsFloat("Shininess", outMaterial.Shininess); - outMaterial.MaterialTypeParam = attr->getAttributeAsFloat("Param1", outMaterial.MaterialTypeParam); - outMaterial.MaterialTypeParam2 = attr->getAttributeAsFloat("Param2", outMaterial.MaterialTypeParam2); - outMaterial.Thickness = attr->getAttributeAsFloat("Thickness", outMaterial.Thickness); - - core::stringc prefix="Texture"; - for (i=0; igetAttributeAsTexture((prefix+core::stringc(i+1)).c_str())); - - outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe", outMaterial.Wireframe); - outMaterial.PointCloud = attr->getAttributeAsBool("PointCloud", outMaterial.PointCloud); - outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading", outMaterial.GouraudShading); - outMaterial.Lighting = attr->getAttributeAsBool("Lighting", outMaterial.Lighting); - - io::E_ATTRIBUTE_TYPE attType = attr->getAttributeType("ZWriteEnable"); - if (attType == io::EAT_BOOL ) // Before Irrlicht 1.9 - outMaterial.ZWriteEnable = attr->getAttributeAsBool("ZWriteEnable", outMaterial.ZWriteEnable != video::EZW_OFF ) ? video::EZW_AUTO : video::EZW_OFF; - else if (attType == io::EAT_ENUM ) - outMaterial.ZWriteEnable = (video::E_ZWRITE)attr->getAttributeAsEnumeration("ZWriteEnable", video::ZWriteNames, outMaterial.ZWriteEnable); - - outMaterial.ZBuffer = (u8)attr->getAttributeAsInt("ZBuffer", outMaterial.ZBuffer); - outMaterial.BackfaceCulling = attr->getAttributeAsBool("BackfaceCulling", outMaterial.BackfaceCulling); - outMaterial.FrontfaceCulling = attr->getAttributeAsBool("FrontfaceCulling", outMaterial.FrontfaceCulling); - outMaterial.FogEnable = attr->getAttributeAsBool("FogEnable", outMaterial.FogEnable); - outMaterial.NormalizeNormals = attr->getAttributeAsBool("NormalizeNormals", outMaterial.NormalizeNormals); - outMaterial.UseMipMaps = attr->getAttributeAsBool("UseMipMaps", outMaterial.UseMipMaps); - - outMaterial.AntiAliasing = attr->getAttributeAsInt("AntiAliasing", outMaterial.AntiAliasing); - outMaterial.ColorMask = attr->getAttributeAsInt("ColorMask", outMaterial.ColorMask); - outMaterial.ColorMaterial = attr->getAttributeAsInt("ColorMaterial", outMaterial.ColorMaterial); - outMaterial.BlendOperation = (video::E_BLEND_OPERATION)attr->getAttributeAsInt("BlendOperation", outMaterial.BlendOperation); - outMaterial.BlendFactor = attr->getAttributeAsFloat("BlendFactor", outMaterial.BlendFactor); - outMaterial.PolygonOffsetFactor = attr->getAttributeAsInt("PolygonOffsetFactor", outMaterial.PolygonOffsetFactor); - outMaterial.PolygonOffsetDirection = (video::E_POLYGON_OFFSET)attr->getAttributeAsEnumeration("PolygonOffsetDirection", video::PolygonOffsetDirectionNames, outMaterial.PolygonOffsetDirection); - outMaterial.PolygonOffsetDepthBias = attr->getAttributeAsFloat("PolygonOffsetDepthBias", outMaterial.PolygonOffsetDepthBias); - outMaterial.PolygonOffsetSlopeScale = attr->getAttributeAsFloat("PolygonOffsetSlopeScale", outMaterial.PolygonOffsetSlopeScale); - - prefix = "BilinearFilter"; - if (attr->existsAttribute(prefix.c_str())) // legacy - outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str())); - else - for (i=0; igetAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].BilinearFilter); - - prefix = "TrilinearFilter"; - if (attr->existsAttribute(prefix.c_str())) // legacy - outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str())); - else - for (i=0; igetAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].TrilinearFilter); - - prefix = "AnisotropicFilter"; - if (attr->existsAttribute(prefix.c_str())) // legacy - outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str())); - else - for (i=0; igetAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].AnisotropicFilter); - - prefix = "TextureWrap"; - if (attr->existsAttribute(prefix.c_str())) // legacy - { - for (i=0; igetAttributeAsEnumeration((prefix+core::stringc(i+1)).c_str(), aTextureClampNames); - outMaterial.TextureLayer[i].TextureWrapV = outMaterial.TextureLayer[i].TextureWrapU; - outMaterial.TextureLayer[i].TextureWrapW = outMaterial.TextureLayer[i].TextureWrapW; - } - } - else - { - for (i=0; igetAttributeAsEnumeration((prefix+"U"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapU); - outMaterial.TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"V"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapV); - outMaterial.TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"W"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapW); - } - } - - prefix="LODBias"; - for (i=0; igetAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].LODBias); -} - //! Returns driver and operating system specific data about the IVideoDriver. const SExposedVideoData& CNullDriver::getExposedVideoData() diff --git a/source/Irrlicht/CNullDriver.h b/source/Irrlicht/CNullDriver.h index c9e5e7c9..90a80554 100644 --- a/source/Irrlicht/CNullDriver.h +++ b/source/Irrlicht/CNullDriver.h @@ -617,13 +617,6 @@ namespace video //! Swap the material renderers used for certain id's virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames) _IRR_OVERRIDE_; - //! Creates material attributes list from a material, usable for serialization and more. - virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material, - io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - - //! Fills an SMaterial structure from attributes. - virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) _IRR_OVERRIDE_; - //! looks if the image is already loaded virtual video::ITexture* findTexture(const io::path& filename) _IRR_OVERRIDE_; diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 3223f4e0..e0a20841 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -8,12 +8,10 @@ #include "IFileSystem.h" #include "SAnimatedMesh.h" #include "CMeshCache.h" -#include "ISceneUserDataSerializer.h" #include "IGUIEnvironment.h" #include "IMaterialRenderer.h" #include "IReadFile.h" #include "IWriteFile.h" -#include "ISceneLoader.h" #include "EProfileIDs.h" #include "IProfiler.h" @@ -92,8 +90,6 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, // set scene parameters Parameters = new io::CAttributes(); - Parameters->setAttribute(DEBUG_NORMAL_LENGTH, 1.f); - Parameters->setAttribute(DEBUG_NORMAL_COLOR, video::SColor(255, 34, 221, 221)); // create collision manager CollisionManager = new CSceneCollisionManager(this, Driver); @@ -167,9 +163,6 @@ CSceneManager::~CSceneManager() for (i=0; idrop(); - for (i=0; idrop(); - if (ActiveCamera) ActiveCamera->drop(); ActiveCamera = 0; @@ -700,7 +693,7 @@ void CSceneManager::drawAll() CameraList.set_used(0); } - + // render skyboxes { IRR_PROFILE(CProfileScope psSkyBox(EPID_SM_RENDER_SKYBOXES);) @@ -712,7 +705,7 @@ void CSceneManager::drawAll() SkyBoxList.set_used(0); } - + // render default objects { IRR_PROFILE(CProfileScope psDefault(EPID_SM_RENDER_DEFAULT);) @@ -809,33 +802,6 @@ IMeshLoader* CSceneManager::getMeshLoader(u32 index) const } -//! Adds an external scene loader. -void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader) -{ - if (!externalLoader) - return; - - externalLoader->grab(); - SceneLoaderList.push_back(externalLoader); -} - - -//! Returns the number of scene loaders -u32 CSceneManager::getSceneLoaderCount() const -{ - return SceneLoaderList.size(); -} - - -//! Retrieve the given scene loader -ISceneLoader* CSceneManager::getSceneLoader(u32 index) const -{ - if (index < SceneLoaderList.size()) - return SceneLoaderList[index]; - else - return 0; -} - //! Returns a pointer to the scene collision manager. ISceneCollisionManager* CSceneManager::getSceneCollisionManager() { @@ -1066,72 +1032,6 @@ ISceneNodeFactory* CSceneManager::getSceneNodeFactory(u32 index) return 0; } -//! Saves the current scene into a file. -//! \param filename: Name of the file . -bool CSceneManager::saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node) -{ - bool ret = false; - io::IWriteFile* file = FileSystem->createAndWriteFile(filename); - if (file) - { - ret = saveScene(file, userDataSerializer, node); - file->drop(); - } - else - os::Printer::log("Unable to open file", filename, ELL_ERROR); - - return ret; -} - - -//! Saves the current scene into a file. -bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node) -{ - return false; -} - - -//! Loads a scene. -bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode) -{ - io::IReadFile* file = FileSystem->createAndOpenFile(filename); - if (!file) - { - os::Printer::log("Unable to open scene file", filename.c_str(), ELL_ERROR); - return false; - } - - const bool ret = loadScene(file, userDataSerializer, rootNode); - file->drop(); - - return ret; -} - - -//! Loads a scene. Note that the current scene is not cleared before. -bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode) -{ - if (!file) - { - os::Printer::log("Unable to open scene file", ELL_ERROR); - return false; - } - - bool ret = false; - - // try scene loaders in reverse order - s32 i = SceneLoaderList.size()-1; - for (; i >= 0 && !ret; --i) - if (SceneLoaderList[i]->isALoadableFileFormat(file)) - ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode); - - if (!ret) - os::Printer::log("Could not load scene file, perhaps the format is unsupported: ", file->getFileName().c_str(), ELL_ERROR); - - return ret; -} - - //! Returns a typename from a scene node type or null if not found const c8* CSceneManager::getSceneNodeTypeName(ESCENE_NODE_TYPE type) { @@ -1154,66 +1054,6 @@ ISceneNode* CSceneManager::addSceneNode(const char* sceneNodeTypeName, ISceneNod return node; } -//! Writes attributes of the scene node. -void CSceneManager::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const -{ - out->addString ("Name", Name.c_str()); - out->addInt ("Id", ID ); - out->addColorf ("AmbientLight", AmbientLight); - - // fog attributes from video driver - video::SColor color; - video::E_FOG_TYPE fogType; - f32 start, end, density; - bool pixelFog, rangeFog; - - Driver->getFog(color, fogType, start, end, density, pixelFog, rangeFog); - - out->addEnum("FogType", fogType, video::FogTypeNames); - out->addColorf("FogColor", color); - out->addFloat("FogStart", start); - out->addFloat("FogEnd", end); - out->addFloat("FogDensity", density); - out->addBool("FogPixel", pixelFog); - out->addBool("FogRange", rangeFog); -} - -//! Reads attributes of the scene node. -void CSceneManager::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) -{ - Name = in->getAttributeAsString("Name"); - ID = in->getAttributeAsInt("Id"); - AmbientLight = in->getAttributeAsColorf("AmbientLight"); - - // fog attributes - video::SColor color; - video::E_FOG_TYPE fogType; - f32 start, end, density; - bool pixelFog, rangeFog; - if (in->existsAttribute("FogType")) - { - fogType = (video::E_FOG_TYPE) in->getAttributeAsEnumeration("FogType", video::FogTypeNames); - color = in->getAttributeAsColorf("FogColor").toSColor(); - start = in->getAttributeAsFloat("FogStart"); - end = in->getAttributeAsFloat("FogEnd"); - density = in->getAttributeAsFloat("FogDensity"); - pixelFog = in->getAttributeAsBool("FogPixel"); - rangeFog = in->getAttributeAsBool("FogRange"); - Driver->setFog(color, fogType, start, end, density, pixelFog, rangeFog); - } - - RelativeTranslation.set(0,0,0); - RelativeRotation.set(0,0,0); - RelativeScale.set(1,1,1); - IsVisible = true; - AutomaticCullingState = scene::EAC_BOX; - DebugDataVisible = scene::EDS_OFF; - IsDebugObject = false; - - updateAbsolutePosition(); -} - - //! Sets ambient color of the scene void CSceneManager::setAmbientLight(const video::SColorf &ambientColor) { diff --git a/source/Irrlicht/CSceneManager.h b/source/Irrlicht/CSceneManager.h index e7e6ce35..dcad7279 100644 --- a/source/Irrlicht/CSceneManager.h +++ b/source/Irrlicht/CSceneManager.h @@ -137,15 +137,6 @@ namespace scene //! Retrieve the given mesh loader virtual IMeshLoader* getMeshLoader(u32 index) const _IRR_OVERRIDE_; - //! Adds an external scene loader. - virtual void addExternalSceneLoader(ISceneLoader* externalLoader) _IRR_OVERRIDE_; - - //! Returns the number of scene loaders supported by Irrlicht at this time - virtual u32 getSceneLoaderCount() const _IRR_OVERRIDE_; - - //! Retrieve the given scene loader - virtual ISceneLoader* getSceneLoader(u32 index) const _IRR_OVERRIDE_; - //! Returns a pointer to the scene collision manager. virtual ISceneCollisionManager* getSceneCollisionManager() _IRR_OVERRIDE_; @@ -209,24 +200,6 @@ namespace scene //! Adds a scene node to the scene by name virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) _IRR_OVERRIDE_; - //! Saves the current scene into a file. - virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) _IRR_OVERRIDE_; - - //! Saves the current scene into a file. - virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) _IRR_OVERRIDE_; - - //! Loads a scene. Note that the current scene is not cleared before. - virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) _IRR_OVERRIDE_; - - //! Loads a scene. Note that the current scene is not cleared before. - virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) _IRR_OVERRIDE_; - - //! Writes attributes of the scene node. - virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_; - - //! Reads attributes of the scene node. - virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_; - //! Returns a mesh writer implementation if available virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) _IRR_OVERRIDE_; @@ -344,7 +317,6 @@ namespace scene core::array GuiNodeList; core::array MeshLoaderList; - core::array SceneLoaderList; core::array DeletionList; core::array SceneNodeFactoryList; diff --git a/source/Irrlicht/IAttribute.h b/source/Irrlicht/IAttribute.h index 554ca951..28577aea 100644 --- a/source/Irrlicht/IAttribute.h +++ b/source/Irrlicht/IAttribute.h @@ -48,61 +48,11 @@ public: virtual s32 getInt() const { return 0; } virtual f32 getFloat() const { return 0; } - virtual video::SColorf getColorf() const { return video::SColorf(1.0f,1.0f,1.0f,1.0f); } - virtual video::SColor getColor() const { return video::SColor(255,255,255,255); } - virtual core::stringc getString() const { return core::stringc(getStringW().c_str()); } - virtual core::stringw getStringW() const { return core::stringw(); } - virtual core::array getArray() const { return core::array(); }; virtual bool getBool() const { return false; } - virtual void getBinary(void* outdata, s32 maxLength) const {}; - virtual core::vector3df getVector() const { return core::vector3df(); } - virtual core::position2di getPosition() const { return core::position2di(); } - virtual core::rect getRect() const { return core::rect(); } - virtual core::quaternion getQuaternion() const { return core::quaternion(); } - virtual core::matrix4 getMatrix() const { return core::matrix4(); } - virtual core::triangle3df getTriangle() const { return core::triangle3df(); } - virtual core::vector2df getVector2d() const { return core::vector2df(); } - virtual core::vector2di getVector2di() const { return core::vector2di(); } - virtual core::line2df getLine2d() const { return core::line2df(); } - virtual core::line2di getLine2di() const { return core::line2di(); } - virtual core::line3df getLine3d() const { return core::line3df(); } - virtual core::line3di getLine3di() const { return core::line3di(); } - virtual core::dimension2du getDimension2d() const { return core::dimension2du(); } - virtual core::aabbox3d getBBox() const { return core::aabbox3d(); } - virtual core::plane3df getPlane() const { return core::plane3df(); } - - virtual video::ITexture* getTexture() const { return 0; } - virtual const char* getEnum() const { return 0; } - virtual void* getUserPointer() const { return 0; } virtual void setInt(s32 intValue) {}; virtual void setFloat(f32 floatValue) {}; - virtual void setString(const char* text) {}; - virtual void setString(const wchar_t* text){ setString(core::stringc(text).c_str()); }; - virtual void setArray(const core::array& arr ) {}; - virtual void setColor(video::SColorf color) {}; - virtual void setColor(video::SColor color) {}; virtual void setBool(bool boolValue) {}; - virtual void setBinary(void* data, s32 maxLength) {}; - virtual void setVector(const core::vector3df& v) {}; - virtual void setPosition(const core::position2di& v) {}; - virtual void setRect(const core::rect& v) {}; - virtual void setQuaternion(const core::quaternion& v) {}; - virtual void setMatrix(const core::matrix4& v) {}; - virtual void setTriangle(const core::triangle3df& v) {}; - virtual void setVector2d(const core::vector2df& v) {}; - virtual void setVector2d(const core::vector2di& v) {}; - virtual void setLine2d(const core::line2df& v) {}; - virtual void setLine2d(const core::line2di& v) {}; - virtual void setLine3d(const core::line3df& v) {}; - virtual void setLine3d(const core::line3di& v) {}; - virtual void setDimension2d(const core::dimension2du& v) {}; - virtual void setBBox(const core::aabbox3d& v) {}; - virtual void setPlane(const core::plane3df& v) {}; - virtual void setUserPointer(void* v) {}; - - virtual void setEnum(const char* enumValue, const char* const* enumerationLiterals) {}; - virtual void setTexture(video::ITexture*, const path& filename) {}; core::stringc Name;