PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/Source/System/Image/ES/OSGImageBase.cpp

https://github.com/msteners/OpenSGDevMaster_Toolbox
C++ | 2002 lines | 1490 code | 369 blank | 143 comment | 133 complexity | cdadd54ab83aa8d7551f8eb5a1057bf8 MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause
  1. /*---------------------------------------------------------------------------*\
  2. * OpenSG *
  3. * *
  4. * *
  5. * Copyright (C) 2000-2006 by the OpenSG Forum *
  6. * *
  7. * www.opensg.org *
  8. * *
  9. * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
  10. * *
  11. \*---------------------------------------------------------------------------*/
  12. /*---------------------------------------------------------------------------*\
  13. * License *
  14. * *
  15. * This library is free software; you can redistribute it and/or modify it *
  16. * under the terms of the GNU Library General Public License as published *
  17. * by the Free Software Foundation, version 2. *
  18. * *
  19. * This library is distributed in the hope that it will be useful, but *
  20. * WITHOUT ANY WARRANTY; without even the implied warranty of *
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
  22. * Library General Public License for more details. *
  23. * *
  24. * You should have received a copy of the GNU Library General Public *
  25. * License along with this library; if not, write to the Free Software *
  26. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
  27. * *
  28. \*---------------------------------------------------------------------------*/
  29. /*---------------------------------------------------------------------------*\
  30. * Changes *
  31. * *
  32. * *
  33. * *
  34. * *
  35. * *
  36. * *
  37. \*---------------------------------------------------------------------------*/
  38. /*****************************************************************************\
  39. *****************************************************************************
  40. ** **
  41. ** This file is automatically generated. **
  42. ** **
  43. ** Any changes made to this file WILL be lost when it is **
  44. ** regenerated, which can become necessary at any time. **
  45. ** **
  46. ** Do not change this file, changes should be done in the derived **
  47. ** class Image!
  48. ** **
  49. *****************************************************************************
  50. \*****************************************************************************/
  51. #include <cstdlib>
  52. #include <cstdio>
  53. #include <boost/assign/list_of.hpp>
  54. #include "OSGConfig.h"
  55. #include "OSGGL.h" // DataType default header
  56. #include "OSGFieldContainer.h" // Parents Class
  57. #include "OSGImageBase.h"
  58. #include "OSGImage.h"
  59. #include <boost/bind.hpp>
  60. #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
  61. #pragma warning(disable:4355)
  62. #endif
  63. OSG_BEGIN_NAMESPACE
  64. /***************************************************************************\
  65. * Description *
  66. \***************************************************************************/
  67. /*! \class OSG::Image
  68. 1D/2D/3D Image with various pixel types data, optionally also can hold
  69. mipMap and simple multi-frame data.
  70. */
  71. /***************************************************************************\
  72. * Field Documentation *
  73. \***************************************************************************/
  74. /*! \var ParentFieldContainer * ImageBase::_mfParents
  75. */
  76. /*! \var Int32 ImageBase::_sfDimension
  77. Image dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.
  78. */
  79. /*! \var Int32 ImageBase::_sfWidth
  80. */
  81. /*! \var Int32 ImageBase::_sfHeight
  82. */
  83. /*! \var Int32 ImageBase::_sfDepth
  84. */
  85. /*! \var Int32 ImageBase::_sfBpp
  86. */
  87. /*! \var Int32 ImageBase::_sfMipMapCount
  88. */
  89. /*! \var Int32 ImageBase::_sfFrameCount
  90. */
  91. /*! \var Time ImageBase::_sfFrameDelay
  92. */
  93. /*! \var UInt32 ImageBase::_sfPixelFormat
  94. */
  95. /*! \var UInt8 ImageBase::_mfPixel
  96. */
  97. /*! \var Int32 ImageBase::_sfFrameSize
  98. */
  99. /*! \var std::string ImageBase::_sfName
  100. Texture file path.
  101. */
  102. /*! \var Int32 ImageBase::_sfDataType
  103. Type of image data.
  104. */
  105. /*! \var Int32 ImageBase::_sfComponentSize
  106. Size (in byte) of a single component of the image. Necessary
  107. for High Dynamic Range and other higher-level image types.
  108. */
  109. /*! \var Int32 ImageBase::_sfSideCount
  110. */
  111. /*! \var Int32 ImageBase::_sfSideSize
  112. */
  113. /*! \var bool ImageBase::_sfForceCompressedData
  114. Set to true if using the image to keep unknown data for textures.
  115. Generally used in conjunction with TextureChunk::externalFormat.
  116. */
  117. /*! \var bool ImageBase::_sfForceAlphaChannel
  118. Set to true if using the image to keep unknown data for textures.
  119. Generally used in conjunction with TextureChunk::externalFormat.
  120. */
  121. /*! \var bool ImageBase::_sfForceColorChannel
  122. Set to true if using the image to keep unknown data for textures.
  123. Generally used in conjunction with TextureChunk::externalFormat.
  124. */
  125. /*! \var bool ImageBase::_sfForceAlphaBinary
  126. Set to true if using the image to prevent depth sorting for
  127. SimpleTexturedMaterials using this Image.
  128. */
  129. /***************************************************************************\
  130. * FieldType/FieldTrait Instantiation *
  131. \***************************************************************************/
  132. #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
  133. DataType FieldTraits<Image *>::_type("ImagePtr", "AttachmentContainerPtr");
  134. #endif
  135. OSG_FIELDTRAITS_GETTYPE(Image *)
  136. OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
  137. Image *,
  138. 0);
  139. OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
  140. Image *,
  141. 0);
  142. /***************************************************************************\
  143. * Field Description *
  144. \***************************************************************************/
  145. void ImageBase::classDescInserter(TypeObject &oType)
  146. {
  147. FieldDescriptionBase *pDesc = NULL;
  148. pDesc = new MFUnrecParentFieldContainerPtr::Description(
  149. MFUnrecParentFieldContainerPtr::getClassType(),
  150. "parents",
  151. "",
  152. ParentsFieldId, ParentsFieldMask,
  153. false,
  154. (Field::MFDefaultFlags | Field::FStdAccess),
  155. static_cast <FieldEditMethodSig>(&Image::invalidEditField),
  156. static_cast <FieldGetMethodSig >(&Image::invalidGetField));
  157. oType.addInitialDesc(pDesc);
  158. pDesc = new SFInt32::Description(
  159. SFInt32::getClassType(),
  160. "dimension",
  161. "Image dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.\n",
  162. DimensionFieldId, DimensionFieldMask,
  163. false,
  164. (Field::SFDefaultFlags | Field::FStdAccess),
  165. static_cast<FieldEditMethodSig>(&Image::editHandleDimension),
  166. static_cast<FieldGetMethodSig >(&Image::getHandleDimension));
  167. oType.addInitialDesc(pDesc);
  168. pDesc = new SFInt32::Description(
  169. SFInt32::getClassType(),
  170. "width",
  171. "",
  172. WidthFieldId, WidthFieldMask,
  173. false,
  174. (Field::SFDefaultFlags | Field::FStdAccess),
  175. static_cast<FieldEditMethodSig>(&Image::editHandleWidth),
  176. static_cast<FieldGetMethodSig >(&Image::getHandleWidth));
  177. oType.addInitialDesc(pDesc);
  178. pDesc = new SFInt32::Description(
  179. SFInt32::getClassType(),
  180. "height",
  181. "",
  182. HeightFieldId, HeightFieldMask,
  183. false,
  184. (Field::SFDefaultFlags | Field::FStdAccess),
  185. static_cast<FieldEditMethodSig>(&Image::editHandleHeight),
  186. static_cast<FieldGetMethodSig >(&Image::getHandleHeight));
  187. oType.addInitialDesc(pDesc);
  188. pDesc = new SFInt32::Description(
  189. SFInt32::getClassType(),
  190. "depth",
  191. "",
  192. DepthFieldId, DepthFieldMask,
  193. false,
  194. (Field::SFDefaultFlags | Field::FStdAccess),
  195. static_cast<FieldEditMethodSig>(&Image::editHandleDepth),
  196. static_cast<FieldGetMethodSig >(&Image::getHandleDepth));
  197. oType.addInitialDesc(pDesc);
  198. pDesc = new SFInt32::Description(
  199. SFInt32::getClassType(),
  200. "bpp",
  201. "",
  202. BppFieldId, BppFieldMask,
  203. false,
  204. (Field::SFDefaultFlags | Field::FStdAccess),
  205. static_cast<FieldEditMethodSig>(&Image::editHandleBpp),
  206. static_cast<FieldGetMethodSig >(&Image::getHandleBpp));
  207. oType.addInitialDesc(pDesc);
  208. pDesc = new SFInt32::Description(
  209. SFInt32::getClassType(),
  210. "mipMapCount",
  211. "",
  212. MipMapCountFieldId, MipMapCountFieldMask,
  213. false,
  214. (Field::SFDefaultFlags | Field::FStdAccess),
  215. static_cast<FieldEditMethodSig>(&Image::editHandleMipMapCount),
  216. static_cast<FieldGetMethodSig >(&Image::getHandleMipMapCount));
  217. oType.addInitialDesc(pDesc);
  218. pDesc = new SFInt32::Description(
  219. SFInt32::getClassType(),
  220. "frameCount",
  221. "",
  222. FrameCountFieldId, FrameCountFieldMask,
  223. false,
  224. (Field::SFDefaultFlags | Field::FStdAccess),
  225. static_cast<FieldEditMethodSig>(&Image::editHandleFrameCount),
  226. static_cast<FieldGetMethodSig >(&Image::getHandleFrameCount));
  227. oType.addInitialDesc(pDesc);
  228. pDesc = new SFTime::Description(
  229. SFTime::getClassType(),
  230. "frameDelay",
  231. "",
  232. FrameDelayFieldId, FrameDelayFieldMask,
  233. false,
  234. (Field::SFDefaultFlags | Field::FStdAccess),
  235. static_cast<FieldEditMethodSig>(&Image::editHandleFrameDelay),
  236. static_cast<FieldGetMethodSig >(&Image::getHandleFrameDelay));
  237. oType.addInitialDesc(pDesc);
  238. pDesc = new SFUInt32::Description(
  239. SFUInt32::getClassType(),
  240. "pixelFormat",
  241. "",
  242. PixelFormatFieldId, PixelFormatFieldMask,
  243. false,
  244. (Field::SFDefaultFlags | Field::FStdAccess),
  245. static_cast<FieldEditMethodSig>(&Image::editHandlePixelFormat),
  246. static_cast<FieldGetMethodSig >(&Image::getHandlePixelFormat));
  247. oType.addInitialDesc(pDesc);
  248. pDesc = new MFUInt8::Description(
  249. MFUInt8::getClassType(),
  250. "pixel",
  251. "",
  252. PixelFieldId, PixelFieldMask,
  253. false,
  254. (Field::MFDefaultFlags | Field::FStdAccess),
  255. static_cast<FieldEditMethodSig>(&Image::editHandlePixel),
  256. static_cast<FieldGetMethodSig >(&Image::getHandlePixel));
  257. oType.addInitialDesc(pDesc);
  258. pDesc = new SFInt32::Description(
  259. SFInt32::getClassType(),
  260. "frameSize",
  261. "",
  262. FrameSizeFieldId, FrameSizeFieldMask,
  263. true,
  264. (Field::SFDefaultFlags | Field::FStdAccess),
  265. static_cast<FieldEditMethodSig>(&Image::editHandleFrameSize),
  266. static_cast<FieldGetMethodSig >(&Image::getHandleFrameSize));
  267. oType.addInitialDesc(pDesc);
  268. pDesc = new SFString::Description(
  269. SFString::getClassType(),
  270. "name",
  271. "Texture file path.\n",
  272. NameFieldId, NameFieldMask,
  273. false,
  274. (Field::SFDefaultFlags | Field::FStdAccess),
  275. static_cast<FieldEditMethodSig>(&Image::editHandleName),
  276. static_cast<FieldGetMethodSig >(&Image::getHandleName));
  277. oType.addInitialDesc(pDesc);
  278. pDesc = new SFInt32::Description(
  279. SFInt32::getClassType(),
  280. "dataType",
  281. "Type of image data.\n",
  282. DataTypeFieldId, DataTypeFieldMask,
  283. false,
  284. (Field::SFDefaultFlags | Field::FStdAccess),
  285. static_cast<FieldEditMethodSig>(&Image::editHandleDataType),
  286. static_cast<FieldGetMethodSig >(&Image::getHandleDataType));
  287. oType.addInitialDesc(pDesc);
  288. pDesc = new SFInt32::Description(
  289. SFInt32::getClassType(),
  290. "componentSize",
  291. "Size (in byte) of a single component of the image. Necessary\n"
  292. "for High Dynamic Range and other higher-level image types.\n",
  293. ComponentSizeFieldId, ComponentSizeFieldMask,
  294. true,
  295. (Field::SFDefaultFlags | Field::FStdAccess),
  296. static_cast<FieldEditMethodSig>(&Image::editHandleComponentSize),
  297. static_cast<FieldGetMethodSig >(&Image::getHandleComponentSize));
  298. oType.addInitialDesc(pDesc);
  299. pDesc = new SFInt32::Description(
  300. SFInt32::getClassType(),
  301. "sideCount",
  302. "",
  303. SideCountFieldId, SideCountFieldMask,
  304. false,
  305. (Field::SFDefaultFlags | Field::FStdAccess),
  306. static_cast<FieldEditMethodSig>(&Image::editHandleSideCount),
  307. static_cast<FieldGetMethodSig >(&Image::getHandleSideCount));
  308. oType.addInitialDesc(pDesc);
  309. pDesc = new SFInt32::Description(
  310. SFInt32::getClassType(),
  311. "sideSize",
  312. "",
  313. SideSizeFieldId, SideSizeFieldMask,
  314. true,
  315. (Field::SFDefaultFlags | Field::FStdAccess),
  316. static_cast<FieldEditMethodSig>(&Image::editHandleSideSize),
  317. static_cast<FieldGetMethodSig >(&Image::getHandleSideSize));
  318. oType.addInitialDesc(pDesc);
  319. pDesc = new SFBool::Description(
  320. SFBool::getClassType(),
  321. "forceCompressedData",
  322. "Set to true if using the image to keep unknown data for textures.\n"
  323. "Generally used in conjunction with TextureChunk::externalFormat.\n",
  324. ForceCompressedDataFieldId, ForceCompressedDataFieldMask,
  325. false,
  326. (Field::SFDefaultFlags | Field::FStdAccess),
  327. static_cast<FieldEditMethodSig>(&Image::editHandleForceCompressedData),
  328. static_cast<FieldGetMethodSig >(&Image::getHandleForceCompressedData));
  329. oType.addInitialDesc(pDesc);
  330. pDesc = new SFBool::Description(
  331. SFBool::getClassType(),
  332. "forceAlphaChannel",
  333. "Set to true if using the image to keep unknown data for textures.\n"
  334. "Generally used in conjunction with TextureChunk::externalFormat.\n",
  335. ForceAlphaChannelFieldId, ForceAlphaChannelFieldMask,
  336. false,
  337. (Field::SFDefaultFlags | Field::FStdAccess),
  338. static_cast<FieldEditMethodSig>(&Image::editHandleForceAlphaChannel),
  339. static_cast<FieldGetMethodSig >(&Image::getHandleForceAlphaChannel));
  340. oType.addInitialDesc(pDesc);
  341. pDesc = new SFBool::Description(
  342. SFBool::getClassType(),
  343. "forceColorChannel",
  344. "Set to true if using the image to keep unknown data for textures.\n"
  345. "Generally used in conjunction with TextureChunk::externalFormat.\n",
  346. ForceColorChannelFieldId, ForceColorChannelFieldMask,
  347. false,
  348. (Field::SFDefaultFlags | Field::FStdAccess),
  349. static_cast<FieldEditMethodSig>(&Image::editHandleForceColorChannel),
  350. static_cast<FieldGetMethodSig >(&Image::getHandleForceColorChannel));
  351. oType.addInitialDesc(pDesc);
  352. pDesc = new SFBool::Description(
  353. SFBool::getClassType(),
  354. "forceAlphaBinary",
  355. "Set to true if using the image to prevent depth sorting for \n"
  356. "SimpleTexturedMaterials using this Image.\n",
  357. ForceAlphaBinaryFieldId, ForceAlphaBinaryFieldMask,
  358. false,
  359. (Field::SFDefaultFlags | Field::FStdAccess),
  360. static_cast<FieldEditMethodSig>(&Image::editHandleForceAlphaBinary),
  361. static_cast<FieldGetMethodSig >(&Image::getHandleForceAlphaBinary));
  362. oType.addInitialDesc(pDesc);
  363. }
  364. ImageBase::TypeObject ImageBase::_type(
  365. ImageBase::getClassname(),
  366. Inherited::getClassname(),
  367. "NULL",
  368. 0,
  369. reinterpret_cast<PrototypeCreateF>(&ImageBase::createEmptyLocal),
  370. Image::initMethod,
  371. Image::exitMethod,
  372. reinterpret_cast<InitalInsertDescFunc>(&Image::classDescInserter),
  373. false,
  374. (ComponentSizeFieldMask | SideSizeFieldMask | FrameSizeFieldMask),
  375. "<?xml version=\"1.0\"?>\n"
  376. "\n"
  377. "<FieldContainer\n"
  378. "\tname=\"Image\"\n"
  379. "\tparent=\"AttachmentContainer\"\n"
  380. "\tlibrary=\"System\"\n"
  381. "\tpointerfieldtypes=\"both\"\n"
  382. "\tstructure=\"concrete\"\n"
  383. "\tsystemcomponent=\"true\"\n"
  384. "\tparentsystemcomponent=\"true\"\n"
  385. "\tdecoratable=\"false\"\n"
  386. "\tuseLocalIncludes=\"false\"\n"
  387. " fieldsUnmarkedOnCreate=\"(ComponentSizeFieldMask | SideSizeFieldMask | FrameSizeFieldMask)\"\n"
  388. ">\n"
  389. "1D/2D/3D Image with various pixel types data, optionally also can hold\n"
  390. "mipMap and simple multi-frame data.\n"
  391. "\t<Field\n"
  392. "\t\tname=\"parents\"\n"
  393. "\t\ttype=\"ParentFieldContainerPtr\"\n"
  394. "\t\tcardinality=\"multi\"\n"
  395. "\t\tvisibility=\"external\"\n"
  396. "\t\taccess=\"none\"\n"
  397. "\t>\n"
  398. "\t</Field>\n"
  399. "\t<Field\n"
  400. "\t\tname=\"dimension\"\n"
  401. "\t\ttype=\"Int32\"\n"
  402. "\t\tcardinality=\"single\"\n"
  403. "\t\tvisibility=\"external\"\n"
  404. "\t\tdefaultValue=\"0\"\n"
  405. "\t\taccess=\"public\"\n"
  406. "\t>\n"
  407. "\tImage dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.\n"
  408. "\t</Field>\n"
  409. "\t<Field\n"
  410. "\t\tname=\"width\"\n"
  411. "\t\ttype=\"Int32\"\n"
  412. "\t\tcardinality=\"single\"\n"
  413. "\t\tvisibility=\"external\"\n"
  414. "\t\tdefaultValue=\"0\"\n"
  415. "\t\taccess=\"public\"\n"
  416. "\t>\n"
  417. "\t</Field>\n"
  418. "\t<Field\n"
  419. "\t\tname=\"height\"\n"
  420. "\t\ttype=\"Int32\"\n"
  421. "\t\tcardinality=\"single\"\n"
  422. "\t\tvisibility=\"external\"\n"
  423. "\t\tdefaultValue=\"1\"\n"
  424. "\t\taccess=\"public\"\n"
  425. "\t>\n"
  426. "\t</Field>\n"
  427. "\t<Field\n"
  428. "\t\tname=\"depth\"\n"
  429. "\t\ttype=\"Int32\"\n"
  430. "\t\tcardinality=\"single\"\n"
  431. "\t\tvisibility=\"external\"\n"
  432. "\t\tdefaultValue=\"1\"\n"
  433. "\t\taccess=\"public\"\n"
  434. "\t>\n"
  435. "\t</Field>\n"
  436. "\t<Field\n"
  437. "\t\tname=\"bpp\"\n"
  438. "\t\ttype=\"Int32\"\n"
  439. "\t\tcardinality=\"single\"\n"
  440. "\t\tvisibility=\"external\"\n"
  441. "\t\tdefaultValue=\"1\"\n"
  442. "\t\taccess=\"public\"\n"
  443. "\t>\n"
  444. "\t</Field>\n"
  445. "\t<Field\n"
  446. "\t\tname=\"mipMapCount\"\n"
  447. "\t\ttype=\"Int32\"\n"
  448. "\t\tcardinality=\"single\"\n"
  449. "\t\tvisibility=\"external\"\n"
  450. "\t\tdefaultValue=\"1\"\n"
  451. "\t\taccess=\"public\"\n"
  452. "\t>\n"
  453. "\t</Field>\n"
  454. "\t<Field\n"
  455. "\t\tname=\"frameCount\"\n"
  456. "\t\ttype=\"Int32\"\n"
  457. "\t\tcardinality=\"single\"\n"
  458. "\t\tvisibility=\"external\"\n"
  459. "\t\tdefaultValue=\"1\"\n"
  460. "\t\taccess=\"public\"\n"
  461. "\t>\n"
  462. "\t</Field>\n"
  463. "\t<Field\n"
  464. "\t\tname=\"frameDelay\"\n"
  465. "\t\ttype=\"Time\"\n"
  466. "\t\tcardinality=\"single\"\n"
  467. "\t\tvisibility=\"external\"\n"
  468. "\t\tdefaultValue=\"0\"\n"
  469. "\t\taccess=\"public\"\n"
  470. "\t>\n"
  471. "\t</Field>\n"
  472. "\t<Field\n"
  473. "\t\tname=\"pixelFormat\"\n"
  474. "\t\ttype=\"UInt32\"\n"
  475. "\t\tcardinality=\"single\"\n"
  476. "\t\tvisibility=\"external\"\n"
  477. "\t\tdefaultValue=\"Image::OSG_INVALID_PF\"\n"
  478. "\t\taccess=\"public\"\n"
  479. "\t>\n"
  480. "\t</Field>\n"
  481. "\t<Field\n"
  482. "\t\tname=\"pixel\"\n"
  483. "\t\ttype=\"UInt8\"\n"
  484. "\t\tcardinality=\"multi\"\n"
  485. "\t\tvisibility=\"external\"\n"
  486. "\t\taccess=\"public\"\n"
  487. "\t>\n"
  488. "\t</Field>\n"
  489. "\t<Field\n"
  490. "\t\tname=\"frameSize\"\n"
  491. "\t\ttype=\"Int32\"\n"
  492. "\t\tcardinality=\"single\"\n"
  493. "\t\tvisibility=\"internal\"\n"
  494. "\t\tdefaultValue=\"0\"\n"
  495. "\t\taccess=\"public\"\n"
  496. "\t>\n"
  497. "\t</Field>\n"
  498. "\t<Field\n"
  499. "\t\tname=\"name\"\n"
  500. "\t\ttype=\"std::string\"\n"
  501. "\t\tcardinality=\"single\"\n"
  502. "\t\tvisibility=\"external\"\n"
  503. "\t\taccess=\"public\"\n"
  504. "\t>\n"
  505. "\tTexture file path.\n"
  506. "\t</Field>\n"
  507. "\t<Field\n"
  508. "\t\tname=\"dataType\"\n"
  509. "\t\ttype=\"Int32\"\n"
  510. "\t\tcardinality=\"single\"\n"
  511. "\t\tvisibility=\"external\"\n"
  512. "\t\tdefaultValue=\"GL_UNSIGNED_BYTE\"\n"
  513. "\t\tdefaultHeader=\"&quot;OSGGL.h&quot;\"\n"
  514. "\t\taccess=\"public\"\n"
  515. "\t>\n"
  516. "\tType of image data.\n"
  517. "\t</Field>\n"
  518. "\t<Field\n"
  519. "\t\tname=\"componentSize\"\n"
  520. "\t\ttype=\"Int32\"\n"
  521. "\t\tcardinality=\"single\"\n"
  522. "\t\tvisibility=\"internal\"\n"
  523. "\t\tdefaultValue=\"1\"\n"
  524. "\t\taccess=\"protected\"\n"
  525. "\t>\n"
  526. "\tSize (in byte) of a single component of the image. Necessary\n"
  527. " for High Dynamic Range and other higher-level image types.\n"
  528. "\t</Field>\n"
  529. "\t<Field\n"
  530. "\t\tname=\"sideCount\"\n"
  531. "\t\ttype=\"Int32\"\n"
  532. "\t\tcardinality=\"single\"\n"
  533. "\t\tvisibility=\"external\"\n"
  534. "\t\tdefaultValue=\"1\"\n"
  535. "\t\taccess=\"public\"\n"
  536. "\t>\n"
  537. "\t</Field>\n"
  538. "\t<Field\n"
  539. "\t\tname=\"sideSize\"\n"
  540. "\t\ttype=\"Int32\"\n"
  541. "\t\tcardinality=\"single\"\n"
  542. "\t\tvisibility=\"internal\"\n"
  543. "\t\tdefaultValue=\"0\"\n"
  544. "\t\taccess=\"public\"\n"
  545. "\t>\n"
  546. "\t</Field>\n"
  547. "\t<Field\n"
  548. "\t\tname=\"forceCompressedData\"\n"
  549. "\t\ttype=\"bool\"\n"
  550. "\t\tcardinality=\"single\"\n"
  551. "\t\tvisibility=\"external\"\n"
  552. "\t\tdefaultValue=\"false\"\n"
  553. "\t\taccess=\"public\"\n"
  554. "\t>\n"
  555. " Set to true if using the image to keep unknown data for textures.\n"
  556. " Generally used in conjunction with TextureChunk::externalFormat.\n"
  557. "\t</Field>\n"
  558. "\t<Field\n"
  559. "\t\tname=\"forceAlphaChannel\"\n"
  560. "\t\ttype=\"bool\"\n"
  561. "\t\tcardinality=\"single\"\n"
  562. "\t\tvisibility=\"external\"\n"
  563. "\t\tdefaultValue=\"false\"\n"
  564. "\t\taccess=\"public\"\n"
  565. "\t>\n"
  566. " Set to true if using the image to keep unknown data for textures.\n"
  567. " Generally used in conjunction with TextureChunk::externalFormat.\n"
  568. "\t</Field>\n"
  569. "\t<Field\n"
  570. "\t\tname=\"forceColorChannel\"\n"
  571. "\t\ttype=\"bool\"\n"
  572. "\t\tcardinality=\"single\"\n"
  573. "\t\tvisibility=\"external\"\n"
  574. "\t\tdefaultValue=\"false\"\n"
  575. "\t\taccess=\"public\"\n"
  576. "\t>\n"
  577. " Set to true if using the image to keep unknown data for textures.\n"
  578. " Generally used in conjunction with TextureChunk::externalFormat.\n"
  579. "\t</Field>\n"
  580. "\t<Field\n"
  581. "\t\tname=\"forceAlphaBinary\"\n"
  582. "\t\ttype=\"bool\"\n"
  583. "\t\tcardinality=\"single\"\n"
  584. "\t\tvisibility=\"external\"\n"
  585. "\t\tdefaultValue=\"false\"\n"
  586. "\t\taccess=\"public\"\n"
  587. "\t>\n"
  588. " Set to true if using the image to prevent depth sorting for \n"
  589. " SimpleTexturedMaterials using this Image.\n"
  590. "\t</Field>\n"
  591. "</FieldContainer>\n",
  592. "1D/2D/3D Image with various pixel types data, optionally also can hold\n"
  593. "mipMap and simple multi-frame data.\n"
  594. );
  595. /*------------------------------ get -----------------------------------*/
  596. FieldContainerType &ImageBase::getType(void)
  597. {
  598. return _type;
  599. }
  600. const FieldContainerType &ImageBase::getType(void) const
  601. {
  602. return _type;
  603. }
  604. UInt32 ImageBase::getContainerSize(void) const
  605. {
  606. return sizeof(Image);
  607. }
  608. /*------------------------- decorator get ------------------------------*/
  609. SFInt32 *ImageBase::editSFDimension(void)
  610. {
  611. editSField(DimensionFieldMask);
  612. return &_sfDimension;
  613. }
  614. const SFInt32 *ImageBase::getSFDimension(void) const
  615. {
  616. return &_sfDimension;
  617. }
  618. SFInt32 *ImageBase::editSFWidth(void)
  619. {
  620. editSField(WidthFieldMask);
  621. return &_sfWidth;
  622. }
  623. const SFInt32 *ImageBase::getSFWidth(void) const
  624. {
  625. return &_sfWidth;
  626. }
  627. SFInt32 *ImageBase::editSFHeight(void)
  628. {
  629. editSField(HeightFieldMask);
  630. return &_sfHeight;
  631. }
  632. const SFInt32 *ImageBase::getSFHeight(void) const
  633. {
  634. return &_sfHeight;
  635. }
  636. SFInt32 *ImageBase::editSFDepth(void)
  637. {
  638. editSField(DepthFieldMask);
  639. return &_sfDepth;
  640. }
  641. const SFInt32 *ImageBase::getSFDepth(void) const
  642. {
  643. return &_sfDepth;
  644. }
  645. SFInt32 *ImageBase::editSFBpp(void)
  646. {
  647. editSField(BppFieldMask);
  648. return &_sfBpp;
  649. }
  650. const SFInt32 *ImageBase::getSFBpp(void) const
  651. {
  652. return &_sfBpp;
  653. }
  654. SFInt32 *ImageBase::editSFMipMapCount(void)
  655. {
  656. editSField(MipMapCountFieldMask);
  657. return &_sfMipMapCount;
  658. }
  659. const SFInt32 *ImageBase::getSFMipMapCount(void) const
  660. {
  661. return &_sfMipMapCount;
  662. }
  663. SFInt32 *ImageBase::editSFFrameCount(void)
  664. {
  665. editSField(FrameCountFieldMask);
  666. return &_sfFrameCount;
  667. }
  668. const SFInt32 *ImageBase::getSFFrameCount(void) const
  669. {
  670. return &_sfFrameCount;
  671. }
  672. SFTime *ImageBase::editSFFrameDelay(void)
  673. {
  674. editSField(FrameDelayFieldMask);
  675. return &_sfFrameDelay;
  676. }
  677. const SFTime *ImageBase::getSFFrameDelay(void) const
  678. {
  679. return &_sfFrameDelay;
  680. }
  681. SFUInt32 *ImageBase::editSFPixelFormat(void)
  682. {
  683. editSField(PixelFormatFieldMask);
  684. return &_sfPixelFormat;
  685. }
  686. const SFUInt32 *ImageBase::getSFPixelFormat(void) const
  687. {
  688. return &_sfPixelFormat;
  689. }
  690. MFUInt8 *ImageBase::editMFPixel(void)
  691. {
  692. editMField(PixelFieldMask, _mfPixel);
  693. return &_mfPixel;
  694. }
  695. const MFUInt8 *ImageBase::getMFPixel(void) const
  696. {
  697. return &_mfPixel;
  698. }
  699. SFInt32 *ImageBase::editSFFrameSize(void)
  700. {
  701. editSField(FrameSizeFieldMask);
  702. return &_sfFrameSize;
  703. }
  704. const SFInt32 *ImageBase::getSFFrameSize(void) const
  705. {
  706. return &_sfFrameSize;
  707. }
  708. SFString *ImageBase::editSFName(void)
  709. {
  710. editSField(NameFieldMask);
  711. return &_sfName;
  712. }
  713. const SFString *ImageBase::getSFName(void) const
  714. {
  715. return &_sfName;
  716. }
  717. SFInt32 *ImageBase::editSFDataType(void)
  718. {
  719. editSField(DataTypeFieldMask);
  720. return &_sfDataType;
  721. }
  722. const SFInt32 *ImageBase::getSFDataType(void) const
  723. {
  724. return &_sfDataType;
  725. }
  726. SFInt32 *ImageBase::editSFComponentSize(void)
  727. {
  728. editSField(ComponentSizeFieldMask);
  729. return &_sfComponentSize;
  730. }
  731. const SFInt32 *ImageBase::getSFComponentSize(void) const
  732. {
  733. return &_sfComponentSize;
  734. }
  735. SFInt32 *ImageBase::editSFSideCount(void)
  736. {
  737. editSField(SideCountFieldMask);
  738. return &_sfSideCount;
  739. }
  740. const SFInt32 *ImageBase::getSFSideCount(void) const
  741. {
  742. return &_sfSideCount;
  743. }
  744. SFInt32 *ImageBase::editSFSideSize(void)
  745. {
  746. editSField(SideSizeFieldMask);
  747. return &_sfSideSize;
  748. }
  749. const SFInt32 *ImageBase::getSFSideSize(void) const
  750. {
  751. return &_sfSideSize;
  752. }
  753. SFBool *ImageBase::editSFForceCompressedData(void)
  754. {
  755. editSField(ForceCompressedDataFieldMask);
  756. return &_sfForceCompressedData;
  757. }
  758. const SFBool *ImageBase::getSFForceCompressedData(void) const
  759. {
  760. return &_sfForceCompressedData;
  761. }
  762. SFBool *ImageBase::editSFForceAlphaChannel(void)
  763. {
  764. editSField(ForceAlphaChannelFieldMask);
  765. return &_sfForceAlphaChannel;
  766. }
  767. const SFBool *ImageBase::getSFForceAlphaChannel(void) const
  768. {
  769. return &_sfForceAlphaChannel;
  770. }
  771. SFBool *ImageBase::editSFForceColorChannel(void)
  772. {
  773. editSField(ForceColorChannelFieldMask);
  774. return &_sfForceColorChannel;
  775. }
  776. const SFBool *ImageBase::getSFForceColorChannel(void) const
  777. {
  778. return &_sfForceColorChannel;
  779. }
  780. SFBool *ImageBase::editSFForceAlphaBinary(void)
  781. {
  782. editSField(ForceAlphaBinaryFieldMask);
  783. return &_sfForceAlphaBinary;
  784. }
  785. const SFBool *ImageBase::getSFForceAlphaBinary(void) const
  786. {
  787. return &_sfForceAlphaBinary;
  788. }
  789. /*------------------------------ access -----------------------------------*/
  790. UInt32 ImageBase::getBinSize(ConstFieldMaskArg whichField)
  791. {
  792. UInt32 returnValue = Inherited::getBinSize(whichField);
  793. if(FieldBits::NoField != (ParentsFieldMask & whichField))
  794. {
  795. returnValue += _mfParents.getBinSize();
  796. }
  797. if(FieldBits::NoField != (DimensionFieldMask & whichField))
  798. {
  799. returnValue += _sfDimension.getBinSize();
  800. }
  801. if(FieldBits::NoField != (WidthFieldMask & whichField))
  802. {
  803. returnValue += _sfWidth.getBinSize();
  804. }
  805. if(FieldBits::NoField != (HeightFieldMask & whichField))
  806. {
  807. returnValue += _sfHeight.getBinSize();
  808. }
  809. if(FieldBits::NoField != (DepthFieldMask & whichField))
  810. {
  811. returnValue += _sfDepth.getBinSize();
  812. }
  813. if(FieldBits::NoField != (BppFieldMask & whichField))
  814. {
  815. returnValue += _sfBpp.getBinSize();
  816. }
  817. if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
  818. {
  819. returnValue += _sfMipMapCount.getBinSize();
  820. }
  821. if(FieldBits::NoField != (FrameCountFieldMask & whichField))
  822. {
  823. returnValue += _sfFrameCount.getBinSize();
  824. }
  825. if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
  826. {
  827. returnValue += _sfFrameDelay.getBinSize();
  828. }
  829. if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
  830. {
  831. returnValue += _sfPixelFormat.getBinSize();
  832. }
  833. if(FieldBits::NoField != (PixelFieldMask & whichField))
  834. {
  835. returnValue += _mfPixel.getBinSize();
  836. }
  837. if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
  838. {
  839. returnValue += _sfFrameSize.getBinSize();
  840. }
  841. if(FieldBits::NoField != (NameFieldMask & whichField))
  842. {
  843. returnValue += _sfName.getBinSize();
  844. }
  845. if(FieldBits::NoField != (DataTypeFieldMask & whichField))
  846. {
  847. returnValue += _sfDataType.getBinSize();
  848. }
  849. if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
  850. {
  851. returnValue += _sfComponentSize.getBinSize();
  852. }
  853. if(FieldBits::NoField != (SideCountFieldMask & whichField))
  854. {
  855. returnValue += _sfSideCount.getBinSize();
  856. }
  857. if(FieldBits::NoField != (SideSizeFieldMask & whichField))
  858. {
  859. returnValue += _sfSideSize.getBinSize();
  860. }
  861. if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
  862. {
  863. returnValue += _sfForceCompressedData.getBinSize();
  864. }
  865. if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
  866. {
  867. returnValue += _sfForceAlphaChannel.getBinSize();
  868. }
  869. if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
  870. {
  871. returnValue += _sfForceColorChannel.getBinSize();
  872. }
  873. if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
  874. {
  875. returnValue += _sfForceAlphaBinary.getBinSize();
  876. }
  877. return returnValue;
  878. }
  879. void ImageBase::copyToBin(BinaryDataHandler &pMem,
  880. ConstFieldMaskArg whichField)
  881. {
  882. Inherited::copyToBin(pMem, whichField);
  883. if(FieldBits::NoField != (ParentsFieldMask & whichField))
  884. {
  885. _mfParents.copyToBin(pMem);
  886. }
  887. if(FieldBits::NoField != (DimensionFieldMask & whichField))
  888. {
  889. _sfDimension.copyToBin(pMem);
  890. }
  891. if(FieldBits::NoField != (WidthFieldMask & whichField))
  892. {
  893. _sfWidth.copyToBin(pMem);
  894. }
  895. if(FieldBits::NoField != (HeightFieldMask & whichField))
  896. {
  897. _sfHeight.copyToBin(pMem);
  898. }
  899. if(FieldBits::NoField != (DepthFieldMask & whichField))
  900. {
  901. _sfDepth.copyToBin(pMem);
  902. }
  903. if(FieldBits::NoField != (BppFieldMask & whichField))
  904. {
  905. _sfBpp.copyToBin(pMem);
  906. }
  907. if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
  908. {
  909. _sfMipMapCount.copyToBin(pMem);
  910. }
  911. if(FieldBits::NoField != (FrameCountFieldMask & whichField))
  912. {
  913. _sfFrameCount.copyToBin(pMem);
  914. }
  915. if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
  916. {
  917. _sfFrameDelay.copyToBin(pMem);
  918. }
  919. if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
  920. {
  921. _sfPixelFormat.copyToBin(pMem);
  922. }
  923. if(FieldBits::NoField != (PixelFieldMask & whichField))
  924. {
  925. _mfPixel.copyToBin(pMem);
  926. }
  927. if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
  928. {
  929. _sfFrameSize.copyToBin(pMem);
  930. }
  931. if(FieldBits::NoField != (NameFieldMask & whichField))
  932. {
  933. _sfName.copyToBin(pMem);
  934. }
  935. if(FieldBits::NoField != (DataTypeFieldMask & whichField))
  936. {
  937. _sfDataType.copyToBin(pMem);
  938. }
  939. if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
  940. {
  941. _sfComponentSize.copyToBin(pMem);
  942. }
  943. if(FieldBits::NoField != (SideCountFieldMask & whichField))
  944. {
  945. _sfSideCount.copyToBin(pMem);
  946. }
  947. if(FieldBits::NoField != (SideSizeFieldMask & whichField))
  948. {
  949. _sfSideSize.copyToBin(pMem);
  950. }
  951. if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
  952. {
  953. _sfForceCompressedData.copyToBin(pMem);
  954. }
  955. if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
  956. {
  957. _sfForceAlphaChannel.copyToBin(pMem);
  958. }
  959. if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
  960. {
  961. _sfForceColorChannel.copyToBin(pMem);
  962. }
  963. if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
  964. {
  965. _sfForceAlphaBinary.copyToBin(pMem);
  966. }
  967. }
  968. void ImageBase::copyFromBin(BinaryDataHandler &pMem,
  969. ConstFieldMaskArg whichField)
  970. {
  971. Inherited::copyFromBin(pMem, whichField);
  972. if(FieldBits::NoField != (ParentsFieldMask & whichField))
  973. {
  974. _mfParents.copyFromBin(pMem);
  975. }
  976. if(FieldBits::NoField != (DimensionFieldMask & whichField))
  977. {
  978. _sfDimension.copyFromBin(pMem);
  979. }
  980. if(FieldBits::NoField != (WidthFieldMask & whichField))
  981. {
  982. _sfWidth.copyFromBin(pMem);
  983. }
  984. if(FieldBits::NoField != (HeightFieldMask & whichField))
  985. {
  986. _sfHeight.copyFromBin(pMem);
  987. }
  988. if(FieldBits::NoField != (DepthFieldMask & whichField))
  989. {
  990. _sfDepth.copyFromBin(pMem);
  991. }
  992. if(FieldBits::NoField != (BppFieldMask & whichField))
  993. {
  994. _sfBpp.copyFromBin(pMem);
  995. }
  996. if(FieldBits::NoField != (MipMapCountFieldMask & whichField))
  997. {
  998. _sfMipMapCount.copyFromBin(pMem);
  999. }
  1000. if(FieldBits::NoField != (FrameCountFieldMask & whichField))
  1001. {
  1002. _sfFrameCount.copyFromBin(pMem);
  1003. }
  1004. if(FieldBits::NoField != (FrameDelayFieldMask & whichField))
  1005. {
  1006. _sfFrameDelay.copyFromBin(pMem);
  1007. }
  1008. if(FieldBits::NoField != (PixelFormatFieldMask & whichField))
  1009. {
  1010. _sfPixelFormat.copyFromBin(pMem);
  1011. }
  1012. if(FieldBits::NoField != (PixelFieldMask & whichField))
  1013. {
  1014. _mfPixel.copyFromBin(pMem);
  1015. }
  1016. if(FieldBits::NoField != (FrameSizeFieldMask & whichField))
  1017. {
  1018. _sfFrameSize.copyFromBin(pMem);
  1019. }
  1020. if(FieldBits::NoField != (NameFieldMask & whichField))
  1021. {
  1022. _sfName.copyFromBin(pMem);
  1023. }
  1024. if(FieldBits::NoField != (DataTypeFieldMask & whichField))
  1025. {
  1026. _sfDataType.copyFromBin(pMem);
  1027. }
  1028. if(FieldBits::NoField != (ComponentSizeFieldMask & whichField))
  1029. {
  1030. _sfComponentSize.copyFromBin(pMem);
  1031. }
  1032. if(FieldBits::NoField != (SideCountFieldMask & whichField))
  1033. {
  1034. _sfSideCount.copyFromBin(pMem);
  1035. }
  1036. if(FieldBits::NoField != (SideSizeFieldMask & whichField))
  1037. {
  1038. _sfSideSize.copyFromBin(pMem);
  1039. }
  1040. if(FieldBits::NoField != (ForceCompressedDataFieldMask & whichField))
  1041. {
  1042. _sfForceCompressedData.copyFromBin(pMem);
  1043. }
  1044. if(FieldBits::NoField != (ForceAlphaChannelFieldMask & whichField))
  1045. {
  1046. _sfForceAlphaChannel.copyFromBin(pMem);
  1047. }
  1048. if(FieldBits::NoField != (ForceColorChannelFieldMask & whichField))
  1049. {
  1050. _sfForceColorChannel.copyFromBin(pMem);
  1051. }
  1052. if(FieldBits::NoField != (ForceAlphaBinaryFieldMask & whichField))
  1053. {
  1054. _sfForceAlphaBinary.copyFromBin(pMem);
  1055. }
  1056. }
  1057. //! create a new instance of the class
  1058. ImageTransitPtr ImageBase::createLocal(BitVector bFlags)
  1059. {
  1060. ImageTransitPtr fc;
  1061. if(getClassType().getPrototype() != NULL)
  1062. {
  1063. FieldContainerTransitPtr tmpPtr =
  1064. getClassType().getPrototype()-> shallowCopyLocal(bFlags);
  1065. fc = dynamic_pointer_cast<Image>(tmpPtr);
  1066. }
  1067. return fc;
  1068. }
  1069. //! create a new instance of the class, copy the container flags
  1070. ImageTransitPtr ImageBase::createDependent(BitVector bFlags)
  1071. {
  1072. ImageTransitPtr fc;
  1073. if(getClassType().getPrototype() != NULL)
  1074. {
  1075. FieldContainerTransitPtr tmpPtr =
  1076. getClassType().getPrototype()-> shallowCopyDependent(bFlags);
  1077. fc = dynamic_pointer_cast<Image>(tmpPtr);
  1078. }
  1079. return fc;
  1080. }
  1081. //! create a new instance of the class
  1082. ImageTransitPtr ImageBase::create(void)
  1083. {
  1084. ImageTransitPtr fc;
  1085. if(getClassType().getPrototype() != NULL)
  1086. {
  1087. FieldContainerTransitPtr tmpPtr =
  1088. getClassType().getPrototype()-> shallowCopy();
  1089. fc = dynamic_pointer_cast<Image>(tmpPtr);
  1090. }
  1091. return fc;
  1092. }
  1093. Image *ImageBase::createEmptyLocal(BitVector bFlags)
  1094. {
  1095. Image *returnValue;
  1096. newPtr<Image>(returnValue, bFlags);
  1097. returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
  1098. return returnValue;
  1099. }
  1100. //! create an empty new instance of the class, do not copy the prototype
  1101. Image *ImageBase::createEmpty(void)
  1102. {
  1103. Image *returnValue;
  1104. newPtr<Image>(returnValue, Thread::getCurrentLocalFlags());
  1105. returnValue->_pFieldFlags->_bNamespaceMask &=
  1106. ~Thread::getCurrentLocalFlags();
  1107. return returnValue;
  1108. }
  1109. FieldContainerTransitPtr ImageBase::shallowCopyLocal(
  1110. BitVector bFlags) const
  1111. {
  1112. Image *tmpPtr;
  1113. newPtr(tmpPtr, dynamic_cast<const Image *>(this), bFlags);
  1114. FieldContainerTransitPtr returnValue(tmpPtr);
  1115. tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
  1116. return returnValue;
  1117. }
  1118. FieldContainerTransitPtr ImageBase::shallowCopyDependent(
  1119. BitVector bFlags) const
  1120. {
  1121. Image *tmpPtr;
  1122. newPtr(tmpPtr, dynamic_cast<const Image *>(this), ~bFlags);
  1123. FieldContainerTransitPtr returnValue(tmpPtr);
  1124. tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
  1125. return returnValue;
  1126. }
  1127. FieldContainerTransitPtr ImageBase::shallowCopy(void) const
  1128. {
  1129. Image *tmpPtr;
  1130. newPtr(tmpPtr,
  1131. dynamic_cast<const Image *>(this),
  1132. Thread::getCurrentLocalFlags());
  1133. tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
  1134. FieldContainerTransitPtr returnValue(tmpPtr);
  1135. return returnValue;
  1136. }
  1137. /*------------------------- constructors ----------------------------------*/
  1138. ImageBase::ImageBase(void) :
  1139. Inherited(),
  1140. _mfParents (),
  1141. _sfDimension (Int32(0)),
  1142. _sfWidth (Int32(0)),
  1143. _sfHeight (Int32(1)),
  1144. _sfDepth (Int32(1)),
  1145. _sfBpp (Int32(1)),
  1146. _sfMipMapCount (Int32(1)),
  1147. _sfFrameCount (Int32(1)),
  1148. _sfFrameDelay (Time(0)),
  1149. _sfPixelFormat (UInt32(Image::OSG_INVALID_PF)),
  1150. _mfPixel (),
  1151. _sfFrameSize (Int32(0)),
  1152. _sfName (),
  1153. _sfDataType (Int32(GL_UNSIGNED_BYTE)),
  1154. _sfComponentSize (Int32(1)),
  1155. _sfSideCount (Int32(1)),
  1156. _sfSideSize (Int32(0)),
  1157. _sfForceCompressedData (bool(false)),
  1158. _sfForceAlphaChannel (bool(false)),
  1159. _sfForceColorChannel (bool(false)),
  1160. _sfForceAlphaBinary (bool(false))
  1161. {
  1162. }
  1163. ImageBase::ImageBase(const ImageBase &source) :
  1164. Inherited(source),
  1165. _mfParents (),
  1166. _sfDimension (source._sfDimension ),
  1167. _sfWidth (source._sfWidth ),
  1168. _sfHeight (source._sfHeight ),
  1169. _sfDepth (source._sfDepth ),
  1170. _sfBpp (source._sfBpp ),
  1171. _sfMipMapCount (source._sfMipMapCount ),
  1172. _sfFrameCount (source._sfFrameCount ),
  1173. _sfFrameDelay (source._sfFrameDelay ),
  1174. _sfPixelFormat (source._sfPixelFormat ),
  1175. _mfPixel (source._mfPixel ),
  1176. _sfFrameSize (source._sfFrameSize ),
  1177. _sfName (source._sfName ),
  1178. _sfDataType (source._sfDataType ),
  1179. _sfComponentSize (source._sfComponentSize ),
  1180. _sfSideCount (source._sfSideCount ),
  1181. _sfSideSize (source._sfSideSize ),
  1182. _sfForceCompressedData (source._sfForceCompressedData ),
  1183. _sfForceAlphaChannel (source._sfForceAlphaChannel ),
  1184. _sfForceColorChannel (source._sfForceColorChannel ),
  1185. _sfForceAlphaBinary (source._sfForceAlphaBinary )
  1186. {
  1187. }
  1188. /*-------------------------- destructors ----------------------------------*/
  1189. ImageBase::~ImageBase(void)
  1190. {
  1191. }
  1192. GetFieldHandlePtr ImageBase::getHandleParents (void) const
  1193. {
  1194. MFUnrecParentFieldContainerPtr::GetHandlePtr returnValue;
  1195. return returnValue;
  1196. }
  1197. EditFieldHandlePtr ImageBase::editHandleParents (void)
  1198. {
  1199. EditFieldHandlePtr returnValue;
  1200. return returnValue;
  1201. }
  1202. GetFieldHandlePtr ImageBase::getHandleDimension (void) const
  1203. {
  1204. SFInt32::GetHandlePtr returnValue(
  1205. new SFInt32::GetHandle(
  1206. &_sfDimension,
  1207. this->getType().getFieldDesc(DimensionFieldId),
  1208. const_cast<ImageBase *>(this)));
  1209. return returnValue;
  1210. }
  1211. EditFieldHandlePtr ImageBase::editHandleDimension (void)
  1212. {
  1213. SFInt32::EditHandlePtr returnValue(
  1214. new SFInt32::EditHandle(
  1215. &_sfDimension,
  1216. this->getType().getFieldDesc(DimensionFieldId),
  1217. this));
  1218. editSField(DimensionFieldMask);
  1219. return returnValue;
  1220. }
  1221. GetFieldHandlePtr ImageBase::getHandleWidth (void) const
  1222. {
  1223. SFInt32::GetHandlePtr returnValue(
  1224. new SFInt32::GetHandle(
  1225. &_sfWidth,
  1226. this->getType().getFieldDesc(WidthFieldId),
  1227. const_cast<ImageBase *>(this)));
  1228. return returnValue;
  1229. }
  1230. EditFieldHandlePtr ImageBase::editHandleWidth (void)
  1231. {
  1232. SFInt32::EditHandlePtr returnValue(
  1233. new SFInt32::EditHandle(
  1234. &_sfWidth,
  1235. this->getType().getFieldDesc(WidthFieldId),
  1236. this));
  1237. editSField(WidthFieldMask);
  1238. return returnValue;
  1239. }
  1240. GetFieldHandlePtr ImageBase::getHandleHeight (void) const
  1241. {
  1242. SFInt32::GetHandlePtr returnValue(
  1243. new SFInt32::GetHandle(
  1244. &_sfHeight,
  1245. this->getType().getFieldDesc(HeightFieldId),
  1246. const_cast<ImageBase *>(this)));
  1247. return returnValue;
  1248. }
  1249. EditFieldHandlePtr ImageBase::editHandleHeight (void)
  1250. {
  1251. SFInt32::EditHandlePtr returnValue(
  1252. new SFInt32::EditHandle(
  1253. &_sfHeight,
  1254. this->getType().getFieldDesc(HeightFieldId),
  1255. this));
  1256. editSField(HeightFieldMask);
  1257. return returnValue;
  1258. }
  1259. GetFieldHandlePtr ImageBase::getHandleDepth (void) const
  1260. {
  1261. SFInt32::GetHandlePtr returnValue(
  1262. new SFInt32::GetHandle(
  1263. &_sfDepth,
  1264. this->getType().getFieldDesc(DepthFieldId),
  1265. const_cast<ImageBase *>(this)));
  1266. return returnValue;
  1267. }
  1268. EditFieldHandlePtr ImageBase::editHandleDepth (void)
  1269. {
  1270. SFInt32::EditHandlePtr returnValue(
  1271. new SFInt32::EditHandle(
  1272. &_sfDepth,
  1273. this->getType().getFieldDesc(DepthFieldId),
  1274. this));
  1275. editSField(DepthFieldMask);
  1276. return returnValue;
  1277. }
  1278. GetFieldHandlePtr ImageBase::getHandleBpp (void) const
  1279. {
  1280. SFInt32::GetHandlePtr returnValue(
  1281. new SFInt32::GetHandle(
  1282. &_sfBpp,
  1283. this->getType().getFieldDesc(BppFieldId),
  1284. const_cast<ImageBase *>(this)));
  1285. return returnValue;
  1286. }
  1287. EditFieldHandlePtr ImageBase::editHandleBpp (void)
  1288. {
  1289. SFInt32::EditHandlePtr returnValue(
  1290. new SFInt32::EditHandle(
  1291. &_sfBpp,
  1292. this->getType().getFieldDesc(BppFieldId),
  1293. this));
  1294. editSField(BppFieldMask);
  1295. return returnValue;
  1296. }
  1297. GetFieldHandlePtr ImageBase::getHandleMipMapCount (void) const
  1298. {
  1299. SFInt32::GetHandlePtr returnValue(
  1300. new SFInt32::GetHandle(
  1301. &_sfMipMapCount,
  1302. this->getType().getFieldDesc(MipMapCountFieldId),
  1303. const_cast<ImageBase *>(this)));
  1304. return returnValue;
  1305. }
  1306. EditFieldHandlePtr ImageBase::editHandleMipMapCount (void)
  1307. {
  1308. SFInt32::EditHandlePtr returnValue(
  1309. new SFInt32::EditHandle(
  1310. &_sfMipMapCount,
  1311. this->getType().getFieldDesc(MipMapCountFieldId),
  1312. this));
  1313. editSField(MipMapCountFieldMask);
  1314. return returnValue;
  1315. }
  1316. GetFieldHandlePtr ImageBase::getHandleFrameCount (void) const
  1317. {
  1318. SFInt32::GetHandlePtr returnValue(
  1319. new SFInt32::GetHandle(
  1320. &_sfFrameCount,
  1321. this->getType().getFieldDesc(FrameCountFieldId),
  1322. const_cast<ImageBase *>(this)));
  1323. return returnValue;
  1324. }
  1325. EditFieldHandlePtr ImageBase::editHandleFrameCount (void)
  1326. {
  1327. SFInt32::EditHandlePtr returnValue(
  1328. new SFInt32::EditHandle(
  1329. &_sfFrameCount,
  1330. this->getType().getFieldDesc(FrameCountFieldId),
  1331. this));
  1332. editSField(FrameCountFieldMask);
  1333. return returnValue;
  1334. }
  1335. GetFieldHandlePtr ImageBase::getHandleFrameDelay (void) const
  1336. {
  1337. SFTime::GetHandlePtr returnValue(
  1338. new SFTime::GetHandle(
  1339. &_sfFrameDelay,
  1340. this->getType().getFieldDesc(FrameDelayFieldId),
  1341. const_cast<ImageBase *>(this)));
  1342. return returnValue;
  1343. }
  1344. EditFieldHandlePtr ImageBase::editHandleFrameDelay (void)
  1345. {
  1346. SFTime::EditHandlePtr returnValue(
  1347. new SFTime::EditHandle(
  1348. &_sfFrameDelay,
  1349. this->getType().getFieldDesc(FrameDelayFieldId),
  1350. this));
  1351. editSField(FrameDelayFieldMask);
  1352. return returnValue;
  1353. }
  1354. GetFieldHandlePtr ImageBase::getHandlePixelFormat (void) const
  1355. {
  1356. SFUInt32::GetHandlePtr returnValue(
  1357. new SFUInt32::GetHandle(
  1358. &_sfPixelFormat,
  1359. this->getType().getFieldDesc(PixelFormatFieldId),
  1360. const_cast<ImageBase *>(this)));
  1361. return returnValue;
  1362. }
  1363. EditFieldHandlePtr ImageBase::editHandlePixelFormat (void)
  1364. {
  1365. SFUInt32::EditHandlePtr returnValue(
  1366. new SFUInt32::EditHandle(
  1367. &_sfPixelFormat,
  1368. this->getType().getFieldDesc(PixelFormatFieldId),
  1369. this));
  1370. editSField(PixelFormatFieldMask);
  1371. return returnValue;
  1372. }
  1373. GetFieldHandlePtr ImageBase::getHandlePixel (void) const
  1374. {
  1375. MFUInt8::GetHandlePtr returnValue(
  1376. new MFUInt8::GetHandle(
  1377. &_mfPixel,
  1378. this->getType().getFieldDesc(PixelFieldId),
  1379. const_cast<ImageBase *>(this)));
  1380. return returnValue;
  1381. }
  1382. EditFieldHandlePtr ImageBase::editHandlePixel (void)
  1383. {
  1384. MFUInt8::EditHandlePtr returnValue(
  1385. new MFUInt8::EditHandle(
  1386. &_mfPixel,
  1387. this->getType().getFieldDesc(PixelFieldId),
  1388. this));
  1389. editMField(PixelFieldMask, _mfPixel);
  1390. return returnValue;
  1391. }
  1392. GetFieldHandlePtr ImageBase::getHandleFrameSize (void) const
  1393. {
  1394. SFInt32::GetHandlePtr returnValue(
  1395. new SFInt32::GetHandle(
  1396. &_sfFrameSize,
  1397. this->getType().getFieldDesc(FrameSizeFieldId),
  1398. const_cast<ImageBase *>(this)));
  1399. return returnValue;
  1400. }
  1401. EditFieldHandlePtr ImageBase::editHandleFrameSize (void)
  1402. {
  1403. SFInt32::EditHandlePtr returnValue(
  1404. new SFInt32::EditHandle(
  1405. &_sfFrameSize,
  1406. this->getType().getFieldDesc(FrameSizeFieldId),
  1407. this));
  1408. editSField(FrameSizeFieldMask);
  1409. return returnValue;
  1410. }
  1411. GetFieldHandlePtr ImageBase::getHandleName (void) const
  1412. {
  1413. SFString::GetHandlePtr returnValue(
  1414. new SFString::GetHandle(
  1415. &_sfName,
  1416. this->getType().getFieldDesc(NameFieldId),
  1417. const_cast<ImageBase *>(this)));
  1418. return returnValue;
  1419. }
  1420. EditFieldHandlePtr ImageBase::editHandleName (void)
  1421. {
  1422. SFString::EditHandlePtr returnValue(
  1423. new SFString::EditHandle(
  1424. &_sfName,
  1425. this->getType().getFieldDesc(NameFieldId),
  1426. this));
  1427. editSField(NameFieldMask);
  1428. return returnValue;
  1429. }
  1430. GetFieldHandlePtr ImageBase::getHandleDataType (void) const
  1431. {
  1432. SFInt32::GetHandlePtr returnValue(
  1433. new SFInt32::GetHandle(
  1434. &_sfDataType,
  1435. this->getType().getFieldDesc(DataTypeFieldId),
  1436. const_cast<ImageBase *>(this)));
  1437. return returnValue;
  1438. }
  1439. EditFieldHandlePtr ImageBase::editHandleDataType (void)
  1440. {
  1441. SFInt32::EditHandlePtr returnValue(
  1442. new SFInt32::EditHandle(
  1443. &_sfDataType,
  1444. this->getType().getFieldDesc(DataTypeFieldId),
  1445. this));
  1446. editSField(DataTypeFieldMask);
  1447. return returnValue;
  1448. }
  1449. GetFieldHandlePtr ImageBase::getHandleComponentSize (void) const
  1450. {
  1451. SFInt32::GetHandlePtr returnValue(
  1452. new SFInt32::GetHandle(
  1453. &_sfComponentSize,
  1454. this->getType().getFieldDesc(ComponentSizeFieldId),
  1455. const_cast<ImageBase *>(this)));
  1456. return returnValue;
  1457. }
  1458. EditFieldHandlePtr ImageBase::editHandleComponentSize (void)
  1459. {
  1460. SFInt32::EditHandlePtr returnValue(
  1461. new SFInt32::EditHandle(
  1462. &_sfComponentSize,
  1463. this->getType().getFieldDesc(ComponentSizeFieldId),
  1464. this));
  1465. editSField(ComponentSizeFieldMask);
  1466. return returnValue;
  1467. }
  1468. GetFieldHandlePtr ImageBase::getHandleSideCount (void) const
  1469. {
  1470. SFInt32::GetHandlePtr returnValue(
  1471. new SFInt32::GetHandle(
  1472. &_sfSideCount,
  1473. this->getType().getFieldDesc(SideCountFieldId),
  1474. const_cast<ImageBase *>(this)));
  1475. return returnValue;
  1476. }
  1477. EditFieldHandlePtr ImageBase::editHandleSideCount (void)
  1478. {
  1479. SFInt32::EditHandlePtr returnValue(
  1480. new SFInt32::EditHandle(
  1481. &_sfSideCount,
  1482. this->getType().getFieldDesc(SideCountFieldId),
  1483. this));
  1484. editSField(SideCountFieldMask);
  1485. return returnValue;
  1486. }
  1487. GetFieldHandlePtr ImageBase::getHandleSideSize (void) const
  1488. {
  1489. SFInt32::GetHandlePtr returnValue(
  1490. new SFInt32::GetHandle(
  1491. &_sfSideSize,
  1492. this->getType().getFieldDesc(SideSizeFieldId),
  1493. const_cast<ImageBase *>(this)));
  1494. return returnValue;
  1495. }
  1496. EditFieldHandlePtr ImageBase::editHandleSideSize (void)
  1497. {
  1498. SFInt32::EditHandlePtr returnValue(
  1499. new SFInt32::EditHandle(
  1500. &_sfSideSize,
  1501. this->getType().getFieldDesc(SideSizeFieldId),
  1502. this));
  1503. editSField(SideSizeFieldMask);
  1504. return returnValue;
  1505. }
  1506. GetFieldHandlePtr ImageBase::getHandleForceCompressedData (void) const
  1507. {
  1508. SFBool::GetHandlePtr returnValue(
  1509. new SFBool::GetHandle(
  1510. &_sfForceCompressedData,
  1511. this->getType().getFieldDesc(ForceCompressedDataFieldId),
  1512. const_cast<ImageBase *>(this)));
  1513. return returnValue;
  1514. }
  1515. EditFieldHandlePtr ImageBase::editHandleForceCompressedData(void)
  1516. {
  1517. SFBool::EditHandlePtr returnValue(
  1518. new SFBool::EditHandle(
  1519. &_sfForceCompressedData,
  1520. this->getType().getFieldDesc(ForceCompressedDataFieldId),
  1521. this));
  1522. editSField(ForceCompressedDataFieldMask);
  1523. return returnValue;
  1524. }
  1525. GetFieldHandlePtr ImageBase::getHandleForceAlphaChannel (void) const
  1526. {
  1527. SFBool::GetHandlePtr returnValue(
  1528. new SFBool::GetHandle(
  1529. &_sfForceAlphaChannel,
  1530. this->getType().getFieldDesc(ForceAlphaChannelFieldId),
  1531. const_cast<ImageBase *>(this)));
  1532. return returnValue;
  1533. }
  1534. EditFieldHandlePtr ImageBase::editHandleForceAlphaChannel(void)
  1535. {
  1536. SFBool::EditHandlePtr returnValue(
  1537. new SFBool::EditHandle(
  1538. &_sfForceAlphaChannel,
  1539. this->getType().getFieldDesc(ForceAlphaChannelFieldId),
  1540. this));
  1541. editSField(ForceAlphaChannelFieldMask);
  1542. return returnValue;
  1543. }
  1544. GetFieldHandlePtr ImageBase::getHandleForceColorChannel (void) const
  1545. {
  1546. SFBool::GetHandlePtr returnValue(
  1547. new SFBool::GetHandle(
  1548. &_sfForceColorChannel,
  1549. this->getType().getFieldDesc(ForceColorChannelFieldId),
  1550. const_cast<ImageBase *>(this)));
  1551. return returnValue;
  1552. }
  1553. EditFieldHandlePtr ImageBase::editHandleForceColorChannel(void)
  1554. {
  1555. SFBool::EditHandlePtr returnValue(
  1556. new SFBool::EditHandle(
  1557. &_sfForceColorChannel,
  1558. this->getType().getFieldDesc(ForceColorChannelFieldId),
  1559. this));
  1560. editSField(ForceColorChannelFieldMask);
  1561. return returnValue;
  1562. }
  1563. GetFieldHandlePtr ImageBase::getHandleForceAlphaBinary (void) const
  1564. {
  1565. SFBool::GetHandlePtr returnValue(
  1566. new SFBool::GetHandle(
  1567. &_sfForceAlphaBinary,
  1568. this->getType().getFieldDesc(ForceAlphaBinaryFieldId),
  1569. const_cast<ImageBase *>(this)));
  1570. return returnValue;
  1571. }
  1572. EditFieldHandlePtr ImageBase::editHandleForceAlphaBinary(void)
  1573. {
  1574. SFBool::EditHandlePtr returnValue(
  1575. new SFBool::EditHandle(
  1576. &_sfForceAlphaBinary,
  1577. this->getType().getFieldDesc(ForceAlphaBinaryFieldId),
  1578. this));
  1579. editSField(ForceAlphaBinaryFieldMask);
  1580. return returnValue;
  1581. }
  1582. #ifdef OSG_MT_CPTR_ASPECT
  1583. void ImageBase::execSyncV( FieldContainer &oFrom,
  1584. ConstFieldMaskArg whichField,
  1585. AspectOffsetStore &oOffsets,
  1586. ConstFieldMaskArg syncMode,
  1587. const UInt32 uiSyncInfo)
  1588. {
  1589. Image *pThis = static_cast<Image *>(this);
  1590. pThis->execSync(static_cast<Image *>(&oFrom),
  1591. whichField,
  1592. oOffsets,
  1593. syncMode,
  1594. uiSyncInfo);
  1595. }
  1596. #endif
  1597. #ifdef OSG_MT_CPTR_ASPECT
  1598. FieldContainer *ImageBase::createAspectCopy(
  1599. const FieldContainer *pRefAspect) const
  1600. {
  1601. Image *returnValue;
  1602. newAspectCopy(returnValue,
  1603. dynamic_cast<const Image *>(pRefAspect),
  1604. dynamic_cast<const Image *>(this));
  1605. return returnValue;
  1606. }
  1607. #endif
  1608. void ImageBase::resolveLinks(void)
  1609. {
  1610. Inherited::resolveLinks();
  1611. #ifdef OSG_MT_CPTR_ASPECT
  1612. AspectOffsetStore oOffsets;
  1613. _pAspectStore->fillOffsetArray(oOffsets, this);
  1614. #endif
  1615. #ifdef OSG_MT_CPTR_ASPECT
  1616. _mfPixel.terminateShare(Thread::getCurrentAspect(),
  1617. oOffsets);
  1618. #endif
  1619. }
  1620. OSG_END_NAMESPACE