IAttributes.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_I_ATTRIBUTES_H_INCLUDED
  5. #define IRR_I_ATTRIBUTES_H_INCLUDED
  6. #include "IReferenceCounted.h"
  7. #include "SColor.h"
  8. #include "vector3d.h"
  9. #include "vector2d.h"
  10. #include "line2d.h"
  11. #include "line3d.h"
  12. #include "triangle3d.h"
  13. #include "position2d.h"
  14. #include "rect.h"
  15. #include "dimension2d.h"
  16. #include "matrix4.h"
  17. #include "quaternion.h"
  18. #include "plane3d.h"
  19. #include "triangle3d.h"
  20. #include "line2d.h"
  21. #include "line3d.h"
  22. #include "irrString.h"
  23. #include "irrArray.h"
  24. #include "IXMLReader.h"
  25. #include "IXMLWriter.h"
  26. #include "EAttributes.h"
  27. #include "path.h"
  28. namespace irr
  29. {
  30. namespace video
  31. {
  32. class ITexture;
  33. } // end namespace video
  34. namespace io
  35. {
  36. //! Provides a generic interface for attributes and their values and the possibility to serialize them
  37. class IAttributes : public virtual IReferenceCounted
  38. {
  39. public:
  40. //! Returns amount of attributes in this collection of attributes.
  41. virtual u32 getAttributeCount() const = 0;
  42. //! Returns attribute name by index.
  43. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  44. virtual const c8* getAttributeName(s32 index) const = 0;
  45. //! Returns the type of an attribute
  46. //! \param attributeName: Name for the attribute
  47. virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) const = 0;
  48. //! Returns attribute type by index.
  49. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  50. virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) const = 0;
  51. //! Returns the type string of the attribute
  52. //! \param attributeName: String for the attribute type
  53. //! \param defaultNotFound Value returned when attributeName was not found
  54. virtual const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const = 0;
  55. //! Returns the type string of the attribute by index.
  56. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  57. //! \param defaultNotFound Value returned for an invalid index
  58. virtual const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const = 0;
  59. //! Returns if an attribute with a name exists
  60. virtual bool existsAttribute(const c8* attributeName) const = 0;
  61. //! Returns attribute index from name, -1 if not found
  62. virtual s32 findAttribute(const c8* attributeName) const = 0;
  63. //! Removes all attributes
  64. virtual void clear() = 0;
  65. //! Reads attributes from a xml file.
  66. //! \param reader The XML reader to read from
  67. //! \param readCurrentElementOnly If set to true, reading only works if current element has the name 'attributes' or
  68. //! the name specified using elementName.
  69. //! \param elementName The surrounding element name. If it is null, the default one, "attributes" will be taken.
  70. //! If set to false, the first appearing list of attributes are read.
  71. virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0;
  72. //! Write these attributes into a xml file
  73. //! \param writer: The XML writer to write to
  74. //! \param writeXMLHeader: Writes a header to the XML file, required if at the beginning of the file
  75. //! \param elementName: The surrounding element name. If it is null, the default one, "attributes" will be taken.
  76. virtual bool write(io::IXMLWriter* writer, bool writeXMLHeader=false, const wchar_t* elementName=0) = 0;
  77. /*
  78. Integer Attribute
  79. */
  80. //! Adds an attribute as integer
  81. virtual void addInt(const c8* attributeName, s32 value) = 0;
  82. //! Sets an attribute as integer value
  83. virtual void setAttribute(const c8* attributeName, s32 value) = 0;
  84. //! Gets an attribute as integer value
  85. //! \param attributeName: Name of the attribute to get.
  86. //! \param defaultNotFound Value returned when attributeName was not found
  87. //! \return Returns value of the attribute previously set by setAttribute()
  88. virtual s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const = 0;
  89. //! Gets an attribute as integer value
  90. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  91. virtual s32 getAttributeAsInt(s32 index) const = 0;
  92. //! Sets an attribute as integer value
  93. virtual void setAttribute(s32 index, s32 value) = 0;
  94. /*
  95. Float Attribute
  96. */
  97. //! Adds an attribute as float
  98. virtual void addFloat(const c8* attributeName, f32 value) = 0;
  99. //! Sets a attribute as float value
  100. virtual void setAttribute(const c8* attributeName, f32 value) = 0;
  101. //! Gets an attribute as float value
  102. //! \param attributeName: Name of the attribute to get.
  103. //! \param defaultNotFound Value returned when attributeName was not found
  104. //! \return Returns value of the attribute previously set by setAttribute()
  105. virtual f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f) const = 0;
  106. //! Gets an attribute as float value
  107. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  108. virtual f32 getAttributeAsFloat(s32 index) const = 0;
  109. //! Sets an attribute as float value
  110. virtual void setAttribute(s32 index, f32 value) = 0;
  111. /*
  112. String Attribute
  113. */
  114. //! Adds an attribute as string
  115. virtual void addString(const c8* attributeName, const c8* value) = 0;
  116. //! Sets an attribute value as string.
  117. //! \param attributeName: Name for the attribute
  118. //! \param value: Value for the attribute. Set this to 0 to delete the attribute
  119. virtual void setAttribute(const c8* attributeName, const c8* value) = 0;
  120. //! Gets an attribute as string.
  121. //! \param attributeName: Name of the attribute to get.
  122. //! \param defaultNotFound Value returned when attributeName was not found
  123. //! \return Returns value of the attribute previously set by setAttribute()
  124. //! or defaultNotFound if attribute is not set.
  125. virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) const = 0;
  126. //! Gets an attribute as string.
  127. //! \param attributeName Name of the attribute to get.
  128. //! \param target Buffer where the string is copied to.
  129. virtual void getAttributeAsString(const c8* attributeName, c8* target) const = 0;
  130. //! Returns attribute value as string by index.
  131. //! \param index Index value, must be between 0 and getAttributeCount()-1.
  132. virtual core::stringc getAttributeAsString(s32 index) const = 0;
  133. //! Sets an attribute value as string.
  134. //! \param index Index value, must be between 0 and getAttributeCount()-1.
  135. //! \param value String to which the attribute is set.
  136. virtual void setAttribute(s32 index, const c8* value) = 0;
  137. // wide strings
  138. //! Adds an attribute as string
  139. virtual void addString(const c8* attributeName, const wchar_t* value) = 0;
  140. //! Sets an attribute value as string.
  141. //! \param attributeName: Name for the attribute
  142. //! \param value: Value for the attribute. Set this to 0 to delete the attribute
  143. virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0;
  144. //! Gets an attribute as string.
  145. //! \param attributeName: Name of the attribute to get.
  146. //! \param defaultNotFound Value returned when attributeName was not found
  147. //! \return Returns value of the attribute previously set by setAttribute()
  148. //! or defaultNotFound if attribute is not set.
  149. virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) const = 0;
  150. //! Gets an attribute as string.
  151. //! \param attributeName: Name of the attribute to get.
  152. //! \param target: Buffer where the string is copied to.
  153. virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) const = 0;
  154. //! Returns attribute value as string by index.
  155. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  156. virtual core::stringw getAttributeAsStringW(s32 index) const = 0;
  157. //! Sets an attribute value as string.
  158. //! \param index Index value, must be between 0 and getAttributeCount()-1.
  159. //! \param value String to which the attribute is set.
  160. virtual void setAttribute(s32 index, const wchar_t* value) = 0;
  161. /*
  162. Binary Data Attribute
  163. */
  164. //! Adds an attribute as binary data
  165. virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0;
  166. //! Sets an attribute as binary data
  167. virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
  168. //! Gets an attribute as binary data
  169. /** \param attributeName: Name of the attribute to get.
  170. \param outData Pointer to buffer where data shall be stored.
  171. \param maxSizeInBytes Maximum number of bytes to write into outData.
  172. */
  173. virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const = 0;
  174. //! Gets an attribute as binary data
  175. /** \param index: Index value, must be between 0 and getAttributeCount()-1.
  176. \param outData Pointer to buffer where data shall be stored.
  177. \param maxSizeInBytes Maximum number of bytes to write into outData.
  178. */
  179. virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const = 0;
  180. //! Sets an attribute as binary data
  181. virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0;
  182. /*
  183. Array Attribute
  184. */
  185. //! Adds an attribute as wide string array
  186. virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) = 0;
  187. //! Sets an attribute value as a wide string array.
  188. //! \param attributeName: Name for the attribute
  189. //! \param value: Value for the attribute. Set this to 0 to delete the attribute
  190. virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) = 0;
  191. //! Gets an attribute as an array of wide strings.
  192. //! \param attributeName: Name of the attribute to get.
  193. //! \param defaultNotFound Value returned when attributeName was not found
  194. //! \return Returns value of the attribute previously set by setAttribute()
  195. //! or defaultNotFound if attribute is not set.
  196. virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound = core::array<core::stringw>()) const = 0;
  197. //! Returns attribute value as an array of wide strings by index.
  198. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  199. virtual core::array<core::stringw> getAttributeAsArray(s32 index) const = 0;
  200. //! Sets an attribute as an array of wide strings
  201. virtual void setAttribute(s32 index, const core::array<core::stringw>& value) = 0;
  202. /*
  203. Bool Attribute
  204. */
  205. //! Adds an attribute as bool
  206. virtual void addBool(const c8* attributeName, bool value) = 0;
  207. //! Sets an attribute as boolean value
  208. virtual void setAttribute(const c8* attributeName, bool value) = 0;
  209. //! Gets an attribute as boolean value
  210. //! \param attributeName: Name of the attribute to get.
  211. //! \param defaultNotFound Value returned when attributeName was not found
  212. //! \return Returns value of the attribute previously set by setAttribute()
  213. virtual bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false) const = 0;
  214. //! Gets an attribute as boolean value
  215. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  216. virtual bool getAttributeAsBool(s32 index) const = 0;
  217. //! Sets an attribute as boolean value
  218. virtual void setAttribute(s32 index, bool value) = 0;
  219. /*
  220. Enumeration Attribute
  221. */
  222. //! Adds an attribute as enum
  223. virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
  224. //! Adds an attribute as enum
  225. virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0;
  226. //! Sets an attribute as enumeration
  227. virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
  228. //! Gets an attribute as enumeration
  229. //! \param attributeName: Name of the attribute to get.
  230. //! \param defaultNotFound Value returned when attributeName was not found
  231. //! \return Returns value of the attribute previously set by setAttribute()
  232. virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) const = 0;
  233. //! Gets an attribute as enumeration
  234. /** \param attributeName: Name of the attribute to get.
  235. \param enumerationLiteralsToUse: Use these enumeration literals to get
  236. the index value instead of the set ones. This is useful when the
  237. attribute list maybe was read from an xml file, and only contains the
  238. enumeration string, but no information about its index.
  239. \return Returns value of the attribute previously set by setAttribute()
  240. */
  241. virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;
  242. //! Gets an attribute as enumeration
  243. /** \param index: Index value, must be between 0 and getAttributeCount()-1.
  244. \param enumerationLiteralsToUse: Use these enumeration literals to get
  245. the index value instead of the set ones. This is useful when the
  246. attribute list maybe was read from an xml file, and only contains the
  247. enumeration string, but no information about its index.
  248. \param defaultNotFound Value returned when the attribute referenced by the index was not found.
  249. \return Returns value of the attribute previously set by setAttribute()
  250. */
  251. virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;
  252. //! Gets an attribute as enumeration
  253. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  254. virtual const c8* getAttributeAsEnumeration(s32 index) const = 0;
  255. //! Gets the list of enumeration literals of an enumeration attribute
  256. //! \param attributeName Name of the attribute to get.
  257. //! \param outLiterals Set of strings to choose the enum name from.
  258. virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) const = 0;
  259. //! Gets the list of enumeration literals of an enumeration attribute
  260. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  261. //! \param outLiterals Set of strings to choose the enum name from.
  262. virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) const = 0;
  263. //! Sets an attribute as enumeration
  264. virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
  265. /*
  266. SColor Attribute
  267. */
  268. //! Adds an attribute as color
  269. virtual void addColor(const c8* attributeName, video::SColor value) = 0;
  270. //! Sets a attribute as color
  271. virtual void setAttribute(const c8* attributeName, video::SColor color) = 0;
  272. //! Gets an attribute as color
  273. //! \param attributeName: Name of the attribute to get.
  274. //! \param defaultNotFound Value returned when attributeName was not found
  275. //! \return Returns value of the attribute previously set by setAttribute()
  276. virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) const = 0;
  277. //! Gets an attribute as color
  278. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  279. virtual video::SColor getAttributeAsColor(s32 index) const = 0;
  280. //! Sets an attribute as color
  281. virtual void setAttribute(s32 index, video::SColor color) = 0;
  282. /*
  283. SColorf Attribute
  284. */
  285. //! Adds an attribute as floating point color
  286. virtual void addColorf(const c8* attributeName, video::SColorf value) = 0;
  287. //! Sets a attribute as floating point color
  288. virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0;
  289. //! Gets an attribute as floating point color
  290. //! \param attributeName: Name of the attribute to get.
  291. //! \param defaultNotFound Value returned when attributeName was not found
  292. //! \return Returns value of the attribute previously set by setAttribute()
  293. virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) const = 0;
  294. //! Gets an attribute as floating point color
  295. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  296. virtual video::SColorf getAttributeAsColorf(s32 index) const = 0;
  297. //! Sets an attribute as floating point color
  298. virtual void setAttribute(s32 index, video::SColorf color) = 0;
  299. /*
  300. Vector3d Attribute
  301. */
  302. //! Adds an attribute as 3d vector
  303. virtual void addVector3d(const c8* attributeName, const core::vector3df& value) = 0;
  304. //! Sets a attribute as 3d vector
  305. virtual void setAttribute(const c8* attributeName, const core::vector3df& v) = 0;
  306. //! Gets an attribute as 3d vector
  307. //! \param attributeName: Name of the attribute to get.
  308. //! \param defaultNotFound Value returned when attributeName was not found
  309. //! \return Returns value of the attribute previously set by setAttribute()
  310. virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) const = 0;
  311. //! Gets an attribute as 3d vector
  312. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  313. virtual core::vector3df getAttributeAsVector3d(s32 index) const = 0;
  314. //! Sets an attribute as vector
  315. virtual void setAttribute(s32 index, const core::vector3df& v) = 0;
  316. /*
  317. Vector2d Attribute
  318. */
  319. //! Adds an attribute as 2d vector
  320. virtual void addVector2d(const c8* attributeName, const core::vector2df& value) = 0;
  321. //! Sets a attribute as 2d vector
  322. virtual void setAttribute(const c8* attributeName, const core::vector2df& v) = 0;
  323. //! Gets an attribute as vector
  324. //! \param attributeName: Name of the attribute to get.
  325. //! \param defaultNotFound Value returned when attributeName was not found
  326. //! \return Returns value of the attribute previously set by setAttribute()
  327. virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) const = 0;
  328. //! Gets an attribute as position
  329. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  330. virtual core::vector2df getAttributeAsVector2d(s32 index) const = 0;
  331. //! Sets an attribute as 2d vector
  332. virtual void setAttribute(s32 index, const core::vector2df& v) = 0;
  333. /*
  334. Position2d Attribute
  335. */
  336. //! Adds an attribute as 2d position
  337. virtual void addPosition2d(const c8* attributeName, const core::position2di& value) = 0;
  338. //! Sets a attribute as 2d position
  339. virtual void setAttribute(const c8* attributeName, const core::position2di& v) = 0;
  340. //! Gets an attribute as position
  341. //! \param attributeName: Name of the attribute to get.
  342. //! \param defaultNotFound Value returned when attributeName was not found
  343. //! \return Returns value of the attribute previously set by setAttribute()
  344. virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) const = 0;
  345. //! Gets an attribute as position
  346. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  347. virtual core::position2di getAttributeAsPosition2d(s32 index) const = 0;
  348. //! Sets an attribute as 2d position
  349. virtual void setAttribute(s32 index, const core::position2di& v) = 0;
  350. /*
  351. Rectangle Attribute
  352. */
  353. //! Adds an attribute as rectangle
  354. virtual void addRect(const c8* attributeName, const core::rect<s32>& value) = 0;
  355. //! Sets an attribute as rectangle
  356. virtual void setAttribute(const c8* attributeName, const core::rect<s32>& v) = 0;
  357. //! Gets an attribute as rectangle
  358. //! \param attributeName: Name of the attribute to get.
  359. //! \param defaultNotFound Value returned when attributeName was not found
  360. //! \return Returns value of the attribute previously set by setAttribute()
  361. virtual core::rect<s32> getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound = core::rect<s32>()) const = 0;
  362. //! Gets an attribute as rectangle
  363. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  364. virtual core::rect<s32> getAttributeAsRect(s32 index) const = 0;
  365. //! Sets an attribute as rectangle
  366. virtual void setAttribute(s32 index, const core::rect<s32>& v) = 0;
  367. /*
  368. Dimension2d Attribute
  369. */
  370. //! Adds an attribute as dimension2d
  371. virtual void addDimension2d(const c8* attributeName, const core::dimension2d<u32>& value) = 0;
  372. //! Sets an attribute as dimension2d
  373. virtual void setAttribute(const c8* attributeName, const core::dimension2d<u32>& v) = 0;
  374. //! Gets an attribute as dimension2d
  375. //! \param attributeName: Name of the attribute to get.
  376. //! \param defaultNotFound Value returned when attributeName was not found
  377. //! \return Returns value of the attribute previously set by setAttribute()
  378. virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound = core::dimension2d<u32>()) const = 0;
  379. //! Gets an attribute as dimension2d
  380. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  381. virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) const = 0;
  382. //! Sets an attribute as dimension2d
  383. virtual void setAttribute(s32 index, const core::dimension2d<u32>& v) = 0;
  384. /*
  385. matrix attribute
  386. */
  387. //! Adds an attribute as matrix
  388. virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0;
  389. //! Sets an attribute as matrix
  390. virtual void setAttribute(const c8* attributeName, const core::matrix4& v) = 0;
  391. //! Gets an attribute as a matrix4
  392. //! \param attributeName: Name of the attribute to get.
  393. //! \param defaultNotFound Value returned when attributeName was not found
  394. //! \return Returns value of the attribute previously set by setAttribute()
  395. virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) const = 0;
  396. //! Gets an attribute as matrix
  397. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  398. virtual core::matrix4 getAttributeAsMatrix(s32 index) const = 0;
  399. //! Sets an attribute as matrix
  400. virtual void setAttribute(s32 index, const core::matrix4& v) = 0;
  401. /*
  402. quaternion attribute
  403. */
  404. //! Adds an attribute as quaternion
  405. virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) = 0;
  406. //! Sets an attribute as quaternion
  407. virtual void setAttribute(const c8* attributeName, const core::quaternion& v) = 0;
  408. //! Gets an attribute as a quaternion
  409. //! \param attributeName: Name of the attribute to get.
  410. //! \param defaultNotFound Value returned when attributeName was not found
  411. //! \return Returns value of the attribute previously set by setAttribute()
  412. virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) const = 0;
  413. //! Gets an attribute as quaternion
  414. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  415. virtual core::quaternion getAttributeAsQuaternion(s32 index) const = 0;
  416. //! Sets an attribute as quaternion
  417. virtual void setAttribute(s32 index, const core::quaternion& v) = 0;
  418. /*
  419. 3d bounding box
  420. */
  421. //! Adds an attribute as axis aligned bounding box
  422. virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) = 0;
  423. //! Sets an attribute as axis aligned bounding box
  424. virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) = 0;
  425. //! Gets an attribute as a axis aligned bounding box
  426. //! \param attributeName: Name of the attribute to get.
  427. //! \param defaultNotFound Value returned when attributeName was not found
  428. //! \return Returns value of the attribute previously set by setAttribute()
  429. virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) const = 0;
  430. //! Gets an attribute as axis aligned bounding box
  431. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  432. virtual core::aabbox3df getAttributeAsBox3d(s32 index) const = 0;
  433. //! Sets an attribute as axis aligned bounding box
  434. virtual void setAttribute(s32 index, const core::aabbox3df& v) = 0;
  435. /*
  436. plane
  437. */
  438. //! Adds an attribute as 3d plane
  439. virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) = 0;
  440. //! Sets an attribute as 3d plane
  441. virtual void setAttribute(const c8* attributeName, const core::plane3df& v) = 0;
  442. //! Gets an attribute as a 3d plane
  443. //! \param attributeName: Name of the attribute to get.
  444. //! \param defaultNotFound Value returned when attributeName was not found
  445. //! \return Returns value of the attribute previously set by setAttribute()
  446. virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) const = 0;
  447. //! Gets an attribute as 3d plane
  448. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  449. virtual core::plane3df getAttributeAsPlane3d(s32 index) const = 0;
  450. //! Sets an attribute as 3d plane
  451. virtual void setAttribute(s32 index, const core::plane3df& v) = 0;
  452. /*
  453. 3d triangle
  454. */
  455. //! Adds an attribute as 3d triangle
  456. virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) = 0;
  457. //! Sets an attribute as 3d triangle
  458. virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) = 0;
  459. //! Gets an attribute as a 3d triangle
  460. //! \param attributeName: Name of the attribute to get.
  461. //! \param defaultNotFound Value returned when attributeName was not found
  462. //! \return Returns value of the attribute previously set by setAttribute()
  463. 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;
  464. //! Gets an attribute as 3d triangle
  465. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  466. virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const = 0;
  467. //! Sets an attribute as 3d triangle
  468. virtual void setAttribute(s32 index, const core::triangle3df& v) = 0;
  469. /*
  470. line 2d
  471. */
  472. //! Adds an attribute as a 2d line
  473. virtual void addLine2d(const c8* attributeName, const core::line2df& v) = 0;
  474. //! Sets an attribute as a 2d line
  475. virtual void setAttribute(const c8* attributeName, const core::line2df& v) = 0;
  476. //! Gets an attribute as a 2d line
  477. //! \param attributeName: Name of the attribute to get.
  478. //! \param defaultNotFound Value returned when attributeName was not found
  479. //! \return Returns value of the attribute previously set by setAttribute()
  480. virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) const = 0;
  481. //! Gets an attribute as a 2d line
  482. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  483. virtual core::line2df getAttributeAsLine2d(s32 index) const = 0;
  484. //! Sets an attribute as a 2d line
  485. virtual void setAttribute(s32 index, const core::line2df& v) = 0;
  486. /*
  487. line 3d
  488. */
  489. //! Adds an attribute as a 3d line
  490. virtual void addLine3d(const c8* attributeName, const core::line3df& v) = 0;
  491. //! Sets an attribute as a 3d line
  492. virtual void setAttribute(const c8* attributeName, const core::line3df& v) = 0;
  493. //! Gets an attribute as a 3d line
  494. //! \param attributeName: Name of the attribute to get.
  495. //! \param defaultNotFound Value returned when attributeName was not found
  496. //! \return Returns value of the attribute previously set by setAttribute()
  497. virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) const = 0;
  498. //! Gets an attribute as a 3d line
  499. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  500. virtual core::line3df getAttributeAsLine3d(s32 index) const = 0;
  501. //! Sets an attribute as a 3d line
  502. virtual void setAttribute(s32 index, const core::line3df& v) = 0;
  503. /*
  504. Texture Attribute
  505. */
  506. //! Adds an attribute as texture reference
  507. virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
  508. //! Sets an attribute as texture reference
  509. virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
  510. //! Gets an attribute as texture reference
  511. //! \param attributeName: Name of the attribute to get.
  512. //! \param defaultNotFound Value returned when attributeName was not found
  513. virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) const = 0;
  514. //! Gets an attribute as texture reference
  515. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  516. virtual video::ITexture* getAttributeAsTexture(s32 index) const = 0;
  517. //! Sets an attribute as texture reference
  518. virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") = 0;
  519. /*
  520. User Pointer Attribute
  521. */
  522. //! Adds an attribute as user pointer
  523. virtual void addUserPointer(const c8* attributeName, void* userPointer) = 0;
  524. //! Sets an attribute as user pointer
  525. virtual void setAttribute(const c8* attributeName, void* userPointer) = 0;
  526. //! Gets an attribute as user pointer
  527. //! \param attributeName: Name of the attribute to get.
  528. //! \param defaultNotFound Value returned when attributeName was not found
  529. virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) const = 0;
  530. //! Gets an attribute as user pointer
  531. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
  532. virtual void* getAttributeAsUserPointer(s32 index) const = 0;
  533. //! Sets an attribute as user pointer
  534. virtual void setAttribute(s32 index, void* userPointer) = 0;
  535. };
  536. } // end namespace io
  537. } // end namespace irr
  538. #endif