+++ /dev/null
-// Copyright (C) 2002-2012 Nikolaus Gebhardt\r
-// This file is part of the "Irrlicht Engine".\r
-// For conditions of distribution and use, see copyright notice in irrlicht.h\r
-\r
-#ifndef __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__\r
-#define __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__\r
-\r
-#include "IReferenceCounted.h"\r
-\r
-\r
-namespace irr\r
-{\r
-\r
-namespace io\r
-{\r
-\r
-class IAttributes;\r
-\r
-//! Enumeration flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object\r
-enum E_ATTRIBUTE_READ_WRITE_FLAGS\r
-{\r
- //! Serialization/Deserializion is done for an xml file\r
- EARWF_FOR_FILE = 0x00000001,\r
-\r
- //! Serialization/Deserializion is done for an editor property box\r
- EARWF_FOR_EDITOR = 0x00000002,\r
-\r
- //! When writing filenames, relative paths should be used\r
- EARWF_USE_RELATIVE_PATHS = 0x00000004\r
-};\r
-\r
-\r
-//! struct holding data describing options\r
-struct SAttributeReadWriteOptions\r
-{\r
- //! Constructor\r
- SAttributeReadWriteOptions()\r
- : Flags(0), Filename(0)\r
- {\r
- }\r
-\r
- //! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones\r
- s32 Flags;\r
-\r
- //! Optional filename\r
- const fschar_t* Filename;\r
-};\r
-\r
-\r
-//! An object which is able to serialize and deserialize its attributes into an attributes object\r
-class IAttributeExchangingObject : virtual public IReferenceCounted\r
-{\r
-public:\r
-\r
- //! Writes attributes of the object.\r
- /** Implement this to expose the attributes of your scene node animator for\r
- scripting languages, editors, debuggers or xml serialization purposes. */\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}\r
-\r
- //! Reads attributes of the object.\r
- /** Implement this to set the attributes of your scene node animator for\r
- scripting languages, editors, debuggers or xml deserialization purposes. */\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) {}\r
-\r
-};\r
-\r
-} // end namespace io\r
-} // end namespace irr\r
-\r
-#endif\r
-\r
//! Sets an attribute as float value\r
virtual void setAttribute(s32 index, f32 value) = 0;\r
\r
- /*\r
-\r
- String Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as string\r
- virtual void addString(const c8* attributeName, const c8* value) = 0;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param attributeName: Name for the attribute\r
- //! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
- virtual void setAttribute(const c8* attributeName, const c8* value) = 0;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- //! or defaultNotFound if attribute is not set.\r
- virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) const = 0;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName Name of the attribute to get.\r
- //! \param target Buffer where the string is copied to.\r
- virtual void getAttributeAsString(const c8* attributeName, c8* target) const = 0;\r
-\r
- //! Returns attribute value as string by index.\r
- //! \param index Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::stringc getAttributeAsString(s32 index) const = 0;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param index Index value, must be between 0 and getAttributeCount()-1.\r
- //! \param value String to which the attribute is set.\r
- virtual void setAttribute(s32 index, const c8* value) = 0;\r
-\r
- // wide strings\r
-\r
- //! Adds an attribute as string\r
- virtual void addString(const c8* attributeName, const wchar_t* value) = 0;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param attributeName: Name for the attribute\r
- //! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
- virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- //! or defaultNotFound if attribute is not set.\r
- virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) const = 0;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param target: Buffer where the string is copied to.\r
- virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) const = 0;\r
-\r
- //! Returns attribute value as string by index.\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::stringw getAttributeAsStringW(s32 index) const = 0;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param index Index value, must be between 0 and getAttributeCount()-1.\r
- //! \param value String to which the attribute is set.\r
- virtual void setAttribute(s32 index, const wchar_t* value) = 0;\r
\r
/*\r
-\r
- Binary Data Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as binary data\r
- virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0;\r
-\r
- //! Sets an attribute as binary data\r
- virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;\r
-\r
- //! Gets an attribute as binary data\r
- /** \param attributeName: Name of the attribute to get.\r
- \param outData Pointer to buffer where data shall be stored.\r
- \param maxSizeInBytes Maximum number of bytes to write into outData.\r
- */\r
- virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const = 0;\r
-\r
- //! Gets an attribute as binary data\r
- /** \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- \param outData Pointer to buffer where data shall be stored.\r
- \param maxSizeInBytes Maximum number of bytes to write into outData.\r
- */\r
- virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const = 0;\r
-\r
- //! Sets an attribute as binary data\r
- virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0;\r
-\r
-\r
- /*\r
- Array Attribute\r
- */\r
-\r
- //! Adds an attribute as wide string array\r
- virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) = 0;\r
-\r
- //! Sets an attribute value as a wide string array.\r
- //! \param attributeName: Name for the attribute\r
- //! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
- virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) = 0;\r
-\r
- //! Gets an attribute as an array of wide strings.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- //! or defaultNotFound if attribute is not set.\r
- virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound = core::array<core::stringw>()) const = 0;\r
-\r
- //! Returns attribute value as an array of wide strings by index.\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::array<core::stringw> getAttributeAsArray(s32 index) const = 0;\r
-\r
- //! Sets an attribute as an array of wide strings\r
- virtual void setAttribute(s32 index, const core::array<core::stringw>& value) = 0;\r
-\r
-\r
- /*\r
-\r
Bool Attribute\r
-\r
*/\r
\r
//! Adds an attribute as bool\r
//! Sets an attribute as boolean value\r
virtual void setAttribute(s32 index, bool value) = 0;\r
\r
- /*\r
-\r
- Enumeration Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as enum\r
- virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;\r
-\r
- //! Adds an attribute as enum\r
- virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0;\r
-\r
- //! Sets an attribute as enumeration\r
- virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;\r
-\r
- //! Gets an attribute as enumeration\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) const = 0;\r
-\r
- //! Gets an attribute as enumeration\r
- /** \param attributeName: Name of the attribute to get.\r
- \param enumerationLiteralsToUse: Use these enumeration literals to get\r
- the index value instead of the set ones. This is useful when the\r
- attribute list maybe was read from an xml file, and only contains the\r
- enumeration string, but no information about its index.\r
- \return Returns value of the attribute previously set by setAttribute()\r
- */\r
- virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;\r
-\r
- //! Gets an attribute as enumeration\r
- /** \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- \param enumerationLiteralsToUse: Use these enumeration literals to get\r
- the index value instead of the set ones. This is useful when the\r
- attribute list maybe was read from an xml file, and only contains the\r
- enumeration string, but no information about its index.\r
- \param defaultNotFound Value returned when the attribute referenced by the index was not found.\r
- \return Returns value of the attribute previously set by setAttribute()\r
- */\r
- virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;\r
-\r
- //! Gets an attribute as enumeration\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual const c8* getAttributeAsEnumeration(s32 index) const = 0;\r
-\r
- //! Gets the list of enumeration literals of an enumeration attribute\r
- //! \param attributeName Name of the attribute to get.\r
- //! \param outLiterals Set of strings to choose the enum name from.\r
- virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) const = 0;\r
-\r
- //! Gets the list of enumeration literals of an enumeration attribute\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- //! \param outLiterals Set of strings to choose the enum name from.\r
- virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) const = 0;\r
-\r
- //! Sets an attribute as enumeration\r
- virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0;\r
-\r
-\r
- /*\r
-\r
- SColor Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as color\r
- virtual void addColor(const c8* attributeName, video::SColor value) = 0;\r
-\r
-\r
- //! Sets a attribute as color\r
- virtual void setAttribute(const c8* attributeName, video::SColor color) = 0;\r
-\r
- //! Gets an attribute as color\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) const = 0;\r
-\r
- //! Gets an attribute as color\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual video::SColor getAttributeAsColor(s32 index) const = 0;\r
-\r
- //! Sets an attribute as color\r
- virtual void setAttribute(s32 index, video::SColor color) = 0;\r
-\r
- /*\r
-\r
- SColorf Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as floating point color\r
- virtual void addColorf(const c8* attributeName, video::SColorf value) = 0;\r
-\r
- //! Sets a attribute as floating point color\r
- virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0;\r
-\r
- //! Gets an attribute as floating point color\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) const = 0;\r
-\r
- //! Gets an attribute as floating point color\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual video::SColorf getAttributeAsColorf(s32 index) const = 0;\r
-\r
- //! Sets an attribute as floating point color\r
- virtual void setAttribute(s32 index, video::SColorf color) = 0;\r
-\r
-\r
- /*\r
-\r
- Vector3d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as 3d vector\r
- virtual void addVector3d(const c8* attributeName, const core::vector3df& value) = 0;\r
-\r
- //! Sets a attribute as 3d vector\r
- virtual void setAttribute(const c8* attributeName, const core::vector3df& v) = 0;\r
-\r
- //! Gets an attribute as 3d vector\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) const = 0;\r
-\r
- //! Gets an attribute as 3d vector\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::vector3df getAttributeAsVector3d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as vector\r
- virtual void setAttribute(s32 index, const core::vector3df& v) = 0;\r
-\r
- /*\r
-\r
- Vector2d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as 2d vector\r
- virtual void addVector2d(const c8* attributeName, const core::vector2df& value) = 0;\r
-\r
- //! Sets a attribute as 2d vector\r
- virtual void setAttribute(const c8* attributeName, const core::vector2df& v) = 0;\r
-\r
- //! Gets an attribute as vector\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) const = 0;\r
-\r
- //! Gets an attribute as position\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::vector2df getAttributeAsVector2d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as 2d vector\r
- virtual void setAttribute(s32 index, const core::vector2df& v) = 0;\r
-\r
- /*\r
-\r
- Position2d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as 2d position\r
- virtual void addPosition2d(const c8* attributeName, const core::position2di& value) = 0;\r
-\r
- //! Sets a attribute as 2d position\r
- virtual void setAttribute(const c8* attributeName, const core::position2di& v) = 0;\r
-\r
- //! Gets an attribute as position\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) const = 0;\r
-\r
- //! Gets an attribute as position\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::position2di getAttributeAsPosition2d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as 2d position\r
- virtual void setAttribute(s32 index, const core::position2di& v) = 0;\r
-\r
- /*\r
-\r
- Rectangle Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as rectangle\r
- virtual void addRect(const c8* attributeName, const core::rect<s32>& value) = 0;\r
-\r
- //! Sets an attribute as rectangle\r
- virtual void setAttribute(const c8* attributeName, const core::rect<s32>& v) = 0;\r
-\r
- //! Gets an attribute as rectangle\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::rect<s32> getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound = core::rect<s32>()) const = 0;\r
-\r
- //! Gets an attribute as rectangle\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::rect<s32> getAttributeAsRect(s32 index) const = 0;\r
-\r
- //! Sets an attribute as rectangle\r
- virtual void setAttribute(s32 index, const core::rect<s32>& v) = 0;\r
-\r
-\r
- /*\r
-\r
- Dimension2d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as dimension2d\r
- virtual void addDimension2d(const c8* attributeName, const core::dimension2d<u32>& value) = 0;\r
-\r
- //! Sets an attribute as dimension2d\r
- virtual void setAttribute(const c8* attributeName, const core::dimension2d<u32>& v) = 0;\r
-\r
- //! Gets an attribute as dimension2d\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound = core::dimension2d<u32>()) const = 0;\r
-\r
- //! Gets an attribute as dimension2d\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as dimension2d\r
- virtual void setAttribute(s32 index, const core::dimension2d<u32>& v) = 0;\r
-\r
-\r
- /*\r
- matrix attribute\r
- */\r
-\r
- //! Adds an attribute as matrix\r
- virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0;\r
-\r
- //! Sets an attribute as matrix\r
- virtual void setAttribute(const c8* attributeName, const core::matrix4& v) = 0;\r
-\r
- //! Gets an attribute as a matrix4\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) const = 0;\r
-\r
- //! Gets an attribute as matrix\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::matrix4 getAttributeAsMatrix(s32 index) const = 0;\r
-\r
- //! Sets an attribute as matrix\r
- virtual void setAttribute(s32 index, const core::matrix4& v) = 0;\r
-\r
- /*\r
- quaternion attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as quaternion\r
- virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) = 0;\r
-\r
- //! Sets an attribute as quaternion\r
- virtual void setAttribute(const c8* attributeName, const core::quaternion& v) = 0;\r
-\r
- //! Gets an attribute as a quaternion\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) const = 0;\r
-\r
- //! Gets an attribute as quaternion\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::quaternion getAttributeAsQuaternion(s32 index) const = 0;\r
-\r
- //! Sets an attribute as quaternion\r
- virtual void setAttribute(s32 index, const core::quaternion& v) = 0;\r
-\r
- /*\r
-\r
- 3d bounding box\r
-\r
- */\r
-\r
- //! Adds an attribute as axis aligned bounding box\r
- virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) = 0;\r
-\r
- //! Sets an attribute as axis aligned bounding box\r
- virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) = 0;\r
-\r
- //! Gets an attribute as a axis aligned bounding box\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) const = 0;\r
-\r
- //! Gets an attribute as axis aligned bounding box\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::aabbox3df getAttributeAsBox3d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as axis aligned bounding box\r
- virtual void setAttribute(s32 index, const core::aabbox3df& v) = 0;\r
-\r
- /*\r
-\r
- plane\r
-\r
- */\r
-\r
- //! Adds an attribute as 3d plane\r
- virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) = 0;\r
-\r
- //! Sets an attribute as 3d plane\r
- virtual void setAttribute(const c8* attributeName, const core::plane3df& v) = 0;\r
-\r
- //! Gets an attribute as a 3d plane\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) const = 0;\r
-\r
- //! Gets an attribute as 3d plane\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::plane3df getAttributeAsPlane3d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as 3d plane\r
- virtual void setAttribute(s32 index, const core::plane3df& v) = 0;\r
-\r
-\r
- /*\r
-\r
- 3d triangle\r
-\r
- */\r
-\r
- //! Adds an attribute as 3d triangle\r
- virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) = 0;\r
-\r
- //! Sets an attribute as 3d trianle\r
- virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) = 0;\r
-\r
- //! Gets an attribute as a 3d triangle\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- 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;\r
-\r
- //! Gets an attribute as 3d triangle\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as 3d triangle\r
- virtual void setAttribute(s32 index, const core::triangle3df& v) = 0;\r
-\r
-\r
- /*\r
-\r
- line 2d\r
-\r
- */\r
-\r
- //! Adds an attribute as a 2d line\r
- virtual void addLine2d(const c8* attributeName, const core::line2df& v) = 0;\r
-\r
- //! Sets an attribute as a 2d line\r
- virtual void setAttribute(const c8* attributeName, const core::line2df& v) = 0;\r
-\r
- //! Gets an attribute as a 2d line\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) const = 0;\r
-\r
- //! Gets an attribute as a 2d line\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::line2df getAttributeAsLine2d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as a 2d line\r
- virtual void setAttribute(s32 index, const core::line2df& v) = 0;\r
-\r
-\r
- /*\r
-\r
- line 3d\r
-\r
- */\r
-\r
- //! Adds an attribute as a 3d line\r
- virtual void addLine3d(const c8* attributeName, const core::line3df& v) = 0;\r
-\r
- //! Sets an attribute as a 3d line\r
- virtual void setAttribute(const c8* attributeName, const core::line3df& v) = 0;\r
-\r
- //! Gets an attribute as a 3d line\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) const = 0;\r
-\r
- //! Gets an attribute as a 3d line\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::line3df getAttributeAsLine3d(s32 index) const = 0;\r
-\r
- //! Sets an attribute as a 3d line\r
- virtual void setAttribute(s32 index, const core::line3df& v) = 0;\r
-\r
-\r
- /*\r
-\r
- Texture Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as texture reference\r
- virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;\r
-\r
- //! Sets an attribute as texture reference\r
- virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;\r
-\r
- //! Gets an attribute as texture reference\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) const = 0;\r
-\r
- //! Gets an attribute as texture reference\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual video::ITexture* getAttributeAsTexture(s32 index) const = 0;\r
-\r
- //! Sets an attribute as texture reference\r
- virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") = 0;\r
-\r
-\r
- /*\r
-\r
- User Pointer Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as user pointer\r
- virtual void addUserPointer(const c8* attributeName, void* userPointer) = 0;\r
-\r
- //! Sets an attribute as user pointer\r
- virtual void setAttribute(const c8* attributeName, void* userPointer) = 0;\r
-\r
- //! Gets an attribute as user pointer\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) const = 0;\r
-\r
- //! Gets an attribute as user pointer\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual void* getAttributeAsUserPointer(s32 index) const = 0;\r
-\r
- //! Sets an attribute as user pointer\r
- virtual void setAttribute(s32 index, void* userPointer) = 0;\r
-\r
};\r
\r
} // end namespace io\r
} // end namespace irr\r
\r
#endif\r
-\r
-\r
-\r
/** @see bindTargetAndRotation() */\r
virtual bool getTargetAndRotationBinding(void) const =0;\r
\r
- //! Writes attributes of the camera node\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_\r
- {\r
- ISceneNode::serializeAttributes(out, options);\r
-\r
- if (!out)\r
- return;\r
- out->addBool("IsOrthogonal", IsOrthogonal);\r
- }\r
-\r
- //! Reads attributes of the camera node\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_\r
- {\r
- ISceneNode::deserializeAttributes(in, options);\r
- if (!in)\r
- return;\r
-\r
- if ( in->findAttribute("IsOrthogonal") )\r
- IsOrthogonal = in->getAttributeAsBool("IsOrthogonal");\r
- }\r
-\r
protected:\r
\r
void cloneMembers(const ICameraSceneNode* toCopyFrom)\r
/** \param filename is the string identifying the file which should be tested for existence.\r
\return True if file exists, and false if it does not exist or an error occurred. */\r
virtual bool existFile(const path& filename) const =0;\r
-\r
- //! Creates a new empty collection of attributes, usable for serialization and more.\r
- /** \param driver: Video driver to be used to load textures when specified as attribute values.\r
- Can be null to prevent automatic texture loading by attributes.\r
- \return Pointer to the created object.\r
- If you no longer need the object, you should call IAttributes::drop().\r
- See IReferenceCounted::drop() for more information. */\r
- virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;\r
};\r
\r
\r
#ifndef __I_GUI_ELEMENT_H_INCLUDED__\r
#define __I_GUI_ELEMENT_H_INCLUDED__\r
\r
-#include "IAttributeExchangingObject.h"\r
+#include "IReferenceCounted.h"\r
#include "irrList.h"\r
#include "rect.h"\r
#include "irrString.h"\r
namespace gui\r
{\r
//! Base class of all GUI elements.\r
-class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver\r
+class IGUIElement : virtual public IReferenceCounted, public IEventReceiver\r
{\r
public:\r
\r
}\r
\r
//! How left element border is aligned when parent is resized\r
- EGUI_ALIGNMENT getAlignLeft() const \r
+ EGUI_ALIGNMENT getAlignLeft() const\r
{\r
return AlignLeft;\r
}\r
\r
//! How right element border is aligned when parent is resized\r
- EGUI_ALIGNMENT getAlignRight() const \r
+ EGUI_ALIGNMENT getAlignRight() const\r
{\r
return AlignRight;\r
}\r
\r
//! How top element border is aligned when parent is resized\r
- EGUI_ALIGNMENT getAlignTop() const \r
+ EGUI_ALIGNMENT getAlignTop() const\r
{\r
return AlignTop;\r
}\r
\r
//! How bottom element border is aligned when parent is resized\r
- EGUI_ALIGNMENT getAlignBottom() const \r
+ EGUI_ALIGNMENT getAlignBottom() const\r
{\r
return AlignBottom;\r
}\r
}\r
\r
\r
- //! Writes attributes of the scene node.\r
- /** Implement this to expose the attributes of your scene node for\r
- scripting languages, editors, debuggers or xml serialization purposes. */\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_\r
- {\r
- out->addString("Name", Name.c_str());\r
- out->addInt("Id", ID );\r
- out->addString("Caption", getText());\r
- out->addString("ToolTip", getToolTipText().c_str());\r
- out->addRect("Rect", DesiredRect);\r
- out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));\r
- out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));\r
- out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);\r
- out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);\r
- out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);\r
- out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);\r
- out->addBool("Visible", IsVisible);\r
- out->addBool("Enabled", IsEnabled);\r
- out->addBool("TabStop", IsTabStop);\r
- out->addBool("TabGroup", IsTabGroup);\r
- out->addInt("TabOrder", TabOrder);\r
- out->addBool("NoClip", NoClip);\r
- }\r
-\r
-\r
- //! Reads attributes of the scene node.\r
- /** Implement this to set the attributes of your scene node for\r
- scripting languages, editors, debuggers or xml deserialization purposes. */\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_\r
- {\r
- setName(in->getAttributeAsString("Name", Name));\r
- setID(in->getAttributeAsInt("Id", ID));\r
- setText(in->getAttributeAsStringW("Caption", Text).c_str());\r
- setToolTipText(in->getAttributeAsStringW("ToolTip").c_str());\r
- setVisible(in->getAttributeAsBool("Visible", IsVisible));\r
- setEnabled(in->getAttributeAsBool("Enabled", IsEnabled));\r
- IsTabStop = in->getAttributeAsBool("TabStop", IsTabStop);\r
- IsTabGroup = in->getAttributeAsBool("TabGroup", IsTabGroup);\r
- TabOrder = in->getAttributeAsInt("TabOrder", TabOrder);\r
-\r
- core::position2di p = in->getAttributeAsPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));\r
- setMaxSize(core::dimension2du(p.X,p.Y));\r
-\r
- p = in->getAttributeAsPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));\r
- setMinSize(core::dimension2du(p.X,p.Y));\r
-\r
- setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames, AlignLeft),\r
- (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames, AlignRight),\r
- (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames, AlignTop),\r
- (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames, AlignBottom));\r
-\r
- setRelativePosition(in->getAttributeAsRect("Rect", DesiredRect));\r
-\r
- setNotClipped(in->getAttributeAsBool("NoClip", NoClip));\r
- }\r
-\r
protected:\r
// not virtual because needed in constructor\r
void addChildToEnd(IGUIElement* child)\r
\return True if loading succeeded, else false. */\r
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;\r
\r
- //! Writes attributes of the gui environment\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;\r
-\r
- //! Reads attributes of the gui environment\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;\r
-\r
//! Find the next element which would be selected when pressing the tab-key\r
/** If you set the focus for the result you can manually force focus-changes like they\r
would happen otherwise by the tab-keys.\r
#ifndef __I_GUI_SKIN_H_INCLUDED__\r
#define __I_GUI_SKIN_H_INCLUDED__\r
\r
-#include "IAttributeExchangingObject.h"\r
+#include "IReferenceCounted.h"\r
#include "EGUIAlignment.h"\r
#include "SColor.h"\r
#include "rect.h"\r
};\r
\r
//! A skin modifies the look of the GUI elements.\r
- class IGUISkin : public virtual io::IAttributeExchangingObject\r
+ class IGUISkin : virtual public IReferenceCounted\r
{\r
public:\r
\r
+++ /dev/null
-// Copyright (C) 2010-2012 Nikolaus Gebhardt\r
-// This file is part of the "Irrlicht Engine".\r
-// For conditions of distribution and use, see copyright notice in irrlicht.h\r
-\r
-#ifndef __I_SCENE_LOADER_H_INCLUDED__\r
-#define __I_SCENE_LOADER_H_INCLUDED__\r
-\r
-#include "IReferenceCounted.h"\r
-#include "path.h"\r
-\r
-namespace irr\r
-{\r
-namespace io\r
-{\r
- class IReadFile;\r
-} // end namespace io\r
-namespace scene\r
-{\r
- class ISceneNode;\r
- class ISceneUserDataSerializer;\r
-\r
-//! Class which can load a scene into the scene manager.\r
-/** If you want Irrlicht to be able to load currently unsupported\r
-scene file formats (e.g. .vrml), then implement this and add your\r
-new Sceneloader to the engine with ISceneManager::addExternalSceneLoader(). */\r
-class ISceneLoader : public virtual IReferenceCounted\r
-{\r
-public:\r
-\r
- //! Returns true if the class might be able to load this file.\r
- /** This decision should be based on the file extension (e.g. ".vrml")\r
- only.\r
- \param filename Name of the file to test.\r
- \return True if the extension is a recognised type. */\r
- virtual bool isALoadableFileExtension(const io::path& filename) const = 0;\r
-\r
- //! Returns true if the class might be able to load this file.\r
- /** This decision will be based on a quick look at the contents of the file.\r
- \param file The file to test.\r
- \return True if the extension is a recognised type. */\r
- virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;\r
-\r
- //! Loads the scene into the scene manager.\r
- /** \param file File which contains the scene.\r
- \param userDataSerializer: If you want to load user data which may be attached\r
- to some some scene nodes in the file, implement the ISceneUserDataSerializer\r
- interface and provide it as parameter here. Otherwise, simply specify 0 as this\r
- parameter.\r
- \param rootNode The node to load the scene into, if none is provided then the\r
- scene will be loaded into the root node.\r
- \return Returns true on success, false on failure. Returns 0 if loading failed. */\r
- virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,\r
- ISceneNode* rootNode=0) = 0;\r
-\r
-};\r
-\r
-\r
-} // end namespace scene\r
-} // end namespace irr\r
-\r
-#endif\r
-\r
class IMeshManipulator;\r
class IMeshSceneNode;\r
class IMeshWriter;\r
- class ISceneLoader;\r
class ISceneNode;\r
class ISceneNodeFactory;\r
- class ISceneUserDataSerializer;\r
\r
//! The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.\r
/** All Scene nodes can be created only here.\r
\return A pointer to the specified loader, 0 if the index is incorrect. */\r
virtual IMeshLoader* getMeshLoader(u32 index) const = 0;\r
\r
- //! Adds an external scene loader for extending the engine with new file formats.\r
- /** If you want the engine to be extended with\r
- file formats it currently is not able to load (e.g. .vrml), just implement\r
- the ISceneLoader interface in your loading class and add it with this method.\r
- Using this method it is also possible to override the built-in scene loaders\r
- with newer or updated versions without the need to recompile the engine.\r
- \param externalLoader: Implementation of a new mesh loader. */\r
- virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;\r
-\r
- //! Returns the number of scene loaders supported by Irrlicht at this time\r
- virtual u32 getSceneLoaderCount() const = 0;\r
-\r
- //! Retrieve the given scene loader\r
- /** \param index The index of the loader to retrieve. This parameter is an 0-based\r
- array index.\r
- \return A pointer to the specified loader, 0 if the index is incorrect. */\r
- virtual ISceneLoader* getSceneLoader(u32 index) const = 0;\r
-\r
//! Get pointer to the scene collision manager.\r
/** \return Pointer to the collision manager\r
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
See IReferenceCounted::drop() for more information. */\r
virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;\r
\r
- //! Saves the current scene into a file.\r
- /** Scene nodes with the option isDebugObject set to true are\r
- not being saved. The scene is usually written to an .irr file,\r
- an xml based format. .irr files can Be edited with the Irrlicht\r
- Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To\r
- load .irr files again, see ISceneManager::loadScene().\r
- \param filename Name of the file.\r
- \param userDataSerializer If you want to save some user data\r
- for every scene node into the file, implement the\r
- ISceneUserDataSerializer interface and provide it as parameter\r
- here. Otherwise, simply specify 0 as this parameter.\r
- \param node Node which is taken as the top node of the scene.\r
- This node and all of its descendants are saved into the scene\r
- file. Pass 0 or the scene manager to save the full scene (which\r
- is also the default).\r
- \return True if successful. */\r
- virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;\r
-\r
- //! Saves the current scene into a file.\r
- /** Scene nodes with the option isDebugObject set to true are\r
- not being saved. The scene is usually written to an .irr file,\r
- an xml based format. .irr files can Be edited with the Irrlicht\r
- Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To\r
- load .irr files again, see ISceneManager::loadScene().\r
- \param file File where the scene is saved into.\r
- \param userDataSerializer If you want to save some user data\r
- for every scene node into the file, implement the\r
- ISceneUserDataSerializer interface and provide it as parameter\r
- here. Otherwise, simply specify 0 as this parameter.\r
- \param node Node which is taken as the top node of the scene.\r
- This node and all of its descendants are saved into the scene\r
- file. Pass 0 or the scene manager to save the full scene (which\r
- is also the default).\r
- \return True if successful. */\r
- virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;\r
-\r
- //! Loads a scene. Note that the current scene is not cleared before.\r
- /** The scene is usually loaded from an .irr file, an xml based\r
- format, but other scene formats can be added to the engine via\r
- ISceneManager::addExternalSceneLoader. .irr files can Be edited\r
- with the Irrlicht Engine Editor, irrEdit\r
- (http://www.ambiera.com/irredit/) or saved directly by the engine\r
- using ISceneManager::saveScene().\r
- \param filename Name of the file to load from.\r
- \param userDataSerializer If you want to load user data\r
- possibily saved in that file for some scene nodes in the file,\r
- implement the ISceneUserDataSerializer interface and provide it\r
- as parameter here. Otherwise, simply specify 0 as this\r
- parameter.\r
- \param rootNode Node which is taken as the root node of the\r
- scene. Pass 0 to add the scene directly to the scene manager\r
- (which is also the default).\r
- \return True if successful. */\r
- virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;\r
-\r
- //! Loads a scene. Note that the current scene is not cleared before.\r
- /** The scene is usually loaded from an .irr file, an xml based\r
- format, but other scene formats can be added to the engine via\r
- ISceneManager::addExternalSceneLoader. .irr files can Be edited\r
- with the Irrlicht Engine Editor, irrEdit\r
- (http://www.ambiera.com/irredit/) or saved directly by the engine\r
- using ISceneManager::saveScene().\r
- \param file File where the scene is loaded from.\r
- \param userDataSerializer If you want to load user data\r
- saved in that file for some scene nodes in the file,\r
- implement the ISceneUserDataSerializer interface and provide it\r
- as parameter here. Otherwise, simply specify 0 as this\r
- parameter.\r
- \param rootNode Node which is taken as the root node of the\r
- scene. Pass 0 to add the scene directly to the scene manager\r
- (which is also the default).\r
- \return True if successful. */\r
- virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;\r
-\r
//! Get a mesh writer implementation if available\r
/** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()\r
for details. */\r
#ifndef __I_SCENE_NODE_H_INCLUDED__\r
#define __I_SCENE_NODE_H_INCLUDED__\r
\r
-#include "IAttributeExchangingObject.h"\r
+#include "IReferenceCounted.h"\r
#include "ESceneNodeTypes.h"\r
#include "ECullingTypes.h"\r
#include "EDebugSceneTypes.h"\r
example easily possible to attach a light to a moving car, or to place\r
a walking character on a moving platform on a moving ship.\r
*/\r
- class ISceneNode : virtual public io::IAttributeExchangingObject\r
+ class ISceneNode : virtual public IReferenceCounted\r
{\r
public:\r
\r
return ESNT_UNKNOWN;\r
}\r
\r
-\r
- //! Writes attributes of the scene node.\r
- /** Implement this to expose the attributes of your scene node\r
- for scripting languages, editors, debuggers or xml\r
- serialization purposes.\r
- \param out The attribute container to write into.\r
- \param options Additional options which might influence the\r
- serialization. */\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_\r
- {\r
- if (!out)\r
- return;\r
- out->addString("Name", Name.c_str());\r
- out->addInt("Id", ID );\r
-\r
- out->addVector3d("Position", getPosition() );\r
- out->addVector3d("Rotation", getRotation() );\r
- out->addVector3d("Scale", getScale() );\r
-\r
- out->addBool("Visible", IsVisible );\r
- out->addInt("AutomaticCulling", AutomaticCullingState);\r
- out->addInt("DebugDataVisible", DebugDataVisible );\r
- out->addBool("IsDebugObject", IsDebugObject );\r
- }\r
-\r
-\r
- //! Reads attributes of the scene node.\r
- /** Implement this to set the attributes of your scene node for\r
- scripting languages, editors, debuggers or xml deserialization\r
- purposes.\r
- \param in The attribute container to read from.\r
- \param options Additional options which might influence the\r
- deserialization. */\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_\r
- {\r
- if (!in)\r
- return;\r
- Name = in->getAttributeAsString("Name", Name);\r
- ID = in->getAttributeAsInt("Id", ID);\r
-\r
- setPosition(in->getAttributeAsVector3d("Position", RelativeTranslation));\r
- setRotation(in->getAttributeAsVector3d("Rotation", RelativeRotation));\r
- setScale(in->getAttributeAsVector3d("Scale", RelativeScale));\r
-\r
- IsVisible = in->getAttributeAsBool("Visible", IsVisible);\r
- if (in->existsAttribute("AutomaticCulling"))\r
- {\r
- s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",\r
- scene::AutomaticCullingNames);\r
- if (tmpState != -1)\r
- AutomaticCullingState = (u32)tmpState;\r
- else\r
- AutomaticCullingState = in->getAttributeAsInt("AutomaticCulling");\r
- }\r
-\r
- DebugDataVisible = in->getAttributeAsInt("DebugDataVisible", DebugDataVisible);\r
- IsDebugObject = in->getAttributeAsBool("IsDebugObject", IsDebugObject);\r
-\r
- updateAbsolutePosition();\r
- }\r
-\r
//! Creates a clone of this scene node and its children.\r
/** \param newParent An optional new parent.\r
\param newManager An optional new scene manager.\r
+++ /dev/null
-// Copyright (C) 2002-2012 Nikolaus Gebhardt\r
-// This file is part of the "Irrlicht Engine".\r
-// For conditions of distribution and use, see copyright notice in irrlicht.h\r
-\r
-#ifndef __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__\r
-#define __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__\r
-\r
-#include "IReferenceCounted.h"\r
-\r
-namespace irr\r
-{\r
-namespace io\r
-{\r
- class IAttributes;\r
-} // end namespace io\r
-namespace scene\r
-{\r
- class ISceneNode;\r
-\r
-//! Interface to read and write user data to and from .irr files.\r
-/** This interface is to be implemented by the user, to make it possible to read\r
-and write user data when reading or writing .irr files via ISceneManager.\r
-To be used with ISceneManager::loadScene() and ISceneManager::saveScene() */\r
-class ISceneUserDataSerializer\r
-{\r
-public:\r
-\r
- virtual ~ISceneUserDataSerializer() {}\r
-\r
- //! Called when the scene manager create a scene node while loading a file.\r
- virtual void OnCreateNode(ISceneNode* node) = 0;\r
-\r
- //! Called when the scene manager read a scene node while loading a file.\r
- /** The userData pointer contains a list of attributes with userData which\r
- were attached to the scene node in the read scene file.*/\r
- virtual void OnReadUserData(ISceneNode* forSceneNode, io::IAttributes* userData) = 0;\r
-\r
- //! Called when the scene manager is writing a scene node to an xml file for example.\r
- /** Implement this method and return a list of attributes containing the user data\r
- you want to be saved together with the scene node. Return 0 if no user data should\r
- be added. Please note that the scene manager will call drop() to the returned pointer\r
- after it no longer needs it, so if you didn't create a new object for the return value\r
- and returning a longer existing IAttributes object, simply call grab() before returning it. */\r
- virtual io::IAttributes* createUserData(ISceneNode* forSceneNode) = 0;\r
-};\r
-\r
-} // end namespace scene\r
-} // end namespace irr\r
-\r
-#endif\r
-\r
namespace io\r
{\r
class IAttributes;\r
- struct SAttributeReadWriteOptions;\r
class IReadFile;\r
class IWriteFile;\r
} // end namespace io\r
When false the names will stay at the original index */\r
virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames=true) = 0;\r
\r
- //! Creates material attributes list from a material\r
- /** This method is useful for serialization and more.\r
- Please note that the video driver will use the material\r
- renderer names from getMaterialRendererName() to write out the\r
- material type name, so they should be set before.\r
- \param material The material to serialize.\r
- \param options Additional options which might influence the\r
- serialization.\r
- \return The io::IAttributes container holding the material\r
- properties. */\r
- virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material,\r
- io::SAttributeReadWriteOptions* options=0) =0;\r
-\r
- //! Fills an SMaterial structure from attributes.\r
- /** Please note that for setting material types of the\r
- material, the video driver will need to query the material\r
- renderers for their names, so all non built-in materials must\r
- have been created before calling this method.\r
- \param outMaterial The material to set the properties for.\r
- \param attributes The attributes to read from. */\r
- virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) =0;\r
-\r
//! Returns driver and operating system specific data about the IVideoDriver.\r
/** This method should only be used if the engine should be\r
extended without having to modify the source of the engine.\r
**/\r
const c8* const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles";\r
\r
-\r
- //! Flag to ignore the b3d file's mipmapping flag\r
- /** Instead Irrlicht's texture creation flag is used. Use it like this:\r
- \code\r
- SceneManager->getParameters()->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true);\r
- \endcode\r
- **/\r
- const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";\r
-\r
- //! Name of the parameter for setting the length of debug normals.\r
- /** Use it like this:\r
- \code\r
- SceneManager->getParameters()->setAttribute(scene::DEBUG_NORMAL_LENGTH, 1.5f);\r
- \endcode\r
- **/\r
- const c8* const DEBUG_NORMAL_LENGTH = "DEBUG_Normal_Length";\r
-\r
- //! Name of the parameter for setting the color of debug normals.\r
- /** Use it like this:\r
- \code\r
- SceneManager->getParameters()->setAttributeAsColor(scene::DEBUG_NORMAL_COLOR, video::SColor(255, 255, 255, 255));\r
- \endcode\r
- **/\r
- const c8* const DEBUG_NORMAL_COLOR = "DEBUG_Normal_Color";\r
-\r
-\r
} // end namespace scene\r
} // end namespace irr\r
\r
#include "heapsort.h"\r
#include "IAnimatedMesh.h"\r
#include "IAnimatedMeshSceneNode.h"\r
-#include "IAttributeExchangingObject.h"\r
#include "IAttributes.h"\r
#include "IBillboardSceneNode.h"\r
#include "IBoneSceneNode.h"\r
#include "irrTypes.h"\r
#include "path.h"\r
#include "ISceneCollisionManager.h"\r
-#include "ISceneLoader.h"\r
#include "ISceneManager.h"\r
#include "ISceneNode.h"\r
#include "ISceneNodeFactory.h"\r
-#include "ISceneUserDataSerializer.h"\r
#include "IShaderConstantSetCallBack.h"\r
#include "ISkinnedMesh.h"\r
#include "ITexture.h"\r
// show normals\r
if (DebugDataVisible & scene::EDS_NORMALS)\r
{\r
- const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);\r
- const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);\r
+ const f32 debugNormalLength = 1.f;\r
+ const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221);\r
const u32 count = m->getMeshBufferCount();\r
\r
// draw normals\r
}\r
\r
\r
-//! Writes attributes of the scene node.\r
-void CAnimatedMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IAnimatedMeshSceneNode::serializeAttributes(out, options);\r
-\r
- if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)\r
- {\r
- const io::path path = SceneManager->getFileSystem()->getRelativeFilename(\r
- SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),\r
- options->Filename);\r
- out->addString("Mesh", path.c_str());\r
- }\r
- else\r
- out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());\r
- out->addBool("Looping", Looping);\r
- out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);\r
- out->addFloat("FramesPerSecond", FramesPerSecond);\r
- out->addInt("StartFrame", StartFrame);\r
- out->addInt("EndFrame", EndFrame);\r
-}\r
-\r
-\r
-//! Reads attributes of the scene node.\r
-void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- IAnimatedMeshSceneNode::deserializeAttributes(in, options);\r
-\r
- io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);\r
- io::path newMeshStr = in->getAttributeAsString("Mesh");\r
-\r
- Looping = in->getAttributeAsBool("Looping");\r
- ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");\r
- FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");\r
- StartFrame = in->getAttributeAsInt("StartFrame");\r
- EndFrame = in->getAttributeAsInt("EndFrame");\r
-\r
- if (newMeshStr != "" && oldMeshStr != newMeshStr)\r
- {\r
- IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());\r
-\r
- if (newAnimatedMesh)\r
- setMesh(newAnimatedMesh);\r
- }\r
-\r
- // TODO: read animation names instead of frame begin and ends\r
-}\r
-\r
-\r
//! Sets a new mesh\r
void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh)\r
{\r
//! Returns the current mesh\r
virtual IAnimatedMesh* getMesh(void) _IRR_OVERRIDE_ { return Mesh; }\r
\r
- //! Writes attributes of the scene node.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the scene node.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! Returns type of the scene node\r
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_ANIMATED_MESH; }\r
\r
return BoolValue;\r
}\r
\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- return core::stringw( BoolValue ? L"true" : L"false" );\r
- }\r
-\r
virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
{\r
BoolValue = (intValue != 0);\r
BoolValue = boolValue;\r
}\r
\r
- virtual void setString(const char* string) _IRR_OVERRIDE_\r
- {\r
- BoolValue = strcmp(string, "true") == 0;\r
- }\r
-\r
virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
{\r
return EAT_BOOL;\r
return (f32)Value;\r
}\r
\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- return (Value != 0);\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- return core::stringw(Value);\r
- }\r
-\r
virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
{\r
Value = intValue;\r
Value = (s32)floatValue;\r
};\r
\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- Value = atoi(text);\r
- }\r
-\r
virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
{\r
return EAT_INT;\r
}\r
\r
-\r
virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
{\r
return L"int";\r
return Value;\r
}\r
\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- return (Value != 0);\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- return core::stringw((double)Value);\r
- }\r
-\r
virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
{\r
Value = (f32)intValue;\r
Value = floatValue;\r
}\r
\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- Value = core::fast_atof(text);\r
- }\r
-\r
virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
{\r
return EAT_FLOAT;\r
}\r
\r
-\r
virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
{\r
return L"float";\r
f32 Value;\r
};\r
\r
-\r
-\r
-/*\r
- Types which can be represented as a list of numbers\r
-*/\r
-\r
-// Base class for all attributes which are a list of numbers-\r
-// vectors, colors, positions, triangles, etc\r
-class CNumbersAttribute : public IAttribute\r
-{\r
-public:\r
-\r
- CNumbersAttribute(const char* name, video::SColorf value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.r);\r
- ValueF.push_back(value.g);\r
- ValueF.push_back(value.b);\r
- ValueF.push_back(value.a);\r
- }\r
-\r
- CNumbersAttribute(const char* name, video::SColor value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(false)\r
- {\r
- Name = name;\r
- ValueI.push_back(value.getRed());\r
- ValueI.push_back(value.getGreen());\r
- ValueI.push_back(value.getBlue());\r
- ValueI.push_back(value.getAlpha());\r
- }\r
-\r
-\r
- CNumbersAttribute(const char* name, const core::vector3df& value) :\r
- ValueI(), ValueF(), Count(3), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.X);\r
- ValueF.push_back(value.Y);\r
- ValueF.push_back(value.Z);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::rect<s32>& value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(false)\r
- {\r
- Name = name;\r
- ValueI.push_back(value.UpperLeftCorner.X);\r
- ValueI.push_back(value.UpperLeftCorner.Y);\r
- ValueI.push_back(value.LowerRightCorner.X);\r
- ValueI.push_back(value.LowerRightCorner.Y);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::rect<f32>& value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.UpperLeftCorner.X);\r
- ValueF.push_back(value.UpperLeftCorner.Y);\r
- ValueF.push_back(value.LowerRightCorner.X);\r
- ValueF.push_back(value.LowerRightCorner.Y);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::matrix4& value) :\r
- ValueI(), ValueF(), Count(16), IsFloat(true)\r
- {\r
- Name = name;\r
- for (s32 r=0; r<4; ++r)\r
- for (s32 c=0; c<4; ++c)\r
- ValueF.push_back(value(r,c));\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::quaternion& value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.X);\r
- ValueF.push_back(value.Y);\r
- ValueF.push_back(value.Z);\r
- ValueF.push_back(value.W);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::aabbox3d<f32>& value) :\r
- ValueI(), ValueF(), Count(6), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.MinEdge.X);\r
- ValueF.push_back(value.MinEdge.Y);\r
- ValueF.push_back(value.MinEdge.Z);\r
- ValueF.push_back(value.MaxEdge.X);\r
- ValueF.push_back(value.MaxEdge.Y);\r
- ValueF.push_back(value.MaxEdge.Z);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::plane3df& value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.Normal.X);\r
- ValueF.push_back(value.Normal.Y);\r
- ValueF.push_back(value.Normal.Z);\r
- ValueF.push_back(value.D);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::triangle3df& value) :\r
- ValueI(), ValueF(), Count(9), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.pointA.X);\r
- ValueF.push_back(value.pointA.Y);\r
- ValueF.push_back(value.pointA.Z);\r
- ValueF.push_back(value.pointB.X);\r
- ValueF.push_back(value.pointB.Y);\r
- ValueF.push_back(value.pointB.Z);\r
- ValueF.push_back(value.pointC.X);\r
- ValueF.push_back(value.pointC.Y);\r
- ValueF.push_back(value.pointC.Z);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::vector2df& value) :\r
- ValueI(), ValueF(), Count(2), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.X);\r
- ValueF.push_back(value.Y);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::vector2di& value) :\r
- ValueI(), ValueF(), Count(2), IsFloat(false)\r
- {\r
- Name = name;\r
- ValueI.push_back(value.X);\r
- ValueI.push_back(value.Y);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::line2di& value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(false)\r
- {\r
- Name = name;\r
- ValueI.push_back(value.start.X);\r
- ValueI.push_back(value.start.Y);\r
- ValueI.push_back(value.end.X);\r
- ValueI.push_back(value.end.Y);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::line2df& value) :\r
- ValueI(), ValueF(), Count(4), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.start.X);\r
- ValueF.push_back(value.start.Y);\r
- ValueF.push_back(value.end.X);\r
- ValueF.push_back(value.end.Y);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::line3df& value) :\r
- ValueI(), ValueF(), Count(6), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.start.X);\r
- ValueF.push_back(value.start.Y);\r
- ValueF.push_back(value.start.Z);\r
- ValueF.push_back(value.end.X);\r
- ValueF.push_back(value.end.Y);\r
- ValueF.push_back(value.end.Z);\r
- }\r
-\r
- CNumbersAttribute(const char* name, const core::dimension2du& value) :\r
- ValueI(), ValueF(), Count(2), IsFloat(false)\r
- {\r
- Name = name;\r
- ValueI.push_back(value.Width);\r
- ValueI.push_back(value.Height);\r
- }\r
-\r
-\r
- CNumbersAttribute(const char* name, const core::dimension2df& value) :\r
- ValueI(), ValueF(), Count(2), IsFloat(true)\r
- {\r
- Name = name;\r
- ValueF.push_back(value.Width);\r
- ValueF.push_back(value.Height);\r
- }\r
-\r
- // getting values\r
- virtual s32 getInt() const _IRR_OVERRIDE_\r
- {\r
- if (Count==0)\r
- return 0;\r
-\r
- if (IsFloat)\r
- return (s32)ValueF[0];\r
- else\r
- return ValueI[0];\r
- }\r
-\r
- virtual f32 getFloat() const _IRR_OVERRIDE_\r
- {\r
- if (Count==0)\r
- return 0.0f;\r
-\r
- if (IsFloat)\r
- return ValueF[0];\r
- else\r
- return (f32)ValueI[0];\r
- }\r
-\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- // return true if any number is nonzero\r
- bool ret=false;\r
-\r
- for (u32 i=0; i < Count; ++i)\r
- if ( IsFloat ? (ValueF[i] != 0) : (ValueI[i] != 0) )\r
- {\r
- ret=true;\r
- break;\r
- }\r
-\r
- return ret;\r
- }\r
-\r
-\r
- virtual core::stringc getString() const _IRR_OVERRIDE_\r
- {\r
- core::stringc outstr;\r
-\r
- for (u32 i=0; i <Count; ++i)\r
- {\r
- if (IsFloat)\r
- outstr += ValueF[i];\r
- else\r
- outstr += ValueI[i];\r
-\r
- if (i < Count-1)\r
- outstr += ", ";\r
- }\r
- return outstr;\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- core::stringw outstr;\r
-\r
- for (u32 i=0; i <Count; ++i)\r
- {\r
- if (IsFloat)\r
- outstr += ValueF[i];\r
- else\r
- outstr += ValueI[i];\r
-\r
- if (i < Count-1)\r
- outstr += L", ";\r
- }\r
- return outstr;\r
- }\r
-\r
- virtual core::position2di getPosition() const _IRR_OVERRIDE_\r
- {\r
- core::position2di p;\r
-\r
- if (IsFloat)\r
- {\r
- p.X = (s32)(Count > 0 ? ValueF[0] : 0);\r
- p.Y = (s32)(Count > 1 ? ValueF[1] : 0);\r
- }\r
- else\r
- {\r
- p.X = Count > 0 ? ValueI[0] : 0;\r
- p.Y = Count > 1 ? ValueI[1] : 0;\r
- }\r
-\r
- return p;\r
- }\r
-\r
- virtual core::vector3df getVector() const _IRR_OVERRIDE_\r
- {\r
- core::vector3df v;\r
-\r
- if (IsFloat)\r
- {\r
- v.X = Count > 0 ? ValueF[0] : 0;\r
- v.Y = Count > 1 ? ValueF[1] : 0;\r
- v.Z = Count > 2 ? ValueF[2] : 0;\r
- }\r
- else\r
- {\r
- v.X = (f32)(Count > 0 ? ValueI[0] : 0);\r
- v.Y = (f32)(Count > 1 ? ValueI[1] : 0);\r
- v.Z = (f32)(Count > 2 ? ValueI[2] : 0);\r
- }\r
-\r
- return v;\r
- }\r
-\r
- virtual core::vector2df getVector2d() const _IRR_OVERRIDE_\r
- {\r
- core::vector2df v;\r
-\r
- if (IsFloat)\r
- {\r
- v.X = Count > 0 ? ValueF[0] : 0;\r
- v.Y = Count > 1 ? ValueF[1] : 0;\r
- }\r
- else\r
- {\r
- v.X = (f32)(Count > 0 ? ValueI[0] : 0);\r
- v.Y = (f32)(Count > 1 ? ValueI[1] : 0);\r
- }\r
-\r
- return v;\r
- }\r
-\r
- virtual video::SColorf getColorf() const _IRR_OVERRIDE_\r
- {\r
- video::SColorf c;\r
- if (IsFloat)\r
- {\r
- c.setColorComponentValue(0, Count > 0 ? ValueF[0] : 0);\r
- c.setColorComponentValue(1, Count > 1 ? ValueF[1] : 0);\r
- c.setColorComponentValue(2, Count > 2 ? ValueF[2] : 0);\r
- c.setColorComponentValue(3, Count > 3 ? ValueF[3] : 0);\r
- }\r
- else\r
- {\r
- c.setColorComponentValue(0, Count > 0 ? (f32)(ValueI[0]) / 255.0f : 0);\r
- c.setColorComponentValue(1, Count > 1 ? (f32)(ValueI[1]) / 255.0f : 0);\r
- c.setColorComponentValue(2, Count > 2 ? (f32)(ValueI[2]) / 255.0f : 0);\r
- c.setColorComponentValue(3, Count > 3 ? (f32)(ValueI[3]) / 255.0f : 0);\r
- }\r
-\r
- return c;\r
- }\r
-\r
- virtual video::SColor getColor() const _IRR_OVERRIDE_\r
- {\r
- return getColorf().toSColor();\r
- }\r
-\r
-\r
- virtual core::rect<s32> getRect() const _IRR_OVERRIDE_\r
- {\r
- core::rect<s32> r;\r
-\r
- if (IsFloat)\r
- {\r
- r.UpperLeftCorner.X = (s32)(Count > 0 ? ValueF[0] : 0);\r
- r.UpperLeftCorner.Y = (s32)(Count > 1 ? ValueF[1] : 0);\r
- r.LowerRightCorner.X = (s32)(Count > 2 ? ValueF[2] : r.UpperLeftCorner.X);\r
- r.LowerRightCorner.Y = (s32)(Count > 3 ? ValueF[3] : r.UpperLeftCorner.Y);\r
- }\r
- else\r
- {\r
- r.UpperLeftCorner.X = Count > 0 ? ValueI[0] : 0;\r
- r.UpperLeftCorner.Y = Count > 1 ? ValueI[1] : 0;\r
- r.LowerRightCorner.X = Count > 2 ? ValueI[2] : r.UpperLeftCorner.X;\r
- r.LowerRightCorner.Y = Count > 3 ? ValueI[3] : r.UpperLeftCorner.Y;\r
- }\r
- return r;\r
- }\r
-\r
- virtual core::dimension2du getDimension2d() const _IRR_OVERRIDE_\r
- {\r
- core::dimension2d<u32> dim;\r
-\r
- if (IsFloat)\r
- {\r
- dim.Width = (u32)(Count > 0 ? ValueF[0] : 0);\r
- dim.Height = (u32)(Count > 1 ? ValueF[1] : 0);\r
- }\r
- else\r
- {\r
- dim.Width = (u32)(Count > 0 ? ValueI[0] : 0);\r
- dim.Height = (u32)(Count > 1 ? ValueI[1] : 0);\r
- }\r
- return dim;\r
- }\r
-\r
- virtual core::matrix4 getMatrix() const _IRR_OVERRIDE_\r
- {\r
- core::matrix4 ret;\r
- if (IsFloat)\r
- {\r
- for (u32 r=0; r<4; ++r)\r
- for (u32 c=0; c<4; ++c)\r
- if (Count > c+r*4)\r
- ret(r,c) = ValueF[c+r*4];\r
- }\r
- else\r
- {\r
- for (u32 r=0; r<4; ++r)\r
- for (u32 c=0; c<4; ++c)\r
- if (Count > c+r*4)\r
- ret(r,c) = (f32)ValueI[c+r*4];\r
- }\r
- return ret;\r
- }\r
-\r
- virtual core::quaternion getQuaternion() const _IRR_OVERRIDE_\r
- {\r
- core::quaternion ret;\r
- if (IsFloat)\r
- {\r
- ret.X = Count > 0 ? ValueF[0] : 0.0f;\r
- ret.Y = Count > 1 ? ValueF[1] : 0.0f;\r
- ret.Z = Count > 2 ? ValueF[2] : 0.0f;\r
- ret.W = Count > 3 ? ValueF[3] : 0.0f;\r
- }\r
- else\r
- {\r
- ret.X = Count > 0 ? (f32)ValueI[0] : 0.0f;\r
- ret.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;\r
- ret.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;\r
- ret.W = Count > 3 ? (f32)ValueI[3] : 0.0f;\r
- }\r
- return ret;\r
- }\r
-\r
- virtual core::triangle3df getTriangle() const _IRR_OVERRIDE_\r
- {\r
- core::triangle3df ret;\r
-\r
- if (IsFloat)\r
- {\r
- ret.pointA.X = Count > 0 ? ValueF[0] : 0.0f;\r
- ret.pointA.Y = Count > 1 ? ValueF[1] : 0.0f;\r
- ret.pointA.Z = Count > 2 ? ValueF[2] : 0.0f;\r
- ret.pointB.X = Count > 3 ? ValueF[3] : 0.0f;\r
- ret.pointB.Y = Count > 4 ? ValueF[4] : 0.0f;\r
- ret.pointB.Z = Count > 5 ? ValueF[5] : 0.0f;\r
- ret.pointC.X = Count > 6 ? ValueF[6] : 0.0f;\r
- ret.pointC.Y = Count > 7 ? ValueF[7] : 0.0f;\r
- ret.pointC.Z = Count > 8 ? ValueF[8] : 0.0f;\r
- }\r
- else\r
- {\r
- ret.pointA.X = Count > 0 ? (f32)ValueI[0] : 0.0f;\r
- ret.pointA.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;\r
- ret.pointA.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;\r
- ret.pointB.X = Count > 3 ? (f32)ValueI[3] : 0.0f;\r
- ret.pointB.Y = Count > 4 ? (f32)ValueI[4] : 0.0f;\r
- ret.pointB.Z = Count > 5 ? (f32)ValueI[5] : 0.0f;\r
- ret.pointC.X = Count > 6 ? (f32)ValueI[6] : 0.0f;\r
- ret.pointC.Y = Count > 7 ? (f32)ValueI[7] : 0.0f;\r
- ret.pointC.Z = Count > 8 ? (f32)ValueI[8] : 0.0f;\r
- }\r
-\r
- return ret;\r
- }\r
-\r
- virtual core::plane3df getPlane() const _IRR_OVERRIDE_\r
- {\r
- core::plane3df ret;\r
-\r
- if (IsFloat)\r
- {\r
- ret.Normal.X = Count > 0 ? ValueF[0] : 0.0f;\r
- ret.Normal.Y = Count > 1 ? ValueF[1] : 0.0f;\r
- ret.Normal.Z = Count > 2 ? ValueF[2] : 0.0f;\r
- ret.D = Count > 3 ? ValueF[3] : 0.0f;\r
- }\r
- else\r
- {\r
- ret.Normal.X = Count > 0 ? (f32)ValueI[0] : 0.0f;\r
- ret.Normal.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;\r
- ret.Normal.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;\r
- ret.D = Count > 3 ? (f32)ValueI[3] : 0.0f;\r
- }\r
-\r
- return ret;\r
- }\r
-\r
- virtual core::aabbox3df getBBox() const _IRR_OVERRIDE_\r
- {\r
- core::aabbox3df ret;\r
- if (IsFloat)\r
- {\r
- ret.MinEdge.X = Count > 0 ? ValueF[0] : 0.0f;\r
- ret.MinEdge.Y = Count > 1 ? ValueF[1] : 0.0f;\r
- ret.MinEdge.Z = Count > 2 ? ValueF[2] : 0.0f;\r
- ret.MaxEdge.X = Count > 3 ? ValueF[3] : 0.0f;\r
- ret.MaxEdge.Y = Count > 4 ? ValueF[4] : 0.0f;\r
- ret.MaxEdge.Z = Count > 5 ? ValueF[5] : 0.0f;\r
- }\r
- else\r
- {\r
- ret.MinEdge.X = Count > 0 ? (f32)ValueI[0] : 0.0f;\r
- ret.MinEdge.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;\r
- ret.MinEdge.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;\r
- ret.MaxEdge.X = Count > 3 ? (f32)ValueI[3] : 0.0f;\r
- ret.MaxEdge.Y = Count > 4 ? (f32)ValueI[4] : 0.0f;\r
- ret.MaxEdge.Z = Count > 5 ? (f32)ValueI[5] : 0.0f;\r
- }\r
- return ret;\r
-\r
- }\r
-\r
- virtual core::line2df getLine2d() const _IRR_OVERRIDE_\r
- {\r
- core::line2df ret;\r
- if (IsFloat)\r
- {\r
- ret.start.X = Count > 0 ? ValueF[0] : 0.0f;\r
- ret.start.Y = Count > 1 ? ValueF[1] : 0.0f;\r
- ret.end.X = Count > 2 ? ValueF[2] : 0.0f;\r
- ret.end.Y = Count > 3 ? ValueF[3] : 0.0f;\r
- }\r
- else\r
- {\r
- ret.start.X = Count > 0 ? (f32)ValueI[0] : 0.0f;\r
- ret.start.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;\r
- ret.end.X = Count > 2 ? (f32)ValueI[2] : 0.0f;\r
- ret.end.Y = Count > 3 ? (f32)ValueI[3] : 0.0f;\r
- }\r
- return ret;\r
- }\r
-\r
- virtual core::line3df getLine3d() const _IRR_OVERRIDE_\r
- {\r
- core::line3df ret;\r
- if (IsFloat)\r
- {\r
- ret.start.X = Count > 0 ? ValueF[0] : 0.0f;\r
- ret.start.Y = Count > 1 ? ValueF[1] : 0.0f;\r
- ret.start.Z = Count > 2 ? ValueF[2] : 0.0f;\r
- ret.end.X = Count > 3 ? ValueF[3] : 0.0f;\r
- ret.end.Y = Count > 4 ? ValueF[4] : 0.0f;\r
- ret.end.Z = Count > 5 ? ValueF[5] : 0.0f;\r
- }\r
- else\r
- {\r
- ret.start.X = Count > 0 ? (f32)ValueI[0] : 0.0f;\r
- ret.start.Y = Count > 1 ? (f32)ValueI[1] : 0.0f;\r
- ret.start.Z = Count > 2 ? (f32)ValueI[2] : 0.0f;\r
- ret.end.X = Count > 3 ? (f32)ValueI[3] : 0.0f;\r
- ret.end.Y = Count > 4 ? (f32)ValueI[4] : 0.0f;\r
- ret.end.Z = Count > 5 ? (f32)ValueI[5] : 0.0f;\r
- }\r
- return ret;\r
- }\r
-\r
- //! get float array\r
- virtual core::array<f32> getFloatArray()\r
- {\r
- if (!IsFloat)\r
- {\r
- ValueF.clear();\r
- for (u32 i=0; i<Count; ++i)\r
- ValueF.push_back( (f32) ValueI[i] );\r
- }\r
- return ValueF;\r
- }\r
-\r
- //! get int array\r
- virtual core::array<s32> getIntArray()\r
- {\r
- if (IsFloat)\r
- {\r
- ValueI.clear();\r
- for (u32 i=0; i<Count; ++i)\r
- ValueI.push_back( (s32) ValueF[i] );\r
- }\r
- return ValueI;\r
- }\r
-\r
-\r
- // setting values\r
- virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
- {\r
- // set all values\r
- for (u32 i=0; i < Count; ++i)\r
- if (IsFloat)\r
- ValueF[i] = (f32)intValue;\r
- else\r
- ValueI[i] = intValue;\r
- }\r
-\r
- virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_\r
- {\r
- // set all values\r
- for (u32 i=0; i < Count; ++i)\r
- if (IsFloat)\r
- ValueF[i] = floatValue;\r
- else\r
- ValueI[i] = (s32)floatValue;\r
- }\r
-\r
- virtual void setBool(bool boolValue) _IRR_OVERRIDE_\r
- {\r
- setInt( boolValue ? 1 : 0);\r
- }\r
-\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- // parse text\r
-\r
- const char* P = (const char*)text;\r
-\r
- reset();\r
-\r
- u32 i=0;\r
-\r
- for ( i=0; i<Count && *P; ++i )\r
- {\r
- while(*P && P[0]!='-' && ( P[0]==' ' || (P[0] < '0' || P[0] > '9') ) )\r
- ++P;\r
-\r
- // set value\r
- if ( *P)\r
- {\r
- if (IsFloat)\r
- {\r
- f32 c = 0;\r
- P = core::fast_atof_move(P, c);\r
- ValueF[i] = c;\r
- }\r
- else\r
- {\r
- // todo: fix this to read ints properly\r
- f32 c = 0;\r
- P = core::fast_atof_move(P, c);\r
- ValueI[i] = (s32)c;\r
-\r
- }\r
- }\r
- }\r
- // todo: warning message\r
- //if (i < Count-1)\r
- //{\r
- //\r
- //}\r
- }\r
-\r
- virtual void setPosition(const core::position2di& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = (f32)v.X;\r
- if (Count > 1) ValueF[1] = (f32)v.Y;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = v.X;\r
- if (Count > 1) ValueI[1] = v.Y;\r
- }\r
- }\r
-\r
- virtual void setVector(const core::vector3df& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = v.X;\r
- if (Count > 1) ValueF[1] = v.Y;\r
- if (Count > 2) ValueF[2] = v.Z;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)v.X;\r
- if (Count > 1) ValueI[1] = (s32)v.Y;\r
- if (Count > 2) ValueI[2] = (s32)v.Z;\r
- }\r
- }\r
-\r
- virtual void setColor(video::SColorf color) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = color.r;\r
- if (Count > 1) ValueF[1] = color.g;\r
- if (Count > 2) ValueF[2] = color.b;\r
- if (Count > 3) ValueF[3] = color.a;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)(color.r * 255);\r
- if (Count > 1) ValueI[1] = (s32)(color.g * 255);\r
- if (Count > 2) ValueI[2] = (s32)(color.b * 255);\r
- if (Count > 3) ValueI[3] = (s32)(color.a * 255);\r
- }\r
-\r
- }\r
-\r
- virtual void setColor(video::SColor color) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = (f32)color.getRed() / 255.0f;\r
- if (Count > 1) ValueF[1] = (f32)color.getGreen() / 255.0f;\r
- if (Count > 2) ValueF[2] = (f32)color.getBlue() / 255.0f;\r
- if (Count > 3) ValueF[3] = (f32)color.getAlpha() / 255.0f;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = color.getRed();\r
- if (Count > 1) ValueI[1] = color.getGreen();\r
- if (Count > 2) ValueI[2] = color.getBlue();\r
- if (Count > 3) ValueI[3] = color.getAlpha();\r
- }\r
- }\r
-\r
- virtual void setRect(const core::rect<s32>& value) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = (f32)value.UpperLeftCorner.X;\r
- if (Count > 1) ValueF[1] = (f32)value.UpperLeftCorner.Y;\r
- if (Count > 2) ValueF[2] = (f32)value.LowerRightCorner.X;\r
- if (Count > 3) ValueF[3] = (f32)value.LowerRightCorner.Y;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = value.UpperLeftCorner.X;\r
- if (Count > 1) ValueI[1] = value.UpperLeftCorner.Y;\r
- if (Count > 2) ValueI[2] = value.LowerRightCorner.X;\r
- if (Count > 3) ValueI[3] = value.LowerRightCorner.Y;\r
- }\r
- }\r
-\r
- virtual void setMatrix(const core::matrix4& value) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- for (u32 r=0; r<4; ++r)\r
- for (u32 c=0; c<4; ++c)\r
- if (Count > c+r*4)\r
- ValueF[c+r*4] = value(r,c);\r
- }\r
- else\r
- {\r
- for (u32 r=0; r<4; ++r)\r
- for (u32 c=0; c<4; ++c)\r
- if (Count > c+r*4)\r
- ValueI[c+r*4] = (s32)value(r,c);\r
- }\r
- }\r
-\r
- virtual void setQuaternion(const core::quaternion& value) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = value.X;\r
- if (Count > 1) ValueF[1] = value.Y;\r
- if (Count > 2) ValueF[2] = value.Z;\r
- if (Count > 3) ValueF[3] = value.W;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)value.X;\r
- if (Count > 1) ValueI[1] = (s32)value.Y;\r
- if (Count > 2) ValueI[2] = (s32)value.Z;\r
- if (Count > 3) ValueI[3] = (s32)value.W;\r
- }\r
- }\r
-\r
- virtual void setBoundingBox(const core::aabbox3d<f32>& value)\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = value.MinEdge.X;\r
- if (Count > 1) ValueF[1] = value.MinEdge.Y;\r
- if (Count > 2) ValueF[2] = value.MinEdge.Z;\r
- if (Count > 3) ValueF[3] = value.MaxEdge.X;\r
- if (Count > 4) ValueF[4] = value.MaxEdge.Y;\r
- if (Count > 5) ValueF[5] = value.MaxEdge.Z;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)value.MinEdge.X;\r
- if (Count > 1) ValueI[1] = (s32)value.MinEdge.Y;\r
- if (Count > 2) ValueI[2] = (s32)value.MinEdge.Z;\r
- if (Count > 3) ValueI[3] = (s32)value.MaxEdge.X;\r
- if (Count > 4) ValueI[4] = (s32)value.MaxEdge.Y;\r
- if (Count > 5) ValueI[5] = (s32)value.MaxEdge.Z;\r
- }\r
- }\r
-\r
- virtual void setPlane(const core::plane3df& value) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = value.Normal.X;\r
- if (Count > 1) ValueF[1] = value.Normal.Y;\r
- if (Count > 2) ValueF[2] = value.Normal.Z;\r
- if (Count > 3) ValueF[3] = value.D;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)value.Normal.X;\r
- if (Count > 1) ValueI[1] = (s32)value.Normal.Y;\r
- if (Count > 2) ValueI[2] = (s32)value.Normal.Z;\r
- if (Count > 3) ValueI[3] = (s32)value.D;\r
- }\r
- }\r
-\r
- virtual void setTriangle3d(const core::triangle3df& value)\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = value.pointA.X;\r
- if (Count > 1) ValueF[1] = value.pointA.Y;\r
- if (Count > 2) ValueF[2] = value.pointA.Z;\r
- if (Count > 3) ValueF[3] = value.pointB.X;\r
- if (Count > 4) ValueF[4] = value.pointB.Y;\r
- if (Count > 5) ValueF[5] = value.pointB.Z;\r
- if (Count > 6) ValueF[6] = value.pointC.X;\r
- if (Count > 7) ValueF[7] = value.pointC.Y;\r
- if (Count > 8) ValueF[8] = value.pointC.Z;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)value.pointA.X;\r
- if (Count > 1) ValueI[1] = (s32)value.pointA.Y;\r
- if (Count > 2) ValueI[2] = (s32)value.pointA.Z;\r
- if (Count > 3) ValueI[3] = (s32)value.pointB.X;\r
- if (Count > 4) ValueI[4] = (s32)value.pointB.Y;\r
- if (Count > 5) ValueI[5] = (s32)value.pointB.Z;\r
- if (Count > 6) ValueI[6] = (s32)value.pointC.X;\r
- if (Count > 7) ValueI[7] = (s32)value.pointC.Y;\r
- if (Count > 8) ValueI[8] = (s32)value.pointC.Z;\r
- }\r
- }\r
-\r
- virtual void setVector2d(const core::vector2df& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = v.X;\r
- if (Count > 1) ValueF[1] = v.Y;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)v.X;\r
- if (Count > 1) ValueI[1] = (s32)v.Y;\r
- }\r
- }\r
-\r
- virtual void setVector2d(const core::vector2di& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = (f32)v.X;\r
- if (Count > 1) ValueF[1] = (f32)v.Y;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = v.X;\r
- if (Count > 1) ValueI[1] = v.Y;\r
- }\r
- }\r
-\r
- virtual void setLine2d(const core::line2di& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = (f32)v.start.X;\r
- if (Count > 1) ValueF[1] = (f32)v.start.Y;\r
- if (Count > 2) ValueF[2] = (f32)v.end.X;\r
- if (Count > 3) ValueF[3] = (f32)v.end.Y;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = v.start.X;\r
- if (Count > 1) ValueI[1] = v.start.Y;\r
- if (Count > 2) ValueI[2] = v.end.X;\r
- if (Count > 3) ValueI[3] = v.end.Y;\r
- }\r
- }\r
-\r
- virtual void setLine2d(const core::line2df& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = v.start.X;\r
- if (Count > 1) ValueF[1] = v.start.Y;\r
- if (Count > 2) ValueF[2] = v.end.X;\r
- if (Count > 3) ValueF[3] = v.end.Y;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)v.start.X;\r
- if (Count > 1) ValueI[1] = (s32)v.start.Y;\r
- if (Count > 2) ValueI[2] = (s32)v.end.X;\r
- if (Count > 3) ValueI[3] = (s32)v.end.Y;\r
- }\r
- }\r
-\r
- virtual void setDimension2d(const core::dimension2du& v) _IRR_OVERRIDE_\r
- {\r
- reset();\r
- if (IsFloat)\r
- {\r
- if (Count > 0) ValueF[0] = (f32)v.Width;\r
- if (Count > 1) ValueF[1] = (f32)v.Height;\r
- }\r
- else\r
- {\r
- if (Count > 0) ValueI[0] = (s32)v.Width;\r
- if (Count > 1) ValueI[1] = (s32)v.Height;\r
- }\r
- }\r
-\r
- //! set float array\r
- virtual void setFloatArray(core::array<f32> &vals)\r
- {\r
- reset();\r
-\r
- for (u32 i=0; i<vals.size() && i<Count; ++i)\r
- {\r
- if (IsFloat)\r
- ValueF[i] = vals[i];\r
- else\r
- ValueI[i] = (s32)vals[i];\r
- }\r
- }\r
-\r
- //! set int array\r
- virtual void setIntArray(core::array<s32> &vals)\r
- {\r
- reset();\r
-\r
- for (u32 i=0; i<vals.size() && i<Count; ++i)\r
- {\r
- if (IsFloat)\r
- ValueF[i] = (f32)vals[i];\r
- else\r
- ValueI[i] = vals[i];\r
- }\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- if (IsFloat)\r
- return EAT_FLOATARRAY;\r
- else\r
- return EAT_INTARRAY;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- if (IsFloat)\r
- return L"floatlist";\r
- else\r
- return L"intlist";\r
- }\r
-\r
-protected:\r
-\r
- //! clear all values\r
- void reset()\r
- {\r
- if (IsFloat)\r
- for (u32 i=0; i < Count; ++i)\r
- ValueF[i] = 0.0f;\r
- else\r
- for (u32 i=0; i < Count; ++i)\r
- ValueI[i] = 0;\r
- }\r
-\r
- core::array<s32> ValueI;\r
- core::array<f32> ValueF;\r
- u32 Count;\r
- bool IsFloat;\r
-};\r
-\r
-\r
-// Attribute implemented for floating point colors\r
-class CColorfAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CColorfAttribute(const char* name, video::SColorf value) : CNumbersAttribute(name, value) {}\r
-\r
- virtual s32 getInt() const _IRR_OVERRIDE_\r
- {\r
- return getColor().color;\r
- }\r
-\r
- virtual f32 getFloat() const _IRR_OVERRIDE_\r
- {\r
- return (f32)getColor().color;\r
- }\r
-\r
- virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
- {\r
- video::SColorf c = video::SColor(intValue);\r
- ValueF[0] = c.r;\r
- ValueF[1] = c.g;\r
- ValueF[2] = c.b;\r
- ValueF[3] = c.a;\r
- }\r
-\r
- virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_\r
- {\r
- setInt((s32)floatValue);\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_COLORF;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"colorf";\r
- }\r
-};\r
-\r
-\r
-\r
-// Attribute implemented for colors\r
-class CColorAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CColorAttribute(const char* name, const video::SColorf& value) : CNumbersAttribute(name, value) {}\r
-\r
- CColorAttribute(const char* name, const video::SColor& value) : CNumbersAttribute(name, value) {}\r
-\r
- virtual s32 getInt() const _IRR_OVERRIDE_\r
- {\r
- return getColor().color;\r
- }\r
-\r
- virtual f32 getFloat() const _IRR_OVERRIDE_\r
- {\r
- return (f32)getColor().color;\r
- }\r
-\r
- virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
- {\r
- video::SColorf c = video::SColor(intValue);\r
- ValueF[0] = c.r;\r
- ValueF[1] = c.g;\r
- ValueF[2] = c.b;\r
- ValueF[3] = c.a;\r
- }\r
-\r
- virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_\r
- {\r
- setInt((s32)floatValue);\r
- }\r
-\r
- virtual core::stringc getString() const _IRR_OVERRIDE_\r
- {\r
- char tmp[10];\r
- const video::SColor c = getColor();\r
- sprintf(tmp, "%02x%02x%02x%02x", c.getAlpha(), c.getRed(), c.getGreen(), c.getBlue());\r
- return core::stringc(tmp);\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- char tmp[10];\r
- const video::SColor c = getColor();\r
- sprintf(tmp, "%02x%02x%02x%02x", c.getAlpha(), c.getRed(), c.getGreen(), c.getBlue());\r
- return core::stringw(tmp);\r
- }\r
-\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- u32 c;\r
- int characters;\r
- const int items = sscanf(text, "%08x%n", &c, &characters);\r
- if (items != 1 || characters != 8 )\r
- {\r
- CNumbersAttribute::setString(text);\r
- }\r
- else\r
- setColor(c);\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_COLOR;\r
- }\r
-\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"color";\r
- }\r
-\r
-};\r
-\r
-\r
-// Attribute implemented for 3d vectors\r
-class CVector3DAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CVector3DAttribute(const char* name, const core::vector3df& value) : CNumbersAttribute(name, value) {}\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_VECTOR3D;\r
- }\r
-\r
- virtual core::matrix4 getMatrix() const _IRR_OVERRIDE_\r
- {\r
- core::matrix4 ret;\r
- ret.makeIdentity();\r
- ret.setTranslation( core::vector3df(ValueF[0],ValueF[1],ValueF[2]) );\r
- return ret;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"vector3d";\r
- }\r
-};\r
-\r
-// Attribute implemented for 2d vectors\r
-class CVector2DAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CVector2DAttribute(const char* name, const core::vector2df& value) : CNumbersAttribute(name, value) {}\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_VECTOR2D;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"vector2d";\r
- }\r
-};\r
-\r
-// Attribute implemented for 2d vectors\r
-class CPosition2DAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CPosition2DAttribute(const char* name, const core::position2di& value) : CNumbersAttribute(name, value) {}\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_POSITION2D;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"position";\r
- }\r
-};\r
-\r
-\r
-\r
-// Attribute implemented for rectangles\r
-class CRectAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CRectAttribute(const char* name, const core::rect<s32>& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_RECT;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"rect";\r
- }\r
-};\r
-\r
-\r
-// Attribute implemented for dimension\r
-class CDimension2dAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CDimension2dAttribute (const char* name, const core::dimension2d<u32>& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_DIMENSION2D;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"dimension2d";\r
- }\r
-};\r
-\r
-// Attribute implemented for matrices\r
-class CMatrixAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CMatrixAttribute(const char* name, const core::matrix4& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_MATRIX;\r
- }\r
-\r
- virtual core::quaternion getQuaternion() const _IRR_OVERRIDE_\r
- {\r
- return core::quaternion(getMatrix());\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"matrix";\r
- }\r
-};\r
-\r
-// Attribute implemented for quaternions\r
-class CQuaternionAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CQuaternionAttribute(const char* name, const core::quaternion& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_QUATERNION;\r
- }\r
-\r
- virtual core::matrix4 getMatrix() const _IRR_OVERRIDE_\r
- {\r
- return getQuaternion().getMatrix();\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"quaternion";\r
- }\r
-};\r
-\r
-\r
-// Attribute implemented for bounding boxes\r
-class CBBoxAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CBBoxAttribute(const char* name, const core::aabbox3df& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_BBOX;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"box3d";\r
- }\r
-};\r
-\r
-// Attribute implemented for planes\r
-class CPlaneAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CPlaneAttribute(const char* name, const core::plane3df& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_PLANE;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"plane";\r
- }\r
-};\r
-\r
-// Attribute implemented for triangles\r
-class CTriangleAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CTriangleAttribute(const char* name, const core::triangle3df& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_TRIANGLE3D;\r
- }\r
-\r
- virtual core::plane3df getPlane() const _IRR_OVERRIDE_\r
- {\r
- return getTriangle().getPlane();\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"triangle";\r
- }\r
-};\r
-\r
-\r
-// Attribute implemented for 2d lines\r
-class CLine2dAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CLine2dAttribute(const char* name, const core::line2df& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_LINE2D;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"line2d";\r
- }\r
-};\r
-\r
-// Attribute implemented for 3d lines\r
-class CLine3dAttribute : public CNumbersAttribute\r
-{\r
-public:\r
-\r
- CLine3dAttribute(const char* name, const core::line3df& value) : CNumbersAttribute(name, value) { }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_LINE3D;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"line3d";\r
- }\r
-};\r
-\r
-\r
-// vector2df\r
-// dimension2du\r
-\r
-/*\r
- Special attributes\r
-*/\r
-\r
-// Attribute implemented for enumeration literals\r
-class CEnumAttribute : public IAttribute\r
-{\r
-public:\r
-\r
- CEnumAttribute(const char* name, const char* value, const char* const* literals)\r
- {\r
- Name = name;\r
- setEnum(value, literals);\r
- }\r
-\r
- virtual void setEnum(const char* enumValue, const char* const* enumerationLiterals) _IRR_OVERRIDE_\r
- {\r
- u32 literalCount = 0;\r
-\r
- if (enumerationLiterals)\r
- {\r
- s32 i;\r
- for (i=0; enumerationLiterals[i]; ++i)\r
- ++literalCount;\r
-\r
- EnumLiterals.reallocate(literalCount);\r
- for (i=0; enumerationLiterals[i]; ++i)\r
- EnumLiterals.push_back(enumerationLiterals[i]);\r
- }\r
-\r
- setString(enumValue);\r
- }\r
-\r
- virtual s32 getInt() const _IRR_OVERRIDE_\r
- {\r
- for (u32 i=0; i < EnumLiterals.size(); ++i)\r
- {\r
- if (Value.equals_ignore_case(EnumLiterals[i]))\r
- {\r
- return (s32)i;\r
- }\r
- }\r
-\r
- return -1;\r
- }\r
-\r
- virtual f32 getFloat() const _IRR_OVERRIDE_\r
- {\r
- return (f32)getInt();\r
- }\r
-\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- return (getInt() != 0); // does not make a lot of sense, I know\r
- }\r
-\r
- virtual core::stringc getString() const _IRR_OVERRIDE_\r
- {\r
- return Value;\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- return core::stringw(Value.c_str());\r
- }\r
-\r
- virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
- {\r
- if (intValue>=0 && intValue<(s32)EnumLiterals.size())\r
- Value = EnumLiterals[intValue];\r
- else\r
- Value = "";\r
- }\r
-\r
- virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_\r
- {\r
- setInt((s32)floatValue);\r
- };\r
-\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- Value = text;\r
- }\r
-\r
- virtual const char* getEnum() const _IRR_OVERRIDE_\r
- {\r
- return Value.c_str();\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_ENUM;\r
- }\r
-\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"enum";\r
- }\r
-\r
- core::stringc Value;\r
- core::array<core::stringc> EnumLiterals;\r
-};\r
-\r
-\r
-\r
-\r
-\r
-// Attribute implemented for strings\r
-class CStringAttribute : public IAttribute\r
-{\r
-public:\r
-\r
- CStringAttribute(const char* name, const char* value)\r
- {\r
- IsStringW=false;\r
- Name = name;\r
- setString(value);\r
- }\r
-\r
- CStringAttribute(const char* name, const wchar_t* value)\r
- {\r
- IsStringW = true;\r
- Name = name;\r
- setString(value);\r
- }\r
-\r
- CStringAttribute(const char* name, void* binaryData, s32 lengthInBytes)\r
- {\r
- IsStringW=false;\r
- Name = name;\r
- setBinary(binaryData, lengthInBytes);\r
- }\r
-\r
- virtual s32 getInt() const _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- return atoi(core::stringc(ValueW.c_str()).c_str());\r
- else\r
- return atoi(Value.c_str());\r
- }\r
-\r
- virtual f32 getFloat() const _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- return core::fast_atof(core::stringc(ValueW.c_str()).c_str());\r
- else\r
- return core::fast_atof(Value.c_str());\r
- }\r
-\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- return ValueW.equals_ignore_case(L"true");\r
- else\r
- return Value.equals_ignore_case("true");\r
- }\r
-\r
- virtual core::stringc getString() const _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- return core::stringc(ValueW.c_str());\r
- else\r
- return Value;\r
- }\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- return ValueW;\r
- else\r
- return core::stringw(Value.c_str());\r
- }\r
-\r
- virtual void setInt(s32 intValue) _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- ValueW = core::stringw(intValue);\r
- else\r
- Value = core::stringc(intValue);\r
- }\r
-\r
- virtual void setFloat(f32 floatValue) _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- {\r
- ValueW = core::stringw((double)floatValue);\r
- }\r
- else\r
- {\r
- Value = core::stringc((double)floatValue);\r
- }\r
- };\r
-\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- ValueW = core::stringw(text);\r
- else\r
- Value = text;\r
- }\r
-\r
- virtual void setString(const wchar_t* text) _IRR_OVERRIDE_\r
- {\r
- if (IsStringW)\r
- ValueW = text;\r
- else\r
- Value = core::stringc(text);\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_STRING;\r
- }\r
-\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"string";\r
- }\r
-\r
- virtual void getBinary(void* outdata, s32 maxLength) const _IRR_OVERRIDE_\r
- {\r
- const s32 dataSize = maxLength;\r
- c8* datac8 = (c8*)(outdata);\r
- s32 p = 0;\r
- const c8* dataString = Value.c_str();\r
-\r
- for (s32 i=0; i<dataSize; ++i)\r
- datac8[i] = 0;\r
-\r
- while(dataString[p] && p<dataSize)\r
- {\r
- s32 v = getByteFromHex((c8)dataString[p*2]) * 16;\r
-\r
- if (dataString[(p*2)+1])\r
- v += getByteFromHex((c8)dataString[(p*2)+1]);\r
-\r
- datac8[p] = v;\r
- ++p;\r
- }\r
- };\r
-\r
- virtual void setBinary(void* data, s32 maxLength) _IRR_OVERRIDE_\r
- {\r
- const s32 dataSize = maxLength;\r
- const c8* datac8 = (c8*)(data);\r
- char tmp[3];\r
- tmp[2] = 0;\r
- Value = "";\r
-\r
- for (s32 b=0; b<dataSize; ++b)\r
- {\r
- getHexStrFromByte(datac8[b], tmp);\r
- Value.append(tmp);\r
- }\r
- };\r
-\r
- bool IsStringW;\r
- core::stringc Value;\r
- core::stringw ValueW;\r
-\r
-protected:\r
-\r
- static inline s32 getByteFromHex(c8 h)\r
- {\r
- if (h >= '0' && h <='9')\r
- return h-'0';\r
-\r
- if (h >= 'a' && h <='f')\r
- return h-'a' + 10;\r
-\r
- return 0;\r
- }\r
-\r
- static inline void getHexStrFromByte(c8 byte, c8* out)\r
- {\r
- s32 b = (byte & 0xf0) >> 4;\r
-\r
- for (s32 i=0; i<2; ++i)\r
- {\r
- if (b >=0 && b <= 9)\r
- out[i] = b+'0';\r
- if (b >=10 && b <= 15)\r
- out[i] = (b-10)+'a';\r
-\r
- b = byte & 0x0f;\r
- }\r
- }\r
-};\r
-\r
-// Attribute implemented for binary data\r
-class CBinaryAttribute : public CStringAttribute\r
-{\r
-public:\r
-\r
- CBinaryAttribute(const char* name, void* binaryData, s32 lengthInBytes)\r
- : CStringAttribute(name, binaryData, lengthInBytes)\r
- {\r
-\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_BINARY;\r
- }\r
-\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"binary";\r
- }\r
-};\r
-\r
-\r
-\r
-// Attribute implemented for texture references\r
-class CTextureAttribute : public IAttribute\r
-{\r
-public:\r
-\r
- CTextureAttribute(const char* name, video::ITexture* value, video::IVideoDriver* driver, const io::path& filename)\r
- : Value(0), Driver(driver), OverrideName(filename)\r
- {\r
- if (Driver)\r
- Driver->grab();\r
-\r
- Name = name;\r
- setTexture(value);\r
- }\r
-\r
- virtual ~CTextureAttribute()\r
- {\r
- if (Driver)\r
- Driver->drop();\r
-\r
- if (Value)\r
- Value->drop();\r
- }\r
-\r
- virtual video::ITexture* getTexture() const _IRR_OVERRIDE_\r
- {\r
- return Value;\r
- }\r
-\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- return (Value != 0);\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- // (note: don't try to put all this in some ?: operators, or c++ builder will choke)\r
- if ( OverrideName.size() )\r
- return core::stringw(OverrideName);\r
-\r
- if ( Value )\r
- return core::stringw(Value->getName().getPath().c_str());\r
-\r
- return core::stringw();\r
- }\r
-\r
- virtual core::stringc getString() const _IRR_OVERRIDE_\r
- {\r
- // since texture names can be stringw we are careful with the types\r
- if ( OverrideName.size() )\r
- return core::stringc(OverrideName);\r
-\r
- if ( Value )\r
- return core::stringc(Value->getName().getPath().c_str());\r
-\r
- return core::stringc();\r
- }\r
-\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- if (Driver)\r
- {\r
- if (text && *text)\r
- {\r
- setTexture(Driver->getTexture(text));\r
- OverrideName=text;\r
- }\r
- else\r
- setTexture(0);\r
- }\r
- }\r
-\r
- virtual void setTexture(video::ITexture* texture, const path& filename) _IRR_OVERRIDE_\r
- {\r
- OverrideName = filename;\r
- setTexture(texture);\r
- };\r
-\r
- void setTexture(video::ITexture* value)\r
- {\r
- if ( value == Value )\r
- return;\r
-\r
- if (Value)\r
- Value->drop();\r
-\r
- Value = value;\r
-\r
- if (Value)\r
- Value->grab();\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_TEXTURE;\r
- }\r
-\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"texture";\r
- }\r
-\r
- video::ITexture* Value;\r
- video::IVideoDriver* Driver;\r
- io::path OverrideName;\r
-};\r
-\r
-\r
-\r
-// Attribute implemented for array of stringw\r
-class CStringWArrayAttribute : public IAttribute\r
-{\r
-public:\r
-\r
- CStringWArrayAttribute(const char* name, const core::array<core::stringw>& value)\r
- {\r
- Name = name;\r
- setArray(value);\r
- }\r
-\r
- virtual core::array<core::stringw> getArray() const _IRR_OVERRIDE_\r
- {\r
- return Value;\r
- }\r
-\r
- virtual void setArray(const core::array<core::stringw>& value) _IRR_OVERRIDE_\r
- {\r
- Value = value;\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_STRINGWARRAY;\r
- }\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"stringwarray";\r
- }\r
-\r
- core::array<core::stringw> Value;\r
-};\r
-\r
-\r
-// Attribute implemented for user pointers\r
-class CUserPointerAttribute : public IAttribute\r
-{\r
-public:\r
-\r
- CUserPointerAttribute(const char* name, void* value)\r
- {\r
- Name = name;\r
- Value = value;\r
- }\r
-\r
- virtual s32 getInt() const _IRR_OVERRIDE_\r
- {\r
- return *static_cast<s32*>(Value);\r
- }\r
-\r
- virtual bool getBool() const _IRR_OVERRIDE_\r
- {\r
- return (Value != 0);\r
- }\r
-\r
- virtual core::stringw getStringW() const _IRR_OVERRIDE_\r
- {\r
- wchar_t buf[32];\r
- swprintf_irr(buf, 32, L"%p", Value);\r
-\r
- return core::stringw(buf);\r
- }\r
-\r
- virtual void setString(const char* text) _IRR_OVERRIDE_\r
- {\r
- size_t val = 0;\r
- switch ( sizeof(void*) )\r
- {\r
- case 4:\r
- {\r
- unsigned int tmp; // not using an irrlicht type - sscanf with %x needs always unsigned int\r
- sscanf(text, "%x", &tmp);\r
- val = (size_t)tmp;\r
- }\r
- break;\r
- case 8:\r
- {\r
-#ifdef _MSC_VER\r
- const unsigned __int64 tmp = _strtoui64(text, NULL, 16);\r
-#else\r
- const unsigned long long tmp = strtoull(text, NULL, 16);\r
-#endif\r
- val = (size_t)tmp;\r
- }\r
- break;\r
- }\r
- Value = (void *)val;\r
- }\r
-\r
- virtual E_ATTRIBUTE_TYPE getType() const _IRR_OVERRIDE_\r
- {\r
- return EAT_USER_POINTER;\r
- }\r
-\r
- virtual void setUserPointer(void* v) _IRR_OVERRIDE_\r
- {\r
- Value = v;\r
- }\r
-\r
- virtual void* getUserPointer() const _IRR_OVERRIDE_\r
- {\r
- return Value;\r
- }\r
-\r
-\r
- virtual const wchar_t* getTypeString() const _IRR_OVERRIDE_\r
- {\r
- return L"userPointer";\r
- }\r
-\r
- void* Value;\r
-};\r
-\r
-\r
-\r
-// todo: CGUIFontAttribute\r
-\r
} // end namespace io\r
} // end namespace irr\r
Attributes.clear();\r
}\r
\r
-\r
-//! Sets a string attribute.\r
-//! \param attributeName: Name for the attribute\r
-//! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
-void CAttributes::setAttribute(const c8* attributeName, const c8* value)\r
-{\r
- for (u32 i=0; i<Attributes.size(); ++i)\r
- if (Attributes[i]->Name == attributeName)\r
- {\r
- if (!value)\r
- {\r
- Attributes[i]->drop();\r
- Attributes.erase(i);\r
- }\r
- else\r
- Attributes[i]->setString(value);\r
-\r
- return;\r
- }\r
-\r
- if (value)\r
- {\r
- Attributes.push_back(new CStringAttribute(attributeName, value));\r
- }\r
-}\r
-\r
-//! Gets a string attribute.\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setStringAttribute()\r
-//! or 0 if attribute is not set.\r
-core::stringc CAttributes::getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getString();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets a string attribute.\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \param target: Buffer where the string is copied to.\r
-void CAttributes::getAttributeAsString(const c8* attributeName, char* target) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- {\r
- core::stringc str = att->getString();\r
- strcpy(target,str.c_str());\r
- }\r
- else\r
- target[0] = 0;\r
-}\r
-\r
-//! Returns string attribute value by index.\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-core::stringc CAttributes::getAttributeAsString(s32 index) const\r
-{\r
- core::stringc str;\r
-\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getString();\r
-\r
- return str;\r
-}\r
-\r
-\r
-//! Sets a string attribute.\r
-//! \param attributeName: Name for the attribute\r
-//! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
-void CAttributes::setAttribute(const c8* attributeName, const wchar_t* value)\r
-{\r
- for (u32 i=0; i<Attributes.size(); ++i)\r
- {\r
- if (Attributes[i]->Name == attributeName)\r
- {\r
- if (!value)\r
- {\r
- Attributes[i]->drop();\r
- Attributes.erase(i);\r
- }\r
- else\r
- Attributes[i]->setString(value);\r
-\r
- return;\r
- }\r
- }\r
-\r
- if (value)\r
- {\r
- Attributes.push_back(new CStringAttribute(attributeName, value));\r
- }\r
-}\r
-\r
-//! Gets a string attribute.\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setStringAttribute()\r
-//! or 0 if attribute is not set.\r
-core::stringw CAttributes::getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getStringW();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets a string attribute.\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \param target: Buffer where the string is copied to.\r
-void CAttributes::getAttributeAsStringW(const c8* attributeName, wchar_t* target) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- {\r
- core::stringw str = att->getStringW();\r
- wcscpy(target,str.c_str());\r
- }\r
- else\r
- target[0] = 0;\r
-}\r
-\r
-//! Returns string attribute value by index.\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-core::stringw CAttributes::getAttributeAsStringW(s32 index) const\r
-{\r
-\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getStringW();\r
- else\r
- return core::stringw();\r
-}\r
-\r
-\r
-//! Adds an attribute as an array of wide strings\r
-void CAttributes::addArray(const c8* attributeName, const core::array<core::stringw>& value)\r
-{\r
- Attributes.push_back(new CStringWArrayAttribute(attributeName, value));\r
-}\r
-\r
-//! Sets an attribute value as an array of wide strings.\r
-void CAttributes::setAttribute(const c8* attributeName, const core::array<core::stringw>& value)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setArray(value);\r
- else\r
- {\r
- Attributes.push_back(new CStringWArrayAttribute(attributeName, value));\r
- }\r
-}\r
-\r
-//! Gets an attribute as an array of wide strings.\r
-core::array<core::stringw> CAttributes::getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getArray();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Returns attribute value as an array of wide strings by index.\r
-core::array<core::stringw> CAttributes::getAttributeAsArray(s32 index) const\r
-{\r
- core::array<core::stringw> ret;\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getArray();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as an array of wide strings\r
-void CAttributes::setAttribute(s32 index, const core::array<core::stringw>& value)\r
-{\r
- if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setArray(value);\r
-}\r
-\r
-\r
-\r
-\r
//! Returns attribute index from name, -1 if not found\r
s32 CAttributes::findAttribute(const c8* attributeName) const\r
{\r
return 0;\r
}\r
\r
-\r
//! Sets a attribute as boolean value\r
void CAttributes::setAttribute(const c8* attributeName, bool value)\r
{\r
return defaultNotFound;\r
}\r
\r
-//! Sets a attribute as color\r
-void CAttributes::setAttribute(const c8* attributeName, video::SColor value)\r
+//! Returns amount of string attributes set in this scene manager.\r
+u32 CAttributes::getAttributeCount() const\r
{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setColor(value);\r
- else\r
- Attributes.push_back(new CColorAttribute(attributeName, value));\r
+ return Attributes.size();\r
}\r
\r
-//! Gets an attribute as color\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-video::SColor CAttributes::getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound) const\r
+//! Returns string attribute name by index.\r
+//! \param index: Index value, must be between 0 and getStringAttributeCount()-1.\r
+const c8* CAttributes::getAttributeName(s32 index) const\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getColor();\r
- else\r
- return defaultNotFound;\r
-}\r
+ if ((u32)index >= Attributes.size())\r
+ return 0;\r
\r
-//! Sets a attribute as floating point color\r
-void CAttributes::setAttribute(const c8* attributeName, video::SColorf value)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setColor(value);\r
- else\r
- Attributes.push_back(new CColorfAttribute(attributeName, value));\r
+ return Attributes[index]->Name.c_str();\r
}\r
\r
-//! Gets an attribute as floating point color\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-video::SColorf CAttributes::getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound) const\r
+//! Returns the type of an attribute\r
+E_ATTRIBUTE_TYPE CAttributes::getAttributeType(const c8* attributeName) const\r
{\r
+ E_ATTRIBUTE_TYPE ret = EAT_UNKNOWN;\r
+\r
const IAttribute* att = getAttributeP(attributeName);\r
if (att)\r
- return att->getColorf();\r
- else\r
- return defaultNotFound;\r
-}\r
+ ret = att->getType();\r
\r
-//! Sets a attribute as 2d position\r
-void CAttributes::setAttribute(const c8* attributeName, const core::position2di& value)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setPosition(value);\r
- else\r
- Attributes.push_back(new CPosition2DAttribute(attributeName, value));\r
+ return ret;\r
}\r
\r
-//! Gets an attribute as 2d position\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-core::position2di CAttributes::getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound) const\r
+//! Returns attribute type by index.\r
+//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
+E_ATTRIBUTE_TYPE CAttributes::getAttributeType(s32 index) const\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getPosition();\r
- else\r
- return defaultNotFound;\r
-}\r
+ if ((u32)index >= Attributes.size())\r
+ return EAT_UNKNOWN;\r
\r
-//! Sets a attribute as rectangle\r
-void CAttributes::setAttribute(const c8* attributeName, const core::rect<s32>& value)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setRect(value);\r
- else\r
- Attributes.push_back(new CRectAttribute(attributeName, value));\r
+ return Attributes[index]->getType();\r
}\r
\r
-//! Gets an attribute as rectangle\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-core::rect<s32> CAttributes::getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound) const\r
+//! Returns the type of an attribute\r
+const wchar_t* CAttributes::getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound) const\r
{\r
const IAttribute* att = getAttributeP(attributeName);\r
if (att)\r
- return att->getRect();\r
+ return att->getTypeString();\r
else\r
return defaultNotFound;\r
}\r
\r
-//! Sets a attribute as dimension2d\r
-void CAttributes::setAttribute(const c8* attributeName, const core::dimension2d<u32>& value)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setDimension2d(value);\r
- else\r
- Attributes.push_back(new CDimension2dAttribute(attributeName, value));\r
-}\r
-\r
-//! Gets an attribute as dimension2d\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-core::dimension2d<u32> CAttributes::getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound) const\r
+//! Returns attribute type string by index.\r
+//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
+const wchar_t* CAttributes::getAttributeTypeString(s32 index, const wchar_t* defaultNotFound) const\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getDimension2d();\r
- else\r
+ if ((u32)index >= Attributes.size())\r
return defaultNotFound;\r
-}\r
\r
-//! Sets a attribute as vector\r
-void CAttributes::setAttribute(const c8* attributeName, const core::vector3df& value)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setVector(value);\r
- else\r
- Attributes.push_back(new CVector3DAttribute(attributeName, value));\r
+ return Attributes[index]->getTypeString();\r
}\r
\r
-//! Sets a attribute as vector\r
-void CAttributes::setAttribute(const c8* attributeName, const core::vector2df& value)\r
+//! Gets an attribute as integer value\r
+//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
+s32 CAttributes::getAttributeAsInt(s32 index) const\r
{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setVector2d(value);\r
+ if ((u32)index < Attributes.size())\r
+ return Attributes[index]->getInt();\r
else\r
- Attributes.push_back(new CVector2DAttribute(attributeName, value));\r
+ return 0;\r
}\r
\r
-//! Gets an attribute as vector\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-core::vector3df CAttributes::getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound) const\r
+//! Gets an attribute as float value\r
+//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
+f32 CAttributes::getAttributeAsFloat(s32 index) const\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getVector();\r
+ if ((u32)index < Attributes.size())\r
+ return Attributes[index]->getFloat();\r
else\r
- return defaultNotFound;\r
+ return 0.f;\r
}\r
\r
-//! Gets an attribute as vector\r
-core::vector2df CAttributes::getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound) const\r
+//! Gets an attribute as boolean value\r
+//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
+bool CAttributes::getAttributeAsBool(s32 index) const\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getVector2d();\r
- else\r
- return defaultNotFound;\r
+ bool ret = false;\r
+\r
+ if ((u32)index < Attributes.size())\r
+ ret = Attributes[index]->getBool();\r
+\r
+ return ret;\r
}\r
\r
-//! Sets an attribute as binary data\r
-void CAttributes::setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes )\r
+//! Adds an attribute as integer\r
+void CAttributes::addInt(const c8* attributeName, s32 value)\r
{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setBinary(data, dataSizeInBytes);\r
- else\r
- Attributes.push_back(new CBinaryAttribute(attributeName, data, dataSizeInBytes));\r
+ Attributes.push_back(new CIntAttribute(attributeName, value));\r
}\r
\r
-//! Gets an attribute as binary data\r
-//! \param attributeName: Name of the attribute to get.\r
-void CAttributes::getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const\r
+//! Adds an attribute as float\r
+void CAttributes::addFloat(const c8* attributeName, f32 value)\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->getBinary(outData, maxSizeInBytes);\r
+ Attributes.push_back(new CFloatAttribute(attributeName, value));\r
}\r
\r
-//! Sets an attribute as enumeration\r
-void CAttributes::setAttribute(const c8* attributeName, const char* enumValue, const char* const* enumerationLiterals)\r
+//! Adds an attribute as bool\r
+void CAttributes::addBool(const c8* attributeName, bool value)\r
{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setEnum(enumValue, enumerationLiterals);\r
- else\r
- Attributes.push_back(new CEnumAttribute(attributeName, enumValue, enumerationLiterals));\r
+ Attributes.push_back(new CBoolAttribute(attributeName, value));\r
}\r
\r
-//! Gets an attribute as enumeration\r
-//! \param attributeName: Name of the attribute to get.\r
-//! \return Returns value of the attribute previously set by setAttribute()\r
-const char* CAttributes::getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound) const\r
+//! Returns if an attribute with a name exists\r
+bool CAttributes::existsAttribute(const c8* attributeName) const\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getEnum();\r
- else\r
- return defaultNotFound;\r
+ return getAttributeP(attributeName) != 0;\r
}\r
\r
-//! Gets an attribute as enumeration\r
-s32 CAttributes::getAttributeAsEnumeration(const c8* attributeName, const char* const* enumerationLiteralsToUse, s32 defaultNotFound) const\r
+//! Sets an attribute as boolean value\r
+void CAttributes::setAttribute(s32 index, bool value)\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
-\r
- if (enumerationLiteralsToUse && att)\r
- {\r
- const char* value = att->getEnum();\r
- if (value)\r
- {\r
- for (s32 i=0; enumerationLiteralsToUse[i]; ++i)\r
- if (!strcmp(value, enumerationLiteralsToUse[i]))\r
- return i;\r
- }\r
- }\r
-\r
- return defaultNotFound;\r
+ if ((u32)index < Attributes.size())\r
+ Attributes[index]->setBool(value);\r
}\r
\r
-//! Gets the list of enumeration literals of an enumeration attribute\r
-//! \param attributeName: Name of the attribute to get.\r
-void CAttributes::getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) const\r
+//! Sets an attribute as integer value\r
+void CAttributes::setAttribute(s32 index, s32 value)\r
{\r
- const IAttribute* att = getAttributeP(attributeName);\r
-\r
- if (att && att->getType() == EAT_ENUM)\r
- outLiterals = ((CEnumAttribute*)att)->EnumLiterals;\r
+ if ((u32)index < Attributes.size())\r
+ Attributes[index]->setInt(value);\r
}\r
\r
-//! Sets an attribute as texture reference\r
-void CAttributes::setAttribute(const c8* attributeName, video::ITexture* value, const io::path& filename)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setTexture(value, filename);\r
- else\r
- Attributes.push_back(new CTextureAttribute(attributeName, value, Driver, filename));\r
-}\r
-\r
-\r
-//! Gets an attribute as texture reference\r
-//! \param attributeName: Name of the attribute to get.\r
-video::ITexture* CAttributes::getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getTexture();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as texture reference\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-video::ITexture* CAttributes::getAttributeAsTexture(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getTexture();\r
- else\r
- return 0;\r
-}\r
-\r
-\r
-//! Returns amount of string attributes set in this scene manager.\r
-u32 CAttributes::getAttributeCount() const\r
-{\r
- return Attributes.size();\r
-}\r
-\r
-//! Returns string attribute name by index.\r
-//! \param index: Index value, must be between 0 and getStringAttributeCount()-1.\r
-const c8* CAttributes::getAttributeName(s32 index) const\r
-{\r
- if ((u32)index >= Attributes.size())\r
- return 0;\r
-\r
- return Attributes[index]->Name.c_str();\r
-}\r
-\r
-//! Returns the type of an attribute\r
-E_ATTRIBUTE_TYPE CAttributes::getAttributeType(const c8* attributeName) const\r
-{\r
- E_ATTRIBUTE_TYPE ret = EAT_UNKNOWN;\r
-\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- ret = att->getType();\r
-\r
- return ret;\r
-}\r
-\r
-//! Returns attribute type by index.\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-E_ATTRIBUTE_TYPE CAttributes::getAttributeType(s32 index) const\r
-{\r
- if ((u32)index >= Attributes.size())\r
- return EAT_UNKNOWN;\r
-\r
- return Attributes[index]->getType();\r
-}\r
-\r
-//! Returns the type of an attribute\r
-const wchar_t* CAttributes::getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getTypeString();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Returns attribute type string by index.\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-const wchar_t* CAttributes::getAttributeTypeString(s32 index, const wchar_t* defaultNotFound) const\r
-{\r
- if ((u32)index >= Attributes.size())\r
- return defaultNotFound;\r
-\r
- return Attributes[index]->getTypeString();\r
-}\r
-\r
-//! Gets an attribute as boolean value\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-bool CAttributes::getAttributeAsBool(s32 index) const\r
-{\r
- bool ret = false;\r
-\r
- if ((u32)index < Attributes.size())\r
- ret = Attributes[index]->getBool();\r
-\r
- return ret;\r
-}\r
-\r
-//! Gets an attribute as integer value\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-s32 CAttributes::getAttributeAsInt(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getInt();\r
- else\r
- return 0;\r
-}\r
-\r
-//! Gets an attribute as float value\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-f32 CAttributes::getAttributeAsFloat(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getFloat();\r
- else\r
- return 0.f;\r
-}\r
-\r
-//! Gets an attribute as color\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-video::SColor CAttributes::getAttributeAsColor(s32 index) const\r
-{\r
- video::SColor ret(0);\r
-\r
- if ((u32)index < Attributes.size())\r
- ret = Attributes[index]->getColor();\r
-\r
- return ret;\r
-}\r
-\r
-//! Gets an attribute as floating point color\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-video::SColorf CAttributes::getAttributeAsColorf(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getColorf();\r
-\r
- return video::SColorf();\r
-}\r
-\r
-//! Gets an attribute as 3d vector\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-core::vector3df CAttributes::getAttributeAsVector3d(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getVector();\r
- else\r
- return core::vector3df();\r
-}\r
-\r
-//! Gets an attribute as 2d vector\r
-core::vector2df CAttributes::getAttributeAsVector2d(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getVector2d();\r
- else\r
- return core::vector2df();\r
-}\r
-\r
-//! Gets an attribute as position2d\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-core::position2di CAttributes::getAttributeAsPosition2d(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getPosition();\r
- else\r
- return core::position2di();\r
-}\r
-\r
-//! Gets an attribute as rectangle\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-core::rect<s32> CAttributes::getAttributeAsRect(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getRect();\r
- else\r
- return core::rect<s32>();\r
-}\r
-\r
-//! Gets an attribute as dimension2d\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-core::dimension2d<u32> CAttributes::getAttributeAsDimension2d(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getDimension2d();\r
- else\r
- return core::dimension2d<u32>();\r
-}\r
-\r
-\r
-//! Gets an attribute as binary data\r
-///! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-void CAttributes::getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->getBinary(outData, maxSizeInBytes);\r
-}\r
-\r
-\r
-//! Gets an attribute as enumeration\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-const char* CAttributes::getAttributeAsEnumeration(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getEnum();\r
- else\r
- return 0;\r
-}\r
-\r
-\r
-//! Gets an attribute as enumeration\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-s32 CAttributes::getAttributeAsEnumeration(s32 index, const char* const* enumerationLiteralsToUse, s32 defaultNotFound) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- {\r
- const IAttribute* att = Attributes[index];\r
-\r
- if (enumerationLiteralsToUse && att)\r
- {\r
- const char* value = att->getEnum();\r
- if (value)\r
- {\r
- for (s32 i=0; enumerationLiteralsToUse[i]; ++i)\r
- if (!strcmp(value, enumerationLiteralsToUse[i]))\r
- return i;\r
- }\r
- }\r
- }\r
-\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets the list of enumeration literals of an enumeration attribute\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-void CAttributes::getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) const\r
-{\r
- if ((u32)index < Attributes.size() &&\r
- Attributes[index]->getType() == EAT_ENUM)\r
- outLiterals = ((CEnumAttribute*)Attributes[index])->EnumLiterals;\r
-}\r
-\r
-\r
-//! Adds an attribute as integer\r
-void CAttributes::addInt(const c8* attributeName, s32 value)\r
-{\r
- Attributes.push_back(new CIntAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as float\r
-void CAttributes::addFloat(const c8* attributeName, f32 value)\r
-{\r
- Attributes.push_back(new CFloatAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as string\r
-void CAttributes::addString(const c8* attributeName, const char* value)\r
-{\r
- Attributes.push_back(new CStringAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as wchar string\r
-void CAttributes::addString(const c8* attributeName, const wchar_t* value)\r
-{\r
- Attributes.push_back(new CStringAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as bool\r
-void CAttributes::addBool(const c8* attributeName, bool value)\r
-{\r
- Attributes.push_back(new CBoolAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as enum\r
-void CAttributes::addEnum(const c8* attributeName, const char* enumValue, const char* const* enumerationLiterals)\r
-{\r
- Attributes.push_back(new CEnumAttribute(attributeName, enumValue, enumerationLiterals));\r
-}\r
-\r
-//! Adds an attribute as enum\r
-void CAttributes::addEnum(const c8* attributeName, s32 enumValue, const char* const* enumerationLiterals)\r
-{\r
- addEnum(attributeName, "", enumerationLiterals);\r
- Attributes.getLast()->setInt(enumValue);\r
-}\r
-\r
-//! Adds an attribute as color\r
-void CAttributes::addColor(const c8* attributeName, video::SColor value)\r
-{\r
- Attributes.push_back(new CColorAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as floating point color\r
-void CAttributes::addColorf(const c8* attributeName, video::SColorf value)\r
-{\r
- Attributes.push_back(new CColorfAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as 3d vector\r
-void CAttributes::addVector3d(const c8* attributeName, const core::vector3df& value)\r
-{\r
- Attributes.push_back(new CVector3DAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as 2d vector\r
-void CAttributes::addVector2d(const c8* attributeName, const core::vector2df& value)\r
-{\r
- Attributes.push_back(new CVector2DAttribute(attributeName, value));\r
-}\r
-\r
-\r
-//! Adds an attribute as 2d position\r
-void CAttributes::addPosition2d(const c8* attributeName, const core::position2di& value)\r
-{\r
- Attributes.push_back(new CPosition2DAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as rectangle\r
-void CAttributes::addRect(const c8* attributeName, const core::rect<s32>& value)\r
-{\r
- Attributes.push_back(new CRectAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as dimension2d\r
-void CAttributes::addDimension2d(const c8* attributeName, const core::dimension2d<u32>& value)\r
-{\r
- Attributes.push_back(new CDimension2dAttribute(attributeName, value));\r
-}\r
-\r
-//! Adds an attribute as binary data\r
-void CAttributes::addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes)\r
-{\r
- Attributes.push_back(new CBinaryAttribute(attributeName, data, dataSizeInBytes));\r
-}\r
-\r
-//! Adds an attribute as texture reference\r
-void CAttributes::addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename)\r
-{\r
- Attributes.push_back(new CTextureAttribute(attributeName, texture, Driver, filename));\r
-}\r
-\r
-//! Returns if an attribute with a name exists\r
-bool CAttributes::existsAttribute(const c8* attributeName) const\r
-{\r
- return getAttributeP(attributeName) != 0;\r
-}\r
-\r
-//! Sets an attribute value as string.\r
-//! \param attributeName: Name for the attribute\r
-void CAttributes::setAttribute(s32 index, const c8* value)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setString(value);\r
-}\r
-\r
-//! Sets an attribute value as string.\r
-//! \param attributeName: Name for the attribute\r
-void CAttributes::setAttribute(s32 index, const wchar_t* value)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setString(value);\r
-}\r
-\r
-//! Sets an attribute as boolean value\r
-void CAttributes::setAttribute(s32 index, bool value)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setBool(value);\r
-}\r
-\r
-//! Sets an attribute as integer value\r
-void CAttributes::setAttribute(s32 index, s32 value)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setInt(value);\r
-}\r
-\r
-//! Sets a attribute as float value\r
-void CAttributes::setAttribute(s32 index, f32 value)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setFloat(value);\r
-}\r
-\r
-//! Sets a attribute as color\r
-void CAttributes::setAttribute(s32 index, video::SColor color)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setColor(color);\r
-}\r
-\r
-//! Sets a attribute as floating point color\r
-void CAttributes::setAttribute(s32 index, video::SColorf color)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setColor(color);\r
-}\r
-\r
-//! Sets a attribute as vector\r
-void CAttributes::setAttribute(s32 index, const core::vector3df& v)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setVector(v);\r
-}\r
-\r
-//! Sets a attribute as vector\r
-void CAttributes::setAttribute(s32 index, const core::vector2df& v)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setVector2d(v);\r
-}\r
-\r
-//! Sets a attribute as position\r
-void CAttributes::setAttribute(s32 index, const core::position2di& v)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setPosition(v);\r
-}\r
-\r
-//! Sets a attribute as rectangle\r
-void CAttributes::setAttribute(s32 index, const core::rect<s32>& v)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setRect(v);\r
-}\r
-\r
-//! Sets a attribute as dimension2d\r
-void CAttributes::setAttribute(s32 index, const core::dimension2d<u32>& v)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setDimension2d(v);\r
-}\r
-\r
-//! Sets an attribute as binary data\r
-void CAttributes::setAttribute(s32 index, void* data, s32 dataSizeInBytes )\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setBinary(data, dataSizeInBytes);\r
-}\r
-\r
-\r
-//! Sets an attribute as enumeration\r
-void CAttributes::setAttribute(s32 index, const char* enumValue, const char* const* enumerationLiterals)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setEnum(enumValue, enumerationLiterals);\r
-}\r
-\r
-\r
-//! Sets an attribute as texture reference\r
-void CAttributes::setAttribute(s32 index, video::ITexture* texture, const io::path& filename)\r
+//! Sets a attribute as float value\r
+void CAttributes::setAttribute(s32 index, f32 value)\r
{\r
if ((u32)index < Attributes.size())\r
- Attributes[index]->setTexture(texture, filename);\r
-}\r
-\r
-\r
-//! Adds an attribute as matrix\r
-void CAttributes::addMatrix(const c8* attributeName, const core::matrix4& v)\r
-{\r
- Attributes.push_back(new CMatrixAttribute(attributeName, v));\r
-}\r
-\r
-\r
-//! Sets an attribute as matrix\r
-void CAttributes::setAttribute(const c8* attributeName, const core::matrix4& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setMatrix(v);\r
- else\r
- Attributes.push_back(new CMatrixAttribute(attributeName, v));\r
-}\r
-\r
-//! Gets an attribute as a matrix4\r
-core::matrix4 CAttributes::getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getMatrix();\r
- else\r
- return defaultNotFound;\r
-\r
-}\r
-\r
-//! Gets an attribute as matrix\r
-core::matrix4 CAttributes::getAttributeAsMatrix(s32 index) const\r
-{\r
- if ((u32)index < Attributes.size())\r
- return Attributes[index]->getMatrix();\r
- else\r
- return core::matrix4();\r
-}\r
-\r
-//! Sets an attribute as matrix\r
-void CAttributes::setAttribute(s32 index, const core::matrix4& v)\r
-{\r
- if ((u32)index < Attributes.size())\r
- Attributes[index]->setMatrix(v);\r
-}\r
-\r
-\r
-//! Adds an attribute as quaternion\r
-void CAttributes::addQuaternion(const c8* attributeName, const core::quaternion& v)\r
-{\r
- Attributes.push_back(new CQuaternionAttribute(attributeName, v));\r
-}\r
-\r
-\r
-//! Sets an attribute as quaternion\r
-void CAttributes::setAttribute(const c8* attributeName, const core::quaternion& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setQuaternion(v);\r
- else\r
- {\r
- Attributes.push_back(new CQuaternionAttribute(attributeName, v));\r
- }\r
-}\r
-\r
-//! Gets an attribute as a quaternion\r
-core::quaternion CAttributes::getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getQuaternion();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as quaternion\r
-core::quaternion CAttributes::getAttributeAsQuaternion(s32 index) const\r
-{\r
- core::quaternion ret(0,1,0, 0);\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getQuaternion();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as quaternion\r
-void CAttributes::setAttribute(s32 index, const core::quaternion& v)\r
-{\r
-if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setQuaternion(v);\r
-}\r
-\r
-//! Adds an attribute as axis aligned bounding box\r
-void CAttributes::addBox3d(const c8* attributeName, const core::aabbox3df& v)\r
-{\r
- Attributes.push_back(new CBBoxAttribute(attributeName, v));\r
-}\r
-\r
-//! Sets an attribute as axis aligned bounding box\r
-void CAttributes::setAttribute(const c8* attributeName, const core::aabbox3df& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setBBox(v);\r
- else\r
- {\r
- Attributes.push_back(new CBBoxAttribute(attributeName, v));\r
- }\r
-}\r
-\r
-//! Gets an attribute as a axis aligned bounding box\r
-core::aabbox3df CAttributes::getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getBBox();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as axis aligned bounding box\r
-core::aabbox3df CAttributes::getAttributeAsBox3d(s32 index) const\r
-{\r
- core::aabbox3df ret(0,0,0, 0,0,0);\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getBBox();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as axis aligned bounding box\r
-void CAttributes::setAttribute(s32 index, const core::aabbox3df& v)\r
-{\r
-if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setBBox(v);\r
-}\r
-\r
-//! Adds an attribute as 3d plane\r
-void CAttributes::addPlane3d(const c8* attributeName, const core::plane3df& v)\r
-{\r
- Attributes.push_back(new CPlaneAttribute(attributeName, v));\r
-}\r
-\r
-//! Sets an attribute as 3d plane\r
-void CAttributes::setAttribute(const c8* attributeName, const core::plane3df& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setPlane(v);\r
- else\r
- {\r
- Attributes.push_back(new CPlaneAttribute(attributeName, v));\r
- }\r
-}\r
-\r
-//! Gets an attribute as a 3d plane\r
-core::plane3df CAttributes::getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getPlane();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as 3d plane\r
-core::plane3df CAttributes::getAttributeAsPlane3d(s32 index) const\r
-{\r
- core::plane3df ret(0,0,0, 0,1,0);\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getPlane();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as 3d plane\r
-void CAttributes::setAttribute(s32 index, const core::plane3df& v)\r
-{\r
- if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setPlane(v);\r
-}\r
-\r
-//! Adds an attribute as 3d triangle\r
-void CAttributes::addTriangle3d(const c8* attributeName, const core::triangle3df& v)\r
-{\r
- Attributes.push_back(new CTriangleAttribute(attributeName, v));\r
-}\r
-\r
-//! Sets an attribute as 3d triangle\r
-void CAttributes::setAttribute(const c8* attributeName, const core::triangle3df& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setTriangle(v);\r
- else\r
- {\r
- Attributes.push_back(new CTriangleAttribute(attributeName, v));\r
- }\r
-}\r
-\r
-//! Gets an attribute as a 3d triangle\r
-core::triangle3df CAttributes::getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getTriangle();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as 3d triangle\r
-core::triangle3df CAttributes::getAttributeAsTriangle3d(s32 index) const\r
-{\r
- core::triangle3df ret;\r
- ret.pointA = ret.pointB = ret.pointC = core::vector3df(0,0,0);\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getTriangle();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as 3d triangle\r
-void CAttributes::setAttribute(s32 index, const core::triangle3df& v)\r
-{\r
- if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setTriangle(v);\r
-}\r
-\r
-//! Adds an attribute as a 2d line\r
-void CAttributes::addLine2d(const c8* attributeName, const core::line2df& v)\r
-{\r
- Attributes.push_back(new CLine2dAttribute(attributeName, v));\r
-}\r
-\r
-//! Sets an attribute as a 2d line\r
-void CAttributes::setAttribute(const c8* attributeName, const core::line2df& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setLine2d(v);\r
- else\r
- {\r
- Attributes.push_back(new CLine2dAttribute(attributeName, v));\r
- }\r
-}\r
-\r
-//! Gets an attribute as a 2d line\r
-core::line2df CAttributes::getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getLine2d();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as a 2d line\r
-core::line2df CAttributes::getAttributeAsLine2d(s32 index) const\r
-{\r
- core::line2df ret(0,0, 0,0);\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getLine2d();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as a 2d line\r
-void CAttributes::setAttribute(s32 index, const core::line2df& v)\r
-{\r
- if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setLine2d(v);\r
-}\r
-\r
-//! Adds an attribute as a 3d line\r
-void CAttributes::addLine3d(const c8* attributeName, const core::line3df& v)\r
-{\r
- Attributes.push_back(new CLine3dAttribute(attributeName, v));\r
-}\r
-\r
-//! Sets an attribute as a 3d line\r
-void CAttributes::setAttribute(const c8* attributeName, const core::line3df& v)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setLine3d(v);\r
- else\r
- {\r
- Attributes.push_back(new CLine3dAttribute(attributeName, v));\r
- }\r
-}\r
-\r
-//! Gets an attribute as a 3d line\r
-core::line3df CAttributes::getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getLine3d();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as a 3d line\r
-core::line3df CAttributes::getAttributeAsLine3d(s32 index) const\r
-{\r
- core::line3df ret(0,0,0, 0,0,0);\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- ret = Attributes[index]->getLine3d();\r
-\r
- return ret;\r
-}\r
-\r
-//! Sets an attribute as a 3d line\r
-void CAttributes::setAttribute(s32 index, const core::line3df& v)\r
-{\r
- if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setLine3d(v);\r
-\r
-}\r
-\r
-\r
-//! Adds an attribute as user pointer\r
-void CAttributes::addUserPointer(const c8* attributeName, void* userPointer)\r
-{\r
- Attributes.push_back(new CUserPointerAttribute(attributeName, userPointer));\r
-}\r
-\r
-//! Sets an attribute as user pointer\r
-void CAttributes::setAttribute(const c8* attributeName, void* userPointer)\r
-{\r
- IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- att->setUserPointer(userPointer);\r
- else\r
- {\r
- Attributes.push_back(new CUserPointerAttribute(attributeName, userPointer));\r
- }\r
-}\r
-\r
-//! Gets an attribute as user pointer\r
-//! \param attributeName: Name of the attribute to get.\r
-void* CAttributes::getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound) const\r
-{\r
- const IAttribute* att = getAttributeP(attributeName);\r
- if (att)\r
- return att->getUserPointer();\r
- else\r
- return defaultNotFound;\r
-}\r
-\r
-//! Gets an attribute as user pointer\r
-//! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
-void* CAttributes::getAttributeAsUserPointer(s32 index) const\r
-{\r
- void* value = 0;\r
-\r
- if (index >= 0 && index < (s32)Attributes.size())\r
- value = Attributes[index]->getUserPointer();\r
-\r
- return value;\r
-}\r
-\r
-//! Sets an attribute as user pointer\r
-void CAttributes::setAttribute(s32 index, void* userPointer)\r
-{\r
- if (index >= 0 && index < (s32)Attributes.size() )\r
- Attributes[index]->setUserPointer(userPointer);\r
+ Attributes[index]->setFloat(value);\r
}\r
\r
-\r
} // end namespace io\r
} // end namespace irr\r
\r
//! Sets an attribute as float value\r
virtual void setAttribute(s32 index, f32 value) _IRR_OVERRIDE_;\r
\r
- /*\r
-\r
- String Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as string\r
- virtual void addString(const c8* attributeName, const c8* value) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param attributeName: Name for the attribute\r
- //! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
- virtual void setAttribute(const c8* attributeName, const c8* value) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- //! or defaultNotFound if attribute is not set.\r
- virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param target: Buffer where the string is copied to.\r
- virtual void getAttributeAsString(const c8* attributeName, c8* target) const _IRR_OVERRIDE_;\r
-\r
- //! Returns attribute value as string by index.\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::stringc getAttributeAsString(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param attributeName: Name for the attribute\r
- virtual void setAttribute(s32 index, const c8* value) _IRR_OVERRIDE_;\r
-\r
- // wide strings\r
-\r
- //! Adds an attribute as string\r
- virtual void addString(const c8* attributeName, const wchar_t* value) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param attributeName: Name for the attribute\r
- //! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
- virtual void setAttribute(const c8* attributeName, const wchar_t* value) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- //! or defaultNotFound if attribute is not set.\r
- virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as string.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param target: Buffer where the string is copied to.\r
- virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) const _IRR_OVERRIDE_;\r
-\r
- //! Returns attribute value as string by index.\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::stringw getAttributeAsStringW(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute value as string.\r
- //! \param attributeName: Name for the attribute\r
- virtual void setAttribute(s32 index, const wchar_t* value) _IRR_OVERRIDE_;\r
-\r
- /*\r
-\r
- Binary Data Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as binary data\r
- virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as binary data\r
- virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as binary data\r
- //! \param attributeName: Name of the attribute to get.\r
- virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as binary data\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as binary data\r
- virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- Array Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as wide string array\r
- virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute value as a wide string array.\r
- //! \param attributeName: Name for the attribute\r
- //! \param value: Value for the attribute. Set this to 0 to delete the attribute\r
- virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as an array of wide strings.\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- //! or defaultNotFound if attribute is not set.\r
- virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound = core::array<core::stringw>()) const _IRR_OVERRIDE_;\r
-\r
- //! Returns attribute value as an array of wide strings by index.\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::array<core::stringw> getAttributeAsArray(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as an array of wide strings\r
- virtual void setAttribute(s32 index, const core::array<core::stringw>& value) _IRR_OVERRIDE_;\r
\r
/*\r
-\r
Bool Attribute\r
-\r
*/\r
\r
//! Adds an attribute as bool\r
//! Sets an attribute as boolean value\r
virtual void setAttribute(s32 index, bool value) _IRR_OVERRIDE_;\r
\r
- /*\r
-\r
- Enumeration Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as enum\r
- virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;\r
-\r
- //! Adds an attribute as enum\r
- virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as enumeration\r
- virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as enumeration\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as enumeration\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param enumerationLiteralsToUse: Use these enumeration literals to get the index value instead of the set ones.\r
- //! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but\r
- //! no information about its index.\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound ) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as enumeration\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as enumeration\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual const c8* getAttributeAsEnumeration(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Gets the list of enumeration literals of an enumeration attribute\r
- //! \param attributeName: Name of the attribute to get.\r
- virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) const _IRR_OVERRIDE_;\r
-\r
- //! Gets the list of enumeration literals of an enumeration attribute\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as enumeration\r
- virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- SColor Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as color\r
- virtual void addColor(const c8* attributeName, video::SColor value) _IRR_OVERRIDE_;\r
-\r
- //! Sets a attribute as color\r
- virtual void setAttribute(const c8* attributeName, video::SColor color) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as color\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as color\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual video::SColor getAttributeAsColor(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as color\r
- virtual void setAttribute(s32 index, video::SColor color) _IRR_OVERRIDE_;\r
-\r
- /*\r
-\r
- SColorf Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as floating point color\r
- virtual void addColorf(const c8* attributeName, video::SColorf value) _IRR_OVERRIDE_;\r
-\r
- //! Sets a attribute as floating point color\r
- virtual void setAttribute(const c8* attributeName, video::SColorf color) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as floating point color\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as floating point color\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual video::SColorf getAttributeAsColorf(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as floating point color\r
- virtual void setAttribute(s32 index, video::SColorf color) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- Vector3d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as 3d vector\r
- virtual void addVector3d(const c8* attributeName, const core::vector3df& value) _IRR_OVERRIDE_;\r
-\r
- //! Sets a attribute as 3d vector\r
- virtual void setAttribute(const c8* attributeName, const core::vector3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as 3d vector\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as 3d vector\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::vector3df getAttributeAsVector3d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as vector\r
- virtual void setAttribute(s32 index, const core::vector3df& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- Vector2d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as 2d vector\r
- virtual void addVector2d(const c8* attributeName, const core::vector2df& value) _IRR_OVERRIDE_;\r
-\r
- //! Sets a attribute as 2d vector\r
- virtual void setAttribute(const c8* attributeName, const core::vector2df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as 2d vector\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as 3d vector\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::vector2df getAttributeAsVector2d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as vector\r
- virtual void setAttribute(s32 index, const core::vector2df& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- Position2d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as 2d position\r
- virtual void addPosition2d(const c8* attributeName, const core::position2di& value) _IRR_OVERRIDE_;\r
-\r
- //! Sets a attribute as 2d position\r
- virtual void setAttribute(const c8* attributeName, const core::position2di& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as position\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as position\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::position2di getAttributeAsPosition2d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as 2d position\r
- virtual void setAttribute(s32 index, const core::position2di& v) _IRR_OVERRIDE_;\r
-\r
- /*\r
-\r
- Rectangle Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as rectangle\r
- virtual void addRect(const c8* attributeName, const core::rect<s32>& value) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as rectangle\r
- virtual void setAttribute(const c8* attributeName, const core::rect<s32>& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as rectangle\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::rect<s32> getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound = core::rect<s32>()) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as rectangle\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::rect<s32> getAttributeAsRect(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as rectangle\r
- virtual void setAttribute(s32 index, const core::rect<s32>& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- Dimension2d Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as dimension2d\r
- virtual void addDimension2d(const c8* attributeName, const core::dimension2d<u32>& value) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as dimension2d\r
- virtual void setAttribute(const c8* attributeName, const core::dimension2d<u32>& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as dimension2d\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound = core::dimension2d<u32>()) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as dimension2d\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as dimension2d\r
- virtual void setAttribute(s32 index, const core::dimension2d<u32>& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- matrix attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as matrix\r
- virtual void addMatrix(const c8* attributeName, const core::matrix4& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as matrix\r
- virtual void setAttribute(const c8* attributeName, const core::matrix4& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a matrix4\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as matrix\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::matrix4 getAttributeAsMatrix(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as matrix\r
- virtual void setAttribute(s32 index, const core::matrix4& v) _IRR_OVERRIDE_;\r
-\r
- /*\r
- quaternion attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as quaternion\r
- virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as quaternion\r
- virtual void setAttribute(const c8* attributeName, const core::quaternion& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a quaternion\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as quaternion\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::quaternion getAttributeAsQuaternion(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as quaternion\r
- virtual void setAttribute(s32 index, const core::quaternion& v) _IRR_OVERRIDE_;\r
-\r
- /*\r
-\r
- 3d bounding box\r
-\r
- */\r
-\r
- //! Adds an attribute as axis aligned bounding box\r
- virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as axis aligned bounding box\r
- virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a axis aligned bounding box\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as axis aligned bounding box\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::aabbox3df getAttributeAsBox3d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as axis aligned bounding box\r
- virtual void setAttribute(s32 index, const core::aabbox3df& v) _IRR_OVERRIDE_;\r
-\r
- /*\r
-\r
- plane\r
-\r
- */\r
-\r
- //! Adds an attribute as 3d plane\r
- virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as 3d plane\r
- virtual void setAttribute(const c8* attributeName, const core::plane3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a 3d plane\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as 3d plane\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::plane3df getAttributeAsPlane3d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as 3d plane\r
- virtual void setAttribute(s32 index, const core::plane3df& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- 3d triangle\r
-\r
- */\r
-\r
- //! Adds an attribute as 3d triangle\r
- virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as 3d triangle\r
- virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a 3d triangle\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- 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_;\r
-\r
- //! Gets an attribute as 3d triangle\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as 3d triangle\r
- virtual void setAttribute(s32 index, const core::triangle3df& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- line 2d\r
-\r
- */\r
-\r
- //! Adds an attribute as a 2d line\r
- virtual void addLine2d(const c8* attributeName, const core::line2df& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as a 2d line\r
- virtual void setAttribute(const c8* attributeName, const core::line2df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a 2d line\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a 2d line\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::line2df getAttributeAsLine2d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as a 2d line\r
- virtual void setAttribute(s32 index, const core::line2df& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- line 3d\r
-\r
- */\r
-\r
- //! Adds an attribute as a 3d line\r
- virtual void addLine3d(const c8* attributeName, const core::line3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as a 3d line\r
- virtual void setAttribute(const c8* attributeName, const core::line3df& v) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a 3d line\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- //! \return Returns value of the attribute previously set by setAttribute()\r
- virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as a 3d line\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual core::line3df getAttributeAsLine3d(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as a 3d line\r
- virtual void setAttribute(s32 index, const core::line3df& v) _IRR_OVERRIDE_;\r
-\r
-\r
- /*\r
-\r
- Texture Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as texture reference\r
- virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as texture reference\r
- virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as texture reference\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as texture reference\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual video::ITexture* getAttributeAsTexture(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as texture reference\r
- virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_;\r
-\r
-\r
-\r
- /*\r
-\r
- User Pointer Attribute\r
-\r
- */\r
-\r
- //! Adds an attribute as user pointer\r
- virtual void addUserPointer(const c8* attributeName, void* userPointer) _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as user pointer\r
- virtual void setAttribute(const c8* attributeName, void* userPointer) _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as user pointer\r
- //! \param attributeName: Name of the attribute to get.\r
- //! \param defaultNotFound Value returned when attributeName was not found\r
- virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) const _IRR_OVERRIDE_;\r
-\r
- //! Gets an attribute as user pointer\r
- //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
- virtual void* getAttributeAsUserPointer(s32 index) const _IRR_OVERRIDE_;\r
-\r
- //! Sets an attribute as user pointer\r
- virtual void setAttribute(s32 index, void* userPointer) _IRR_OVERRIDE_;\r
-\r
protected:\r
\r
core::array<IAttribute*> Attributes;\r
}\r
\r
\r
-//! Writes attributes of the scene node.\r
-void CBillboardSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IBillboardSceneNode::serializeAttributes(out, options);\r
-\r
- out->addFloat("Width", Size.Width);\r
- out->addFloat("TopEdgeWidth", TopEdgeWidth);\r
- out->addFloat("Height", Size.Height);\r
- out->addColor("Shade_Top", Buffer->Vertices[1].Color);\r
- out->addColor("Shade_Down", Buffer->Vertices[0].Color);\r
-}\r
-\r
-\r
-//! Reads attributes of the scene node.\r
-void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- IBillboardSceneNode::deserializeAttributes(in, options);\r
-\r
- Size.Width = in->getAttributeAsFloat("Width");\r
- Size.Height = in->getAttributeAsFloat("Height");\r
-\r
- if (in->existsAttribute("TopEdgeWidth"))\r
- {\r
- TopEdgeWidth = in->getAttributeAsFloat("TopEdgeWidth");\r
- if (Size.Width != TopEdgeWidth)\r
- setSize(Size.Height, Size.Width, TopEdgeWidth);\r
- }\r
- else\r
- setSize(Size);\r
- Buffer->Vertices[1].Color = in->getAttributeAsColor("Shade_Top");\r
- Buffer->Vertices[0].Color = in->getAttributeAsColor("Shade_Down");\r
- Buffer->Vertices[2].Color = Buffer->Vertices[1].Color;\r
- Buffer->Vertices[3].Color = Buffer->Vertices[0].Color;\r
-}\r
-\r
-\r
//! Set the color of all vertices of the billboard\r
//! \param overallColor: the color to set\r
void CBillboardSceneNode::setColor(const video::SColor& overallColor)\r
//! Get the real boundingbox used by the billboard (which depends on the active camera)\r
virtual const core::aabbox3d<f32>& getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode* camera) _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the scene node.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the scene node.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! Returns type of the scene node\r
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_BILLBOARD; }\r
\r
}\r
\r
\r
-void CBoneSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IBoneSceneNode::serializeAttributes(out, options);\r
- out->addInt("BoneIndex", BoneIndex);\r
- out->addEnum("AnimationMode", AnimationMode, BoneAnimationModeNames);\r
-}\r
-\r
-\r
-void CBoneSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- BoneIndex = in->getAttributeAsInt("BoneIndex");\r
- AnimationMode = (E_BONE_ANIMATION_MODE)in->getAttributeAsEnumeration("AnimationMode", BoneAnimationModeNames);\r
- // for legacy files (before 1.5)\r
- const core::stringc boneName = in->getAttributeAsString("BoneName");\r
- setName(boneName);\r
- IBoneSceneNode::deserializeAttributes(in, options);\r
- // TODO: add/replace bone in parent with bone from mesh\r
-}\r
-\r
-\r
} // namespace scene\r
} // namespace irr\r
\r
\r
virtual void updateAbsolutePositionOfAllChildren() _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the scene node.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the scene node.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! How the relative transformation of the bone is used\r
virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) _IRR_OVERRIDE_\r
{\r
}\r
\r
\r
-//! Writes attributes of the scene node.\r
-void CCameraSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- ICameraSceneNode::serializeAttributes(out, options);\r
-\r
- out->addVector3d("Target", Target);\r
- out->addVector3d("UpVector", UpVector);\r
- out->addFloat("Fovy", Fovy);\r
- out->addFloat("Aspect", Aspect);\r
- out->addFloat("ZNear", ZNear);\r
- out->addFloat("ZFar", ZFar);\r
- out->addBool("Binding", TargetAndRotationAreBound);\r
- out->addBool("ReceiveInput", InputReceiverEnabled);\r
-}\r
-\r
-//! Reads attributes of the scene node.\r
-void CCameraSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- ICameraSceneNode::deserializeAttributes(in, options);\r
-\r
- Target = in->getAttributeAsVector3d("Target");\r
- UpVector = in->getAttributeAsVector3d("UpVector");\r
- Fovy = in->getAttributeAsFloat("Fovy");\r
- Aspect = in->getAttributeAsFloat("Aspect");\r
- ZNear = in->getAttributeAsFloat("ZNear");\r
- ZFar = in->getAttributeAsFloat("ZFar");\r
- TargetAndRotationAreBound = in->getAttributeAsBool("Binding");\r
- if ( in->findAttribute("ReceiveInput") )\r
- InputReceiverEnabled = in->getAttributeAsBool("ReceiveInput");\r
-\r
- recalculateProjectionMatrix();\r
- recalculateViewArea();\r
-}\r
-\r
-\r
//! Set the binding between the camera's rotation adn target.\r
void CCameraSceneNode::bindTargetAndRotation(bool bound)\r
{\r
//! Returns if the input receiver of the camera is currently enabled.\r
virtual bool isInputReceiverEnabled() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the scene node.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the scene node.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! Returns type of the scene node\r
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_CAMERA; }\r
\r
#include "CFileList.h"\r
#include "stdio.h"\r
#include "os.h"\r
-#include "CAttributes.h"\r
#include "CReadFile.h"\r
#include "CMemoryFile.h"\r
#include "CLimitReadFile.h"\r
}\r
\r
\r
-//! Creates a new empty collection of attributes, usable for serialization and more.\r
-IAttributes* CFileSystem::createEmptyAttributes(video::IVideoDriver* driver)\r
-{\r
- return new CAttributes(driver);\r
-}\r
-\r
-\r
} // end namespace irr\r
} // end namespace io\r
//! determines if a file exists and would be able to be opened.\r
virtual bool existFile(const io::path& filename) const _IRR_OVERRIDE_;\r
\r
- //! Creates a new empty collection of attributes, usable for serialization and more.\r
- virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
// don't expose, needs refactoring\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIButton::serializeAttributes(out,options);\r
-\r
- out->addBool ("PushButton", IsPushButton );\r
- if (IsPushButton)\r
- out->addBool("Pressed", Pressed);\r
-\r
- for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )\r
- {\r
- if ( ButtonImages[i].Texture )\r
- {\r
- core::stringc name( GUIButtonImageStateNames[i] );\r
- out->addTexture(name.c_str(), ButtonImages[i].Texture);\r
- name += "Rect";\r
- out->addRect(name.c_str(), ButtonImages[i].SourceRect);\r
- }\r
- }\r
-\r
- out->addBool ("UseAlphaChannel", UseAlphaChannel);\r
- out->addBool ("Border", DrawBorder);\r
- out->addBool ("ScaleImage", ScaleImage);\r
-\r
- for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )\r
- {\r
- if ( ButtonSprites[i].Index >= 0 )\r
- {\r
- core::stringc nameIndex( GUIButtonStateNames[i] );\r
- nameIndex += "Index";\r
- out->addInt(nameIndex.c_str(), ButtonSprites[i].Index );\r
-\r
- core::stringc nameColor( GUIButtonStateNames[i] );\r
- nameColor += "Color";\r
- out->addColor(nameColor.c_str(), ButtonSprites[i].Color );\r
-\r
- core::stringc nameLoop( GUIButtonStateNames[i] );\r
- nameLoop += "Loop";\r
- out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop );\r
-\r
- core::stringc nameScale( GUIButtonStateNames[i] );\r
- nameScale += "Scale";\r
- out->addBool(nameScale.c_str(), ButtonSprites[i].Scale );\r
- }\r
- }\r
-\r
- // out->addString ("OverrideFont", OverrideFont);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIButton::deserializeAttributes(in,options);\r
-\r
- IsPushButton = in->getAttributeAsBool("PushButton", IsPushButton);\r
- Pressed = IsPushButton ? in->getAttributeAsBool("Pressed", Pressed) : false;\r
-\r
- for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )\r
- {\r
- core::stringc nameRect( GUIButtonImageStateNames[i] );\r
- nameRect += "Rect";\r
-\r
- setImage((EGUI_BUTTON_IMAGE_STATE)i,\r
- in->getAttributeAsTexture(GUIButtonImageStateNames[i], ButtonImages[i].Texture),\r
- in->getAttributeAsRect(nameRect.c_str(), ButtonImages[i].SourceRect) );\r
- }\r
-\r
- setDrawBorder(in->getAttributeAsBool("Border", DrawBorder));\r
- setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel));\r
- setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage));\r
-\r
- for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )\r
- {\r
- core::stringc nameIndex( GUIButtonStateNames[i] );\r
- nameIndex += "Index";\r
- ButtonSprites[i].Index = in->getAttributeAsInt(nameIndex.c_str(), ButtonSprites[i].Index );\r
-\r
- core::stringc nameColor( GUIButtonStateNames[i] );\r
- nameColor += "Color";\r
- ButtonSprites[i].Color = in->getAttributeAsColor(nameColor.c_str(), ButtonSprites[i].Color );\r
-\r
- core::stringc nameLoop( GUIButtonStateNames[i] );\r
- nameLoop += "Loop";\r
- ButtonSprites[i].Loop = in->getAttributeAsBool(nameLoop.c_str(), ButtonSprites[i].Loop );\r
-\r
- core::stringc nameScale( GUIButtonStateNames[i] );\r
- nameScale += "Scale";\r
- ButtonSprites[i].Scale = in->getAttributeAsBool(nameScale.c_str(), ButtonSprites[i].Scale );\r
- }\r
-\r
- // setOverrideFont(in->getAttributeAsString("OverrideFont"));\r
-\r
- updateAbsolutePosition();\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
return ClickControlState;\r
}\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
protected:\r
void drawSprite(EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center);\r
EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const;\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUICheckBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUICheckBox::serializeAttributes(out,options);\r
-\r
- out->addBool("Checked", Checked);\r
- out->addBool("Border", Border);\r
- out->addBool("Background", Background);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- Checked = in->getAttributeAsBool ("Checked");\r
- Border = in->getAttributeAsBool ("Border", Border);\r
- Background = in->getAttributeAsBool ("Background", Background);\r
-\r
- IGUICheckBox::deserializeAttributes(in,options);\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! draws the element and its children\r
virtual void draw() _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
u32 CheckTime;\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIComboBox::serializeAttributes(out,options);\r
-\r
- out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);\r
- out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);\r
- out->addInt("MaxSelectionRows", (s32)MaxSelectionRows );\r
-\r
- out->addInt ("Selected", Selected );\r
- out->addInt ("ItemCount", Items.size());\r
- for (u32 i=0; i < Items.size(); ++i)\r
- {\r
- core::stringc s = "Item";\r
- s += i;\r
- s += "Text";\r
- out->addString(s.c_str(), Items[i].Name.c_str());\r
- }\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIComboBox::deserializeAttributes(in,options);\r
-\r
- setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),\r
- (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));\r
- setMaxSelectionRows( (u32)(in->getAttributeAsInt("MaxSelectionRows")) );\r
-\r
- // clear the list\r
- clear();\r
- // get item count\r
- u32 c = in->getAttributeAsInt("ItemCount");\r
- // add items\r
- for (u32 i=0; i < c; ++i)\r
- {\r
- core::stringc s = "Item";\r
- s += i;\r
- s += "Text";\r
- addItem(in->getAttributeAsStringW(s.c_str()).c_str(), 0);\r
- }\r
-\r
- setSelected(in->getAttributeAsInt("Selected"));\r
-}\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! draws the element and its children\r
virtual void draw() _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
void openCloseMenu();\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIElement::serializeAttributes(out,options);\r
- out->addPosition2d("Position", Pos);\r
-\r
- if (Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU )\r
- {\r
- const IGUIContextMenu* const ptr = (const IGUIContextMenu*)Parent;\r
- // find the position of this item in its parent's list\r
- u32 i;\r
- // VC6 needs the cast for this\r
- for (i=0; (i<ptr->getItemCount()) && (ptr->getSubMenu(i) != (const IGUIContextMenu*)this); ++i)\r
- ; // do nothing\r
-\r
- out->addInt("ParentItem", i);\r
- }\r
-\r
- out->addInt("CloseHandling", (s32)CloseHandling);\r
-\r
- // write out the item list\r
- out->addInt("ItemCount", Items.size());\r
-\r
- core::stringc tmp;\r
-\r
- for (u32 i=0; i < Items.size(); ++i)\r
- {\r
- tmp = "IsSeparator"; tmp += i;\r
- out->addBool(tmp.c_str(), Items[i].IsSeparator);\r
-\r
- if (!Items[i].IsSeparator)\r
- {\r
- tmp = "Text"; tmp += i;\r
- out->addString(tmp.c_str(), Items[i].Text.c_str());\r
- tmp = "CommandID"; tmp += i;\r
- out->addInt(tmp.c_str(), Items[i].CommandId);\r
- tmp = "Enabled"; tmp += i;\r
- out->addBool(tmp.c_str(), Items[i].Enabled);\r
- tmp = "Checked"; tmp += i;\r
- out->addBool(tmp.c_str(), Items[i].Checked);\r
- tmp = "AutoChecking"; tmp += i;\r
- out->addBool(tmp.c_str(), Items[i].AutoChecking);\r
- }\r
- }\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIElement::deserializeAttributes(in,options);\r
-\r
- Pos = in->getAttributeAsPosition2d("Position");\r
-\r
- // link to this item's parent\r
- if (Parent && ( Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) )\r
- ((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this);\r
-\r
- CloseHandling = (ECONTEXT_MENU_CLOSE)in->getAttributeAsInt("CloseHandling");\r
-\r
- removeAllItems();\r
-\r
- // read the item list\r
- const s32 count = in->getAttributeAsInt("ItemCount");\r
-\r
- for (s32 i=0; i<count; ++i)\r
- {\r
- core::stringc tmp;\r
- core::stringw txt;\r
- s32 commandid=-1;\r
- bool enabled=true;\r
- bool checked=false;\r
- bool autochecking=false;\r
-\r
- tmp = "IsSeparator"; tmp += i;\r
- if ( in->existsAttribute(tmp.c_str()) && in->getAttributeAsBool(tmp.c_str()) )\r
- addSeparator();\r
- else\r
- {\r
- tmp = "Text"; tmp += i;\r
- if ( in->existsAttribute(tmp.c_str()) )\r
- txt = in->getAttributeAsStringW(tmp.c_str());\r
-\r
- tmp = "CommandID"; tmp += i;\r
- if ( in->existsAttribute(tmp.c_str()) )\r
- commandid = in->getAttributeAsInt(tmp.c_str());\r
-\r
- tmp = "Enabled"; tmp += i;\r
- if ( in->existsAttribute(tmp.c_str()) )\r
- enabled = in->getAttributeAsBool(tmp.c_str());\r
-\r
- tmp = "Checked"; tmp += i;\r
- if ( in->existsAttribute(tmp.c_str()) )\r
- checked = in->getAttributeAsBool(tmp.c_str());\r
-\r
- tmp = "AutoChecking"; tmp += i;\r
- if ( in->existsAttribute(tmp.c_str()) )\r
- autochecking = in->getAttributeAsBool(tmp.c_str());\r
-\r
- addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked, autochecking);\r
- }\r
- }\r
-\r
- recalculateSize();\r
-}\r
-\r
-\r
// because sometimes the element has no parent at click time\r
void CGUIContextMenu::setEventParent(IGUIElement *parent)\r
{\r
//! When an eventparent is set it receives events instead of the usual parent element\r
virtual void setEventParent(IGUIElement *parent) _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
protected:\r
\r
void closeAllSubMenus();\r
return isEnabled();\r
}\r
\r
-//! Writes attributes of the element.\r
-void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- // IGUIEditBox::serializeAttributes(out,options);\r
-\r
- out->addBool ("Border", Border);\r
- out->addBool ("Background", Background);\r
- out->addBool ("OverrideColorEnabled", OverrideColorEnabled );\r
- out->addColor ("OverrideColor", OverrideColor);\r
- // out->addFont("OverrideFont", OverrideFont);\r
- out->addInt ("MaxChars", Max);\r
- out->addBool ("WordWrap", WordWrap);\r
- out->addBool ("MultiLine", MultiLine);\r
- out->addBool ("AutoScroll", AutoScroll);\r
- out->addBool ("PasswordBox", PasswordBox);\r
- core::stringw ch = L" ";\r
- ch[0] = PasswordChar;\r
- out->addString("PasswordChar", ch.c_str());\r
- out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);\r
- out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);\r
-\r
- IGUIEditBox::serializeAttributes(out,options);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIEditBox::deserializeAttributes(in,options);\r
-\r
- setDrawBorder( in->getAttributeAsBool("Border", Border) );\r
- setDrawBackground( in->getAttributeAsBool("Background", Background) );\r
- setOverrideColor(in->getAttributeAsColor("OverrideColor", OverrideColor));\r
- enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled));\r
- setMax(in->getAttributeAsInt("MaxChars", Max));\r
- setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap));\r
- setMultiLine(in->getAttributeAsBool("MultiLine", MultiLine));\r
- setAutoScroll(in->getAttributeAsBool("AutoScroll", AutoScroll));\r
- core::stringw ch = L" ";\r
- ch[0] = PasswordChar;\r
- ch = in->getAttributeAsStringW("PasswordChar", ch);\r
-\r
- if (!ch.size())\r
- setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox));\r
- else\r
- setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox), ch[0]);\r
-\r
- setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign),\r
- (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign));\r
-\r
- // setOverrideFont(in->getAttributeAsFont("OverrideFont"));\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! Returns whether the element takes input from the IME\r
virtual bool acceptsIME() _IRR_OVERRIDE_;\r
\r
-\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
protected:\r
//! Breaks the single text line.\r
void breakText();\r
return false;\r
}\r
\r
-\r
-//! Writes attributes of the environment\r
-void CGUIEnvironment::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IGUISkin* skin = getSkin();\r
-\r
- if (skin)\r
- {\r
- out->addEnum("Skin", getSkin()->getType(), GUISkinTypeNames);\r
- skin->serializeAttributes(out, options);\r
- }\r
-}\r
-\r
-\r
-//! Reads attributes of the environment\r
-void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- if (in->existsAttribute("Skin"))\r
- {\r
- IGUISkin *skin = getSkin();\r
-\r
- EGUI_SKIN_TYPE t = (EGUI_SKIN_TYPE) in->getAttributeAsEnumeration("Skin",GUISkinTypeNames);\r
- if ( !skin || t != skin->getType())\r
- {\r
- skin = createSkin(t);\r
- setSkin(skin);\r
- skin->drop();\r
- }\r
-\r
- skin = getSkin();\r
-\r
- if (skin)\r
- {\r
- skin->deserializeAttributes(in, options);\r
- }\r
-\r
- }\r
-\r
- RelativeRect = AbsoluteRect =\r
- core::rect<s32>(Driver ? core::dimension2di(Driver->getScreenSize()) : core::dimension2d<s32>(0,0));\r
-}\r
-\r
-\r
//! adds a button. The returned pointer must not be dropped.\r
IGUIButton* CGUIEnvironment::addButton(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text, const wchar_t *tooltiptext)\r
{\r
if not specified, the root element will be used */\r
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the environment\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the environment.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! Find the next element which would be selected when pressing the tab-key\r
virtual IGUIElement* getNextElement(bool reverse=false, bool group=false) _IRR_OVERRIDE_;\r
\r
IGUIElement::draw();\r
}\r
\r
-\r
-//! Writes attributes of the element.\r
-/* Not sure if this will really work out properly. Saving paths can be\r
-rather problematic. */\r
-void CGUIFileOpenDialog::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IGUIFileOpenDialog::serializeAttributes(out,options);\r
-\r
- out->addString("StartDirectory", StartDirectory.c_str());\r
- out->addBool("RestoreDirectory", (RestoreDirectory.size()!=0));\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-/* Note that these paths changes will happen at arbitrary places upon\r
-load of the gui description. This may be undesired. */\r
-void CGUIFileOpenDialog::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- StartDirectory = in->getAttributeAsString("StartDirectory");\r
- const bool restore = in->getAttributeAsBool("RestoreDirectory");\r
- if (restore)\r
- RestoreDirectory = FileSystem->getWorkingDirectory();\r
- else\r
- RestoreDirectory = "";\r
- if (StartDirectory.size())\r
- FileSystem->changeWorkingDirectoryTo(StartDirectory);\r
-\r
- IGUIFileOpenDialog::deserializeAttributes(in,options);\r
-}\r
-\r
void CGUIFileOpenDialog::pathToStringW(irr::core::stringw& result, const irr::io::path& p)\r
{\r
core::multibyteToWString(result, p);\r
//! draws the element and its children\r
virtual void draw() _IRR_OVERRIDE_;\r
\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
protected:\r
\r
void setFileName(const irr::io::path& name);\r
return DrawBounds;\r
}\r
\r
-//! Writes attributes of the element.\r
-void CGUIImage::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIImage::serializeAttributes(out,options);\r
-\r
- out->addTexture ("Texture", Texture);\r
- out->addBool ("UseAlphaChannel", UseAlphaChannel);\r
- out->addColor ("Color", Color);\r
- out->addBool ("ScaleImage", ScaleImage);\r
- out->addRect ("SourceRect", SourceRect);\r
- out->addFloat ("DrawBoundsX1", DrawBounds.UpperLeftCorner.X);\r
- out->addFloat ("DrawBoundsY1", DrawBounds.UpperLeftCorner.Y);\r
- out->addFloat ("DrawBoundsX2", DrawBounds.LowerRightCorner.X);\r
- out->addFloat ("DrawBoundsY2", DrawBounds.LowerRightCorner.Y);\r
- out->addBool ("DrawBackground", DrawBackground);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIImage::deserializeAttributes(in,options);\r
-\r
- setImage(in->getAttributeAsTexture("Texture", Texture));\r
- setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel));\r
- setColor(in->getAttributeAsColor("Color", Color));\r
- setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage));\r
- setSourceRect(in->getAttributeAsRect("SourceRect", SourceRect));\r
-\r
- DrawBounds.UpperLeftCorner.X = in->getAttributeAsFloat("DrawBoundsX1", DrawBounds.UpperLeftCorner.X);\r
- DrawBounds.UpperLeftCorner.Y = in->getAttributeAsFloat("DrawBoundsY1", DrawBounds.UpperLeftCorner.Y);\r
- DrawBounds.LowerRightCorner.X = in->getAttributeAsFloat("DrawBoundsX2", DrawBounds.LowerRightCorner.X);\r
- DrawBounds.LowerRightCorner.Y = in->getAttributeAsFloat("DrawBoundsY2", DrawBounds.LowerRightCorner.Y);\r
- setDrawBounds(DrawBounds);\r
-\r
- setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground));\r
-}\r
-\r
\r
} // end namespace gui\r
} // end namespace irr\r
return DrawBackground;\r
}\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
protected:\r
void checkBounds(core::rect<s32>& rect)\r
{\r
setColor(Color[0],Color[1]);\r
}\r
\r
-\r
-//! Writes attributes of the element.\r
-void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIInOutFader::serializeAttributes(out,options);\r
-\r
- out->addColor ("FullColor", FullColor);\r
- out->addColor ("TransColor", TransColor);\r
-\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIInOutFader::deserializeAttributes(in,options);\r
-\r
- FullColor = in->getAttributeAsColor("FullColor");\r
- TransColor = in->getAttributeAsColor("TransColor");\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! Returns if the fade in or out process is done.\r
virtual bool isReady() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
enum EFadeAction\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUIListBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIListBox::serializeAttributes(out,options);\r
-\r
- // todo: out->addString ("IconBank", IconBank->getName?);\r
- out->addBool ("DrawBack", DrawBack);\r
- out->addBool ("MoveOverSelect", MoveOverSelect);\r
- out->addBool ("AutoScroll", AutoScroll);\r
-\r
- out->addInt("ItemCount", Items.size());\r
- for (u32 i=0;i<Items.size(); ++i)\r
- {\r
- core::stringc label("text");\r
- label += i;\r
- out->addString(label.c_str(), Items[i].Text.c_str() );\r
-\r
- for ( s32 c=0; c < (s32)EGUI_LBC_COUNT; ++c )\r
- {\r
- core::stringc useColorLabel, colorLabel;\r
- if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) )\r
- return;\r
- label = useColorLabel; label += i;\r
- if ( Items[i].OverrideColors[c].Use )\r
- {\r
- out->addBool(label.c_str(), true );\r
- label = colorLabel; label += i;\r
- out->addColor(label.c_str(), Items[i].OverrideColors[c].Color);\r
- }\r
- else\r
- {\r
- out->addBool(label.c_str(), false );\r
- }\r
- }\r
- }\r
- out->addInt("Selected", Selected);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- clear();\r
-\r
- DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);\r
- MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);\r
- AutoScroll = in->getAttributeAsBool("AutoScroll", AutoScroll);\r
-\r
- IGUIListBox::deserializeAttributes(in,options);\r
-\r
- const s32 count = in->getAttributeAsInt("ItemCount");\r
- for (s32 i=0; i<count; ++i)\r
- {\r
- core::stringc label("text");\r
- ListItem item;\r
-\r
- label += i;\r
- item.Text = in->getAttributeAsStringW(label.c_str());\r
-\r
- addItem(item.Text.c_str(), item.Icon);\r
-\r
- for ( u32 c=0; c < EGUI_LBC_COUNT; ++c )\r
- {\r
- core::stringc useColorLabel, colorLabel;\r
- if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) )\r
- return;\r
- label = useColorLabel; label += i;\r
- Items[i].OverrideColors[c].Use = in->getAttributeAsBool(label.c_str());\r
- if ( Items[i].OverrideColors[c].Use )\r
- {\r
- label = colorLabel; label += i;\r
- Items[i].OverrideColors[c].Color = in->getAttributeAsColor(label.c_str());\r
- }\r
- }\r
- }\r
- Selected = in->getAttributeAsInt("Selected", Selected);\r
- recalculateScrollPos();\r
-}\r
-\r
-\r
void CGUIListBox::recalculateItemWidth(s32 icon)\r
{\r
if (IconBank && icon > -1 &&\r
//! Update the position and size of the listbox, and update the scrollbar\r
virtual void updateAbsolutePosition() _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
//! set all item colors at given index to color\r
virtual void setItemOverrideColor(u32 index, video::SColor color) _IRR_OVERRIDE_;\r
\r
return CGUIWindow::OnEvent(event);\r
}\r
\r
-\r
-//! Writes attributes of the element.\r
-void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- CGUIWindow::serializeAttributes(out,options);\r
-\r
- out->addBool ("OkayButton", (Flags & EMBF_OK) != 0 );\r
- out->addBool ("CancelButton", (Flags & EMBF_CANCEL) != 0 );\r
- out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );\r
- out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );\r
- out->addTexture ("Texture", IconTexture);\r
-\r
- out->addString ("MessageText", MessageText.c_str());\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- Flags = 0;\r
-\r
- Flags = in->getAttributeAsBool("OkayButton") ? EMBF_OK : 0;\r
- Flags |= in->getAttributeAsBool("CancelButton")? EMBF_CANCEL : 0;\r
- Flags |= in->getAttributeAsBool("YesButton") ? EMBF_YES : 0;\r
- Flags |= in->getAttributeAsBool("NoButton") ? EMBF_NO : 0;\r
-\r
- if ( IconTexture )\r
- {\r
- IconTexture->drop();\r
- IconTexture = NULL;\r
- }\r
- IconTexture = in->getAttributeAsTexture("Texture");\r
- if ( IconTexture )\r
- IconTexture->grab();\r
-\r
- MessageText = in->getAttributeAsStringW("MessageText").c_str();\r
-\r
- CGUIWindow::deserializeAttributes(in,options);\r
-\r
- refreshControls();\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! called if an event happened.\r
virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
void refreshControls();\r
IGUIElement::updateAbsolutePosition();\r
}\r
\r
-\r
-//! Writes attributes of the element.\r
-void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIElement::serializeAttributes(out,options);\r
-\r
- out->addInt("BlinkMode", BlinkMode );\r
-}\r
-\r
-//! Reads attributes of the element\r
-void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIElement::deserializeAttributes(in, options);\r
-\r
- BlinkMode = in->getAttributeAsInt("BlinkMode", BlinkMode);\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! Modals are infinite so every point is inside\r
virtual bool isPointInside(const core::position2d<s32>& point) const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
//! Set when to blink. \r
//! Bitset of following values (can be combined)\r
//! 0 = never\r
}\r
}\r
\r
-\r
-//! Writes attributes of the element.\r
-void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIScrollBar::serializeAttributes(out,options);\r
-\r
- out->addBool("Horizontal", Horizontal);\r
- out->addInt ("Value", Pos);\r
- out->addInt ("Min", Min);\r
- out->addInt ("Max", Max);\r
- out->addInt ("SmallStep", SmallStep);\r
- out->addInt ("LargeStep", LargeStep);\r
- // CurrentIconColor - not serialized as continuously updated\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIScrollBar::deserializeAttributes(in,options);\r
-\r
- Horizontal = in->getAttributeAsBool("Horizontal", Horizontal);\r
- setMin(in->getAttributeAsInt("Min", Min));\r
- setMax(in->getAttributeAsInt("Max", Max));\r
- setPos(in->getAttributeAsInt("Value", Pos));\r
- setSmallStep(in->getAttributeAsInt("SmallStep", SmallStep));\r
- setLargeStep(in->getAttributeAsInt("LargeStep", LargeStep));\r
- // CurrentIconColor - not serialized as continuously updated\r
-\r
- refreshControls();\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! updates the rectangle\r
virtual void updateAbsolutePosition() _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
void refreshControls();\r
Driver->draw2DRectangle(color, pos, clip);\r
}\r
\r
-\r
-//! Writes attributes of the skin\r
-void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- u32 i;\r
- for (i=0; i<EGDC_COUNT; ++i)\r
- out->addColor(GUISkinColorNames[i], Colors[i]);\r
-\r
- for (i=0; i<EGDS_COUNT; ++i)\r
- out->addInt(GUISkinSizeNames[i], Sizes[i]);\r
-\r
- for (i=0; i<EGDT_COUNT; ++i)\r
- out->addString(GUISkinTextNames[i], Texts[i].c_str());\r
-\r
- for (i=0; i<EGDI_COUNT; ++i)\r
- out->addInt(GUISkinIconNames[i], Icons[i]);\r
-}\r
-\r
-\r
-//! Reads attributes of the skikn\r
-void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- u32 i;\r
- for (i=0; i<EGDC_COUNT; ++i)\r
- Colors[i] = in->getAttributeAsColor(GUISkinColorNames[i], Colors[i]);\r
-\r
- for (i=0; i<EGDS_COUNT; ++i)\r
- Sizes[i] = in->getAttributeAsInt(GUISkinSizeNames[i], Sizes[i]);\r
-\r
- for (i=0; i<EGDT_COUNT; ++i)\r
- Texts[i] = in->getAttributeAsStringW(GUISkinTextNames[i], Texts[i]);\r
-\r
- for (i=0; i<EGDI_COUNT; ++i)\r
- Icons[i] = in->getAttributeAsInt(GUISkinIconNames[i], Icons[i]);\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! get the type of this skin\r
virtual EGUI_SKIN_TYPE getType() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the skin\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the skin\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
video::SColor Colors[EGDC_COUNT];\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IGUIElement::serializeAttributes(out, options);\r
- out->addFloat("Min", getMin());\r
- out->addFloat("Max", getMax());\r
- out->addFloat("Step", getStepSize());\r
- out->addInt("DecimalPlaces", DecimalPlaces);\r
- out->addInt("ValidateOn", (s32)ValidateOn);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- IGUIElement::deserializeAttributes(in, options);\r
- setRange(in->getAttributeAsFloat("Min", RangeMin), in->getAttributeAsFloat("Max", RangeMax));\r
- setStepSize(in->getAttributeAsFloat("Step", StepSize));\r
- setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces", DecimalPlaces));\r
- setValidateOn((u32)in->getAttributeAsInt("ValidateOn", (s32)ValidateOn) );\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! Gets when the spinbox has to validate entered text.\r
virtual u32 getValidateOn() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
protected:\r
virtual void verifyValueRange();\r
void refreshSprites();\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-//! Implement this to expose the attributes of your element for\r
-//! scripting languages, editors, debuggers or xml serialization purposes.\r
-void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIStaticText::serializeAttributes(out,options);\r
-\r
- out->addBool ("Border", Border);\r
- out->addBool ("OverrideColorEnabled",OverrideColorEnabled);\r
- out->addBool ("OverrideBGColorEnabled",OverrideBGColorEnabled);\r
- out->addBool ("WordWrap", WordWrap);\r
- out->addBool ("Background", Background);\r
- out->addBool ("RightToLeft", RightToLeft);\r
- out->addBool ("RestrainTextInside", RestrainTextInside);\r
- out->addColor ("OverrideColor", OverrideColor);\r
- out->addColor ("BGColor", BGColor);\r
- out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);\r
- out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);\r
-\r
- // out->addFont ("OverrideFont", OverrideFont);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIStaticText::deserializeAttributes(in,options);\r
-\r
- Border = in->getAttributeAsBool("Border", Border);\r
- enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled));\r
- OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled", OverrideBGColorEnabled);\r
- setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap));\r
- Background = in->getAttributeAsBool("Background", Background);\r
- RightToLeft = in->getAttributeAsBool("RightToLeft", RightToLeft);\r
- RestrainTextInside = in->getAttributeAsBool("RestrainTextInside", RestrainTextInside);\r
- OverrideColor = in->getAttributeAsColor("OverrideColor", OverrideColor);\r
- BGColor = in->getAttributeAsColor("BGColor", BGColor);\r
-\r
- setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign),\r
- (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign));\r
-\r
- // OverrideFont = in->getAttributeAsFont("OverrideFont");\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! Checks if the text should be interpreted as right-to-left text\r
virtual bool isRightToLeft() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
//! Breaks the single text line.\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUITab::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUITab::serializeAttributes(out,options);\r
-\r
- IGUITabControl* parentTabControl = Parent && Parent->getType() == EGUIET_TAB_CONTROL ? static_cast<IGUITabControl*>(Parent) : 0;\r
- if ( parentTabControl )\r
- out->addInt ("TabNumber", parentTabControl->getTabIndex(this)); // order of children and tabs can be different, so we save tab-number\r
- out->addBool ("DrawBackground", DrawBackground);\r
- out->addColor ("BackColor", BackColor);\r
- out->addBool ("OverrideTextColorEnabled", OverrideTextColorEnabled);\r
- out->addColor ("TextColor", TextColor);\r
-\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUITab::deserializeAttributes(in,options);\r
-\r
- setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground));\r
- setBackgroundColor(in->getAttributeAsColor("BackColor", BackColor));\r
- bool overrideColor = in->getAttributeAsBool("OverrideTextColorEnabled", OverrideTextColorEnabled);\r
- setTextColor(in->getAttributeAsColor("TextColor", TextColor));\r
- OverrideTextColorEnabled = overrideColor; // because setTextColor does set OverrideTextColorEnabled always to true\r
-\r
- IGUITabControl* parentTabControl = Parent && Parent->getType() == EGUIET_TAB_CONTROL ? static_cast<IGUITabControl*>(Parent) : 0;\r
- if (parentTabControl)\r
- {\r
- s32 idx = in->getAttributeAsInt("TabNumber", -1);\r
- if ( idx >= 0 )\r
- parentTabControl->insertTab(idx, this, true);\r
- else\r
- parentTabControl->addTab(this);\r
- }\r
-}\r
-\r
-\r
// ------------------------------------------------------------------\r
// Tabcontrol\r
// ------------------------------------------------------------------\r
}\r
\r
\r
-//! Writes attributes of the element.\r
-void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUITabControl::serializeAttributes(out,options);\r
-\r
- out->addInt ("ActiveTab", ActiveTabIndex);\r
- out->addBool("Border", Border);\r
- out->addBool("FillBackground", FillBackground);\r
- out->addInt ("TabHeight", TabHeight);\r
- out->addInt ("TabMaxWidth", TabMaxWidth);\r
- out->addEnum("TabVerticalAlignment", s32(VerticalAlignment), GUIAlignmentNames);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- Border = in->getAttributeAsBool("Border");\r
- FillBackground = in->getAttributeAsBool("FillBackground");\r
-\r
- ActiveTabIndex = -1;\r
-\r
- setTabHeight(in->getAttributeAsInt("TabHeight"));\r
- TabMaxWidth = in->getAttributeAsInt("TabMaxWidth");\r
-\r
- IGUITabControl::deserializeAttributes(in,options);\r
-\r
- ActiveTabIndex = in->getAttributeAsInt("ActiveTab", -1); // not setActiveTab as tabs are loaded later\r
- setTabVerticalAlignment( static_cast<EGUI_ALIGNMENT>(in->getAttributeAsEnumeration("TabVerticalAlignment" , GUIAlignmentNames)) );\r
-}\r
-\r
-\r
} // end namespace irr\r
} // end namespace gui\r
\r
\r
virtual video::SColor getTextColor() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
private:\r
\r
video::SColor BackColor;\r
//! Removes a child.\r
virtual void removeChild(IGUIElement* child) _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
//! Set the height of the tabs\r
virtual void setTabHeight( s32 height ) _IRR_OVERRIDE_;\r
\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
//! Get the height of the tabs\r
virtual s32 getTabHeight() const _IRR_OVERRIDE_;\r
\r
return DrawBack;\r
}\r
\r
-//! Writes attributes of the element.\r
-void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IGUITable::serializeAttributes(out, options);\r
-\r
- out->addInt("ColumnCount", Columns.size());\r
- u32 i;\r
- for (i=0;i<Columns.size(); ++i)\r
- {\r
- core::stringc label;\r
-\r
- label = "Column"; label += i; label += "name";\r
- out->addString(label.c_str(), Columns[i].Name.c_str() );\r
- label = "Column"; label += i; label += "width";\r
- out->addInt(label.c_str(), Columns[i].Width );\r
- label = "Column"; label += i; label += "OrderingMode";\r
- out->addEnum(label.c_str(), Columns[i].OrderingMode, GUIColumnOrderingNames);\r
- }\r
-\r
- out->addInt("RowCount", Rows.size());\r
- for (i=0;i<Rows.size(); ++i)\r
- {\r
- core::stringc label;\r
-\r
- // Height currently not used and could be recalculated anyway\r
- //label = "Row"; label += i; label += "height";\r
- //out->addInt(label.c_str(), Rows[i].Height );\r
-\r
- //label = "Row"; label += i; label += "ItemCount";\r
- //out->addInt(label.c_str(), Rows[i].Items.size());\r
- u32 c;\r
- for ( c=0; c < Rows[i].Items.size(); ++c )\r
- {\r
- label = "Row"; label += i; label += "cell"; label += c; label += "text";\r
- out->addString(label.c_str(), Rows[i].Items[c].Text.c_str() );\r
- // core::stringw BrokenText; // can be recalculated\r
- label = "Row"; label += i; label += "cell"; label += c; label += "color";\r
- out->addColor(label.c_str(), Rows[i].Items[c].Color );\r
- label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";\r
- out->addColor(label.c_str(), Rows[i].Items[c].IsOverrideColor );\r
- // void *data; // can't be serialized\r
- }\r
- }\r
-\r
- // s32 ItemHeight; // can be calculated\r
- // TotalItemHeight // calculated\r
- // TotalItemWidth // calculated\r
- // gui::IGUIFont* ActiveFont; // TODO: we don't have a sane font-serialization so far\r
- // gui::IGUIScrollBar* VerticalScrollBar; // not serialized\r
- // gui::IGUIScrollBar* HorizontalScrollBar; // not serialized\r
-\r
- out->addBool ("Clip", Clip);\r
- out->addBool ("DrawBack", DrawBack);\r
- out->addBool ("MoveOverSelect", MoveOverSelect);\r
-\r
- // s32 CurrentResizedColumn; // runtime info - depends on user action\r
- out->addBool ("ResizableColumns", ResizableColumns);\r
-\r
- // s32 Selected; // runtime info - depends on user action\r
- out->addInt("CellWidthPadding", CellWidthPadding );\r
- out->addInt("CellHeightPadding", CellHeightPadding );\r
- // s32 ActiveTab; // runtime info - depends on user action\r
- // bool Selecting; // runtime info - depends on user action\r
- out->addEnum("CurrentOrdering", CurrentOrdering, GUIOrderingModeNames);\r
- out->addInt("DrawFlags", DrawFlags);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- IGUITable::deserializeAttributes(in, options);\r
-\r
- Columns.clear();\r
- u32 columnCount = in->getAttributeAsInt("ColumnCount");\r
- u32 i;\r
- for (i=0;i<columnCount; ++i)\r
- {\r
- core::stringc label;\r
- Column column;\r
-\r
- label = "Column"; label += i; label += "name";\r
- column.Name = core::stringw(in->getAttributeAsString(label.c_str()).c_str());\r
- label = "Column"; label += i; label += "width";\r
- column.Width = in->getAttributeAsInt(label.c_str());\r
- label = "Column"; label += i; label += "OrderingMode";\r
-\r
- column.OrderingMode = EGCO_NONE;\r
- s32 co = in->getAttributeAsEnumeration(label.c_str(), GUIColumnOrderingNames);\r
- if (co > 0)\r
- column.OrderingMode = EGUI_COLUMN_ORDERING(co);\r
-\r
- Columns.push_back(column);\r
- }\r
-\r
- Rows.clear();\r
- u32 rowCount = in->getAttributeAsInt("RowCount");\r
- for (i=0; i<rowCount; ++i)\r
- {\r
- core::stringc label;\r
-\r
- Row row;\r
-\r
- // Height currently not used and could be recalculated anyway\r
- //label = "Row"; label += i; label += "height";\r
- //row.Height = in->getAttributeAsInt(label.c_str() );\r
-\r
- Rows.push_back(row);\r
-\r
- //label = "Row"; label += i; label += "ItemCount";\r
- //u32 itemCount = in->getAttributeAsInt(label.c_str());\r
- u32 c;\r
- for ( c=0; c < columnCount; ++c )\r
- {\r
- Cell cell;\r
-\r
- label = "Row"; label += i; label += "cell"; label += c; label += "text";\r
- cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str());\r
- breakText( cell.Text, cell.BrokenText, Columns[c].Width );\r
- label = "Row"; label += i; label += "cell"; label += c; label += "color";\r
- cell.Color = in->getAttributeAsColor(label.c_str());\r
- label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";\r
- cell.IsOverrideColor = in->getAttributeAsBool(label.c_str());\r
-\r
- cell.Data = NULL;\r
-\r
- Rows[Rows.size()-1].Items.push_back(cell);\r
- }\r
- }\r
-\r
- ItemHeight = 0; // calculated\r
- TotalItemHeight = 0; // calculated\r
- TotalItemWidth = 0; // calculated\r
-\r
- Clip = in->getAttributeAsBool("Clip", Clip);\r
- DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);\r
- MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);\r
-\r
- CurrentResizedColumn = -1;\r
- ResizeStart = 0;\r
- ResizableColumns = in->getAttributeAsBool("ResizableColumns", ResizableColumns);\r
-\r
- Selected = -1;\r
- CellWidthPadding = in->getAttributeAsInt("CellWidthPadding", CellWidthPadding);\r
- CellHeightPadding = in->getAttributeAsInt("CellHeightPadding", CellHeightPadding);\r
- ActiveTab = -1;\r
- Selecting = false;\r
-\r
- CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames, (s32)CurrentOrdering);\r
- DrawFlags = in->getAttributeAsInt("DrawFlags", DrawFlags);\r
-\r
- refreshControls();\r
-}\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
/** \return true if background drawing is enabled, false otherwise */\r
virtual bool isDrawBackgroundEnabled() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the object.\r
- //! Implement this to expose the attributes of your scene node animator for\r
- //! scripting languages, editors, debuggers or xml serialization purposes.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the object.\r
- //! Implement this to set the attributes of your scene node animator for\r
- //! scripting languages, editors, debuggers or xml deserialization purposes.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
protected:\r
void refreshControls();\r
void checkScrollbars();\r
return ClientRect;\r
}\r
\r
-\r
-//! Writes attributes of the element.\r
-void CGUIWindow::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIWindow::serializeAttributes(out,options);\r
-\r
- out->addBool("IsDraggable", IsDraggable);\r
- out->addBool("DrawBackground", DrawBackground);\r
- out->addBool("DrawTitlebar", DrawTitlebar);\r
-\r
- // Currently we can't just serialize attributes of sub-elements.\r
- // To do this we either\r
- // a) allow further serialization after attribute serialiation (second function, callback or event)\r
- // b) add an IGUIElement attribute\r
- // c) extend the attribute system to allow attributes to have sub-attributes\r
- // We just serialize the most important info for now until we can do one of the above solutions.\r
- out->addBool("IsCloseVisible", CloseButton->isVisible());\r
- out->addBool("IsMinVisible", MinButton->isVisible());\r
- out->addBool("IsRestoreVisible", RestoreButton->isVisible());\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void CGUIWindow::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
-IGUIWindow::deserializeAttributes(in,options);\r
-\r
- Dragging = false;\r
- IsActive = false;\r
- IsDraggable = in->getAttributeAsBool("IsDraggable");\r
- DrawBackground = in->getAttributeAsBool("DrawBackground");\r
- DrawTitlebar = in->getAttributeAsBool("DrawTitlebar");\r
-\r
- CloseButton->setVisible(in->getAttributeAsBool("IsCloseVisible"));\r
- MinButton->setVisible(in->getAttributeAsBool("IsMinVisible"));\r
- RestoreButton->setVisible(in->getAttributeAsBool("IsRestoreVisible"));\r
-\r
- updateClientRect();\r
-}\r
-\r
-\r
} // end namespace gui\r
} // end namespace irr\r
\r
//! Returns the rectangle of the drawable area (without border and without titlebar)\r
virtual core::rect<s32> getClientRect() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
-\r
protected:\r
\r
void updateClientRect();\r
if (DebugDataVisible & scene::EDS_NORMALS)\r
{\r
// draw normals\r
- const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);\r
- const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);\r
+ const f32 debugNormalLength = 1.f;\r
+ const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221);\r
const u32 count = Mesh->getMeshBufferCount();\r
\r
for (u32 i=0; i != count; ++i)\r
}\r
\r
\r
-//! Writes attributes of the scene node.\r
-void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IMeshSceneNode::serializeAttributes(out, options);\r
-\r
- if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)\r
- {\r
- const io::path path = SceneManager->getFileSystem()->getRelativeFilename(\r
- SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),\r
- options->Filename);\r
- out->addString("Mesh", path.c_str());\r
- }\r
- else\r
- out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());\r
- out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);\r
-}\r
-\r
-\r
-//! Reads attributes of the scene node.\r
-void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);\r
- io::path newMeshStr = in->getAttributeAsString("Mesh");\r
- ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");\r
-\r
- if (newMeshStr != "" && oldMeshStr != newMeshStr)\r
- {\r
- IMesh* newMesh = 0;\r
- IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());\r
-\r
- if (newAnimatedMesh)\r
- newMesh = newAnimatedMesh->getMesh(0);\r
-\r
- if (newMesh)\r
- setMesh(newMesh);\r
- }\r
-\r
- // optional attribute to assign the hint to the whole mesh\r
- if (in->existsAttribute("HardwareMappingHint") &&\r
- in->existsAttribute("HardwareMappingBufferType"))\r
- {\r
- scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;\r
- scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;\r
-\r
- core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");\r
- if (smapping.equals_ignore_case("static"))\r
- mapping = scene::EHM_STATIC;\r
- else if (smapping.equals_ignore_case("dynamic"))\r
- mapping = scene::EHM_DYNAMIC;\r
- else if (smapping.equals_ignore_case("stream"))\r
- mapping = scene::EHM_STREAM;\r
-\r
- core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");\r
- if (sbufferType.equals_ignore_case("vertex"))\r
- bufferType = scene::EBT_VERTEX;\r
- else if (sbufferType.equals_ignore_case("index"))\r
- bufferType = scene::EBT_INDEX;\r
- else if (sbufferType.equals_ignore_case("vertexindex"))\r
- bufferType = scene::EBT_VERTEX_AND_INDEX;\r
-\r
- IMesh* mesh = getMesh();\r
- if (mesh)\r
- mesh->setHardwareMappingHint(mapping, bufferType);\r
- }\r
-\r
- IMeshSceneNode::deserializeAttributes(in, options);\r
-}\r
-\r
-\r
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.\r
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes\r
referencing this mesh to change too. */\r
//! returns amount of materials used by this scene node.\r
virtual u32 getMaterialCount() const _IRR_OVERRIDE_;\r
\r
- //! Writes attributes of the scene node.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the scene node.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! Returns type of the scene node\r
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_MESH; }\r
\r
#include "IAnimatedMeshSceneNode.h"\r
#include "CMeshManipulator.h"\r
#include "CColorConverter.h"\r
-#include "IAttributeExchangingObject.h"\r
+#include "IReferenceCounted.h"\r
#include "IRenderTarget.h"\r
\r
\r
}\r
}\r
\r
-//! Creates material attributes list from a material, usable for serialization and more.\r
-io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMaterial& material,\r
- io::SAttributeReadWriteOptions* options)\r
-{\r
- io::CAttributes* attr = new io::CAttributes(this);\r
-\r
- attr->addEnum("Type", material.MaterialType, sBuiltInMaterialTypeNames);\r
-\r
- attr->addColor("Ambient", material.AmbientColor);\r
- attr->addColor("Diffuse", material.DiffuseColor);\r
- attr->addColor("Emissive", material.EmissiveColor);\r
- attr->addColor("Specular", material.SpecularColor);\r
-\r
- attr->addFloat("Shininess", material.Shininess);\r
- attr->addFloat("Param1", material.MaterialTypeParam);\r
- attr->addFloat("Param2", material.MaterialTypeParam2);\r
- attr->addFloat("Thickness", material.Thickness);\r
-\r
- core::stringc prefix="Texture";\r
- u32 i;\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- {\r
- video::ITexture* texture = material.getTexture(i);\r
- if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename && texture)\r
- {\r
- io::path path = FileSystem->getRelativeFilename(\r
- FileSystem->getAbsolutePath(material.getTexture(i)->getName()), options->Filename);\r
- attr->addTexture((prefix+core::stringc(i+1)).c_str(), material.getTexture(i), path);\r
- }\r
- else\r
- {\r
- attr->addTexture((prefix+core::stringc(i+1)).c_str(), texture);\r
- }\r
- }\r
-\r
- attr->addBool("Wireframe", material.Wireframe);\r
- attr->addBool("PointCloud", material.PointCloud);\r
- attr->addBool("GouraudShading", material.GouraudShading);\r
- attr->addBool("Lighting", material.Lighting);\r
- attr->addEnum("ZWriteEnable", (irr::s32)material.ZWriteEnable, video::ZWriteNames);\r
- attr->addInt("ZBuffer", material.ZBuffer);\r
- attr->addBool("BackfaceCulling", material.BackfaceCulling);\r
- attr->addBool("FrontfaceCulling", material.FrontfaceCulling);\r
- attr->addBool("FogEnable", material.FogEnable);\r
- attr->addBool("NormalizeNormals", material.NormalizeNormals);\r
- attr->addBool("UseMipMaps", material.UseMipMaps);\r
- attr->addInt("AntiAliasing", material.AntiAliasing);\r
- attr->addInt("ColorMask", material.ColorMask);\r
- attr->addInt("ColorMaterial", material.ColorMaterial);\r
- attr->addInt("BlendOperation", material.BlendOperation);\r
- attr->addFloat("BlendFactor", material.BlendFactor);\r
- attr->addInt("PolygonOffsetFactor", material.PolygonOffsetFactor);\r
- attr->addEnum("PolygonOffsetDirection", material.PolygonOffsetDirection, video::PolygonOffsetDirectionNames);\r
- attr->addFloat("PolygonOffsetDepthBias", material.PolygonOffsetDepthBias);\r
- attr->addFloat("PolygonOffsetSlopeScale", material.PolygonOffsetSlopeScale);\r
-\r
- // TODO: Would be nice to have a flag that only serializes rest of texture data when a texture pointer exists.\r
- prefix = "BilinearFilter";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].BilinearFilter);\r
- prefix = "TrilinearFilter";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);\r
- prefix = "AnisotropicFilter";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);\r
- prefix="TextureWrapU";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapU, aTextureClampNames);\r
- prefix="TextureWrapV";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapV, aTextureClampNames);\r
- prefix="TextureWrapW";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapW, aTextureClampNames);\r
- prefix="LODBias";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].LODBias);\r
-\r
- return attr;\r
-}\r
-\r
-\r
-//! Fills an SMaterial structure from attributes.\r
-void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attr)\r
-{\r
- outMaterial.MaterialType = video::EMT_SOLID;\r
-\r
- core::stringc name = attr->getAttributeAsString("Type");\r
-\r
- u32 i;\r
-\r
- for ( i=0; i < MaterialRenderers.size(); ++i)\r
- if ( name == MaterialRenderers[i].Name )\r
- {\r
- outMaterial.MaterialType = (video::E_MATERIAL_TYPE)i;\r
- break;\r
- }\r
-\r
- outMaterial.AmbientColor = attr->getAttributeAsColor("Ambient", outMaterial.AmbientColor);\r
- outMaterial.DiffuseColor = attr->getAttributeAsColor("Diffuse", outMaterial.DiffuseColor);\r
- outMaterial.EmissiveColor = attr->getAttributeAsColor("Emissive", outMaterial.EmissiveColor);\r
- outMaterial.SpecularColor = attr->getAttributeAsColor("Specular", outMaterial.SpecularColor);\r
-\r
- outMaterial.Shininess = attr->getAttributeAsFloat("Shininess", outMaterial.Shininess);\r
- outMaterial.MaterialTypeParam = attr->getAttributeAsFloat("Param1", outMaterial.MaterialTypeParam);\r
- outMaterial.MaterialTypeParam2 = attr->getAttributeAsFloat("Param2", outMaterial.MaterialTypeParam2);\r
- outMaterial.Thickness = attr->getAttributeAsFloat("Thickness", outMaterial.Thickness);\r
-\r
- core::stringc prefix="Texture";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+core::stringc(i+1)).c_str()));\r
-\r
- outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe", outMaterial.Wireframe);\r
- outMaterial.PointCloud = attr->getAttributeAsBool("PointCloud", outMaterial.PointCloud);\r
- outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading", outMaterial.GouraudShading);\r
- outMaterial.Lighting = attr->getAttributeAsBool("Lighting", outMaterial.Lighting);\r
-\r
- io::E_ATTRIBUTE_TYPE attType = attr->getAttributeType("ZWriteEnable");\r
- if (attType == io::EAT_BOOL ) // Before Irrlicht 1.9\r
- outMaterial.ZWriteEnable = attr->getAttributeAsBool("ZWriteEnable", outMaterial.ZWriteEnable != video::EZW_OFF ) ? video::EZW_AUTO : video::EZW_OFF;\r
- else if (attType == io::EAT_ENUM )\r
- outMaterial.ZWriteEnable = (video::E_ZWRITE)attr->getAttributeAsEnumeration("ZWriteEnable", video::ZWriteNames, outMaterial.ZWriteEnable);\r
-\r
- outMaterial.ZBuffer = (u8)attr->getAttributeAsInt("ZBuffer", outMaterial.ZBuffer);\r
- outMaterial.BackfaceCulling = attr->getAttributeAsBool("BackfaceCulling", outMaterial.BackfaceCulling);\r
- outMaterial.FrontfaceCulling = attr->getAttributeAsBool("FrontfaceCulling", outMaterial.FrontfaceCulling);\r
- outMaterial.FogEnable = attr->getAttributeAsBool("FogEnable", outMaterial.FogEnable);\r
- outMaterial.NormalizeNormals = attr->getAttributeAsBool("NormalizeNormals", outMaterial.NormalizeNormals);\r
- outMaterial.UseMipMaps = attr->getAttributeAsBool("UseMipMaps", outMaterial.UseMipMaps);\r
-\r
- outMaterial.AntiAliasing = attr->getAttributeAsInt("AntiAliasing", outMaterial.AntiAliasing);\r
- outMaterial.ColorMask = attr->getAttributeAsInt("ColorMask", outMaterial.ColorMask);\r
- outMaterial.ColorMaterial = attr->getAttributeAsInt("ColorMaterial", outMaterial.ColorMaterial);\r
- outMaterial.BlendOperation = (video::E_BLEND_OPERATION)attr->getAttributeAsInt("BlendOperation", outMaterial.BlendOperation);\r
- outMaterial.BlendFactor = attr->getAttributeAsFloat("BlendFactor", outMaterial.BlendFactor);\r
- outMaterial.PolygonOffsetFactor = attr->getAttributeAsInt("PolygonOffsetFactor", outMaterial.PolygonOffsetFactor);\r
- outMaterial.PolygonOffsetDirection = (video::E_POLYGON_OFFSET)attr->getAttributeAsEnumeration("PolygonOffsetDirection", video::PolygonOffsetDirectionNames, outMaterial.PolygonOffsetDirection);\r
- outMaterial.PolygonOffsetDepthBias = attr->getAttributeAsFloat("PolygonOffsetDepthBias", outMaterial.PolygonOffsetDepthBias);\r
- outMaterial.PolygonOffsetSlopeScale = attr->getAttributeAsFloat("PolygonOffsetSlopeScale", outMaterial.PolygonOffsetSlopeScale);\r
-\r
- prefix = "BilinearFilter";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));\r
- else\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].BilinearFilter);\r
-\r
- prefix = "TrilinearFilter";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));\r
- else\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].TrilinearFilter);\r
-\r
- prefix = "AnisotropicFilter";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));\r
- else\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].AnisotropicFilter);\r
-\r
- prefix = "TextureWrap";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- {\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- {\r
- outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+core::stringc(i+1)).c_str(), aTextureClampNames);\r
- outMaterial.TextureLayer[i].TextureWrapV = outMaterial.TextureLayer[i].TextureWrapU;\r
- outMaterial.TextureLayer[i].TextureWrapW = outMaterial.TextureLayer[i].TextureWrapW;\r
- }\r
- }\r
- else\r
- {\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- {\r
- outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"U"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapU);\r
- outMaterial.TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"V"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapV);\r
- outMaterial.TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"W"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapW);\r
- }\r
- }\r
-\r
- prefix="LODBias";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].LODBias = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].LODBias);\r
-}\r
-\r
\r
//! Returns driver and operating system specific data about the IVideoDriver.\r
const SExposedVideoData& CNullDriver::getExposedVideoData()\r
//! Swap the material renderers used for certain id's\r
virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames) _IRR_OVERRIDE_;\r
\r
- //! Creates material attributes list from a material, usable for serialization and more.\r
- virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material,\r
- io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
- //! Fills an SMaterial structure from attributes.\r
- virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) _IRR_OVERRIDE_;\r
-\r
//! looks if the image is already loaded\r
virtual video::ITexture* findTexture(const io::path& filename) _IRR_OVERRIDE_;\r
\r
#include "IFileSystem.h"\r
#include "SAnimatedMesh.h"\r
#include "CMeshCache.h"\r
-#include "ISceneUserDataSerializer.h"\r
#include "IGUIEnvironment.h"\r
#include "IMaterialRenderer.h"\r
#include "IReadFile.h"\r
#include "IWriteFile.h"\r
-#include "ISceneLoader.h"\r
#include "EProfileIDs.h"\r
#include "IProfiler.h"\r
\r
\r
// set scene parameters\r
Parameters = new io::CAttributes();\r
- Parameters->setAttribute(DEBUG_NORMAL_LENGTH, 1.f);\r
- Parameters->setAttribute(DEBUG_NORMAL_COLOR, video::SColor(255, 34, 221, 221));\r
\r
// create collision manager\r
CollisionManager = new CSceneCollisionManager(this, Driver);\r
for (i=0; i<MeshLoaderList.size(); ++i)\r
MeshLoaderList[i]->drop();\r
\r
- for (i=0; i<SceneLoaderList.size(); ++i)\r
- SceneLoaderList[i]->drop();\r
-\r
if (ActiveCamera)\r
ActiveCamera->drop();\r
ActiveCamera = 0;\r
\r
CameraList.set_used(0);\r
}\r
- \r
+\r
// render skyboxes\r
{\r
IRR_PROFILE(CProfileScope psSkyBox(EPID_SM_RENDER_SKYBOXES);)\r
\r
SkyBoxList.set_used(0);\r
}\r
- \r
+\r
// render default objects\r
{\r
IRR_PROFILE(CProfileScope psDefault(EPID_SM_RENDER_DEFAULT);)\r
}\r
\r
\r
-//! Adds an external scene loader.\r
-void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader)\r
-{\r
- if (!externalLoader)\r
- return;\r
-\r
- externalLoader->grab();\r
- SceneLoaderList.push_back(externalLoader);\r
-}\r
-\r
-\r
-//! Returns the number of scene loaders\r
-u32 CSceneManager::getSceneLoaderCount() const\r
-{\r
- return SceneLoaderList.size();\r
-}\r
-\r
-\r
-//! Retrieve the given scene loader\r
-ISceneLoader* CSceneManager::getSceneLoader(u32 index) const\r
-{\r
- if (index < SceneLoaderList.size())\r
- return SceneLoaderList[index];\r
- else\r
- return 0;\r
-}\r
-\r
//! Returns a pointer to the scene collision manager.\r
ISceneCollisionManager* CSceneManager::getSceneCollisionManager()\r
{\r
return 0;\r
}\r
\r
-//! Saves the current scene into a file.\r
-//! \param filename: Name of the file .\r
-bool CSceneManager::saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)\r
-{\r
- bool ret = false;\r
- io::IWriteFile* file = FileSystem->createAndWriteFile(filename);\r
- if (file)\r
- {\r
- ret = saveScene(file, userDataSerializer, node);\r
- file->drop();\r
- }\r
- else\r
- os::Printer::log("Unable to open file", filename, ELL_ERROR);\r
-\r
- return ret;\r
-}\r
-\r
-\r
-//! Saves the current scene into a file.\r
-bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)\r
-{\r
- return false;\r
-}\r
-\r
-\r
-//! Loads a scene.\r
-bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode)\r
-{\r
- io::IReadFile* file = FileSystem->createAndOpenFile(filename);\r
- if (!file)\r
- {\r
- os::Printer::log("Unable to open scene file", filename.c_str(), ELL_ERROR);\r
- return false;\r
- }\r
-\r
- const bool ret = loadScene(file, userDataSerializer, rootNode);\r
- file->drop();\r
-\r
- return ret;\r
-}\r
-\r
-\r
-//! Loads a scene. Note that the current scene is not cleared before.\r
-bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode)\r
-{\r
- if (!file)\r
- {\r
- os::Printer::log("Unable to open scene file", ELL_ERROR);\r
- return false;\r
- }\r
-\r
- bool ret = false;\r
-\r
- // try scene loaders in reverse order\r
- s32 i = SceneLoaderList.size()-1;\r
- for (; i >= 0 && !ret; --i)\r
- if (SceneLoaderList[i]->isALoadableFileFormat(file))\r
- ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode);\r
-\r
- if (!ret)\r
- os::Printer::log("Could not load scene file, perhaps the format is unsupported: ", file->getFileName().c_str(), ELL_ERROR);\r
-\r
- return ret;\r
-}\r
-\r
-\r
//! Returns a typename from a scene node type or null if not found\r
const c8* CSceneManager::getSceneNodeTypeName(ESCENE_NODE_TYPE type)\r
{\r
return node;\r
}\r
\r
-//! Writes attributes of the scene node.\r
-void CSceneManager::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- out->addString ("Name", Name.c_str());\r
- out->addInt ("Id", ID );\r
- out->addColorf ("AmbientLight", AmbientLight);\r
-\r
- // fog attributes from video driver\r
- video::SColor color;\r
- video::E_FOG_TYPE fogType;\r
- f32 start, end, density;\r
- bool pixelFog, rangeFog;\r
-\r
- Driver->getFog(color, fogType, start, end, density, pixelFog, rangeFog);\r
-\r
- out->addEnum("FogType", fogType, video::FogTypeNames);\r
- out->addColorf("FogColor", color);\r
- out->addFloat("FogStart", start);\r
- out->addFloat("FogEnd", end);\r
- out->addFloat("FogDensity", density);\r
- out->addBool("FogPixel", pixelFog);\r
- out->addBool("FogRange", rangeFog);\r
-}\r
-\r
-//! Reads attributes of the scene node.\r
-void CSceneManager::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- Name = in->getAttributeAsString("Name");\r
- ID = in->getAttributeAsInt("Id");\r
- AmbientLight = in->getAttributeAsColorf("AmbientLight");\r
-\r
- // fog attributes\r
- video::SColor color;\r
- video::E_FOG_TYPE fogType;\r
- f32 start, end, density;\r
- bool pixelFog, rangeFog;\r
- if (in->existsAttribute("FogType"))\r
- {\r
- fogType = (video::E_FOG_TYPE) in->getAttributeAsEnumeration("FogType", video::FogTypeNames);\r
- color = in->getAttributeAsColorf("FogColor").toSColor();\r
- start = in->getAttributeAsFloat("FogStart");\r
- end = in->getAttributeAsFloat("FogEnd");\r
- density = in->getAttributeAsFloat("FogDensity");\r
- pixelFog = in->getAttributeAsBool("FogPixel");\r
- rangeFog = in->getAttributeAsBool("FogRange");\r
- Driver->setFog(color, fogType, start, end, density, pixelFog, rangeFog);\r
- }\r
-\r
- RelativeTranslation.set(0,0,0);\r
- RelativeRotation.set(0,0,0);\r
- RelativeScale.set(1,1,1);\r
- IsVisible = true;\r
- AutomaticCullingState = scene::EAC_BOX;\r
- DebugDataVisible = scene::EDS_OFF;\r
- IsDebugObject = false;\r
-\r
- updateAbsolutePosition();\r
-}\r
-\r
-\r
//! Sets ambient color of the scene\r
void CSceneManager::setAmbientLight(const video::SColorf &ambientColor)\r
{\r
//! Retrieve the given mesh loader\r
virtual IMeshLoader* getMeshLoader(u32 index) const _IRR_OVERRIDE_;\r
\r
- //! Adds an external scene loader.\r
- virtual void addExternalSceneLoader(ISceneLoader* externalLoader) _IRR_OVERRIDE_;\r
-\r
- //! Returns the number of scene loaders supported by Irrlicht at this time\r
- virtual u32 getSceneLoaderCount() const _IRR_OVERRIDE_;\r
-\r
- //! Retrieve the given scene loader\r
- virtual ISceneLoader* getSceneLoader(u32 index) const _IRR_OVERRIDE_;\r
-\r
//! Returns a pointer to the scene collision manager.\r
virtual ISceneCollisionManager* getSceneCollisionManager() _IRR_OVERRIDE_;\r
\r
//! Adds a scene node to the scene by name\r
virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) _IRR_OVERRIDE_;\r
\r
- //! Saves the current scene into a file.\r
- virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) _IRR_OVERRIDE_;\r
-\r
- //! Saves the current scene into a file.\r
- virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) _IRR_OVERRIDE_;\r
-\r
- //! Loads a scene. Note that the current scene is not cleared before.\r
- virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) _IRR_OVERRIDE_;\r
-\r
- //! Loads a scene. Note that the current scene is not cleared before.\r
- virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) _IRR_OVERRIDE_;\r
-\r
- //! Writes attributes of the scene node.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
-\r
- //! Reads attributes of the scene node.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
-\r
//! Returns a mesh writer implementation if available\r
virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) _IRR_OVERRIDE_;\r
\r
core::array<ISceneNode*> GuiNodeList;\r
\r
core::array<IMeshLoader*> MeshLoaderList;\r
- core::array<ISceneLoader*> SceneLoaderList;\r
core::array<ISceneNode*> DeletionList;\r
core::array<ISceneNodeFactory*> SceneNodeFactoryList;\r
\r
\r
virtual s32 getInt() const { return 0; }\r
virtual f32 getFloat() const { return 0; }\r
- virtual video::SColorf getColorf() const { return video::SColorf(1.0f,1.0f,1.0f,1.0f); }\r
- virtual video::SColor getColor() const { return video::SColor(255,255,255,255); }\r
- virtual core::stringc getString() const { return core::stringc(getStringW().c_str()); }\r
- virtual core::stringw getStringW() const { return core::stringw(); }\r
- virtual core::array<core::stringw> getArray() const { return core::array<core::stringw>(); };\r
virtual bool getBool() const { return false; }\r
- virtual void getBinary(void* outdata, s32 maxLength) const {};\r
- virtual core::vector3df getVector() const { return core::vector3df(); }\r
- virtual core::position2di getPosition() const { return core::position2di(); }\r
- virtual core::rect<s32> getRect() const { return core::rect<s32>(); }\r
- virtual core::quaternion getQuaternion() const { return core::quaternion(); }\r
- virtual core::matrix4 getMatrix() const { return core::matrix4(); }\r
- virtual core::triangle3df getTriangle() const { return core::triangle3df(); }\r
- virtual core::vector2df getVector2d() const { return core::vector2df(); }\r
- virtual core::vector2di getVector2di() const { return core::vector2di(); }\r
- virtual core::line2df getLine2d() const { return core::line2df(); }\r
- virtual core::line2di getLine2di() const { return core::line2di(); }\r
- virtual core::line3df getLine3d() const { return core::line3df(); }\r
- virtual core::line3di getLine3di() const { return core::line3di(); }\r
- virtual core::dimension2du getDimension2d() const { return core::dimension2du(); }\r
- virtual core::aabbox3d<f32> getBBox() const { return core::aabbox3d<f32>(); }\r
- virtual core::plane3df getPlane() const { return core::plane3df(); }\r
-\r
- virtual video::ITexture* getTexture() const { return 0; }\r
- virtual const char* getEnum() const { return 0; }\r
- virtual void* getUserPointer() const { return 0; }\r
\r
virtual void setInt(s32 intValue) {};\r
virtual void setFloat(f32 floatValue) {};\r
- virtual void setString(const char* text) {};\r
- virtual void setString(const wchar_t* text){ setString(core::stringc(text).c_str()); };\r
- virtual void setArray(const core::array<core::stringw>& arr ) {};\r
- virtual void setColor(video::SColorf color) {};\r
- virtual void setColor(video::SColor color) {};\r
virtual void setBool(bool boolValue) {};\r
- virtual void setBinary(void* data, s32 maxLength) {};\r
- virtual void setVector(const core::vector3df& v) {};\r
- virtual void setPosition(const core::position2di& v) {};\r
- virtual void setRect(const core::rect<s32>& v) {};\r
- virtual void setQuaternion(const core::quaternion& v) {};\r
- virtual void setMatrix(const core::matrix4& v) {};\r
- virtual void setTriangle(const core::triangle3df& v) {};\r
- virtual void setVector2d(const core::vector2df& v) {};\r
- virtual void setVector2d(const core::vector2di& v) {};\r
- virtual void setLine2d(const core::line2df& v) {};\r
- virtual void setLine2d(const core::line2di& v) {};\r
- virtual void setLine3d(const core::line3df& v) {};\r
- virtual void setLine3d(const core::line3di& v) {};\r
- virtual void setDimension2d(const core::dimension2du& v) {};\r
- virtual void setBBox(const core::aabbox3d<f32>& v) {};\r
- virtual void setPlane(const core::plane3df& v) {};\r
- virtual void setUserPointer(void* v) {};\r
-\r
- virtual void setEnum(const char* enumValue, const char* const* enumerationLiterals) {};\r
- virtual void setTexture(video::ITexture*, const path& filename) {};\r
\r
core::stringc Name;\r
\r