1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
64 #include "OSGGL.h" // DataType default header
66 #include "OSGFieldContainer.h" // Parents Class
68 #include "OSGImageBase.h"
71 #include <boost/bind.hpp>
75 /***************************************************************************\
77 \***************************************************************************/
80 1D/2D/3D Image with various pixel types data, optionally also can hold
81 mipMap and simple multi-frame data.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var FieldContainer * ImageBase::_mfParents
92 /*! \var Int32 ImageBase::_sfDimension
93 Image dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.
96 /*! \var Int32 ImageBase::_sfWidth
100 /*! \var Int32 ImageBase::_sfHeight
104 /*! \var Int32 ImageBase::_sfDepth
108 /*! \var Int32 ImageBase::_sfBpp
109 Bytes of data per pixel.
112 /*! \var Int32 ImageBase::_sfMipMapCount
116 /*! \var Int32 ImageBase::_sfFrameCount
117 The number of frames in the data.
120 /*! \var Time ImageBase::_sfFrameDelay
121 Time between frames. Determines the frame rate.
124 /*! \var UInt32 ImageBase::_sfPixelFormat
128 /*! \var UInt8 ImageBase::_mfPixel
129 The pixel data buffer. This is where the data for the image is stored.
132 /*! \var Int32 ImageBase::_sfFrameSize
136 /*! \var std::string ImageBase::_sfName
140 /*! \var Int32 ImageBase::_sfDataType
144 /*! \var Int32 ImageBase::_sfComponentSize
145 Size (in byte) of a single component of the image. Necessary
146 for High Dynamic Range and other higher-level image types.
149 /*! \var Int32 ImageBase::_sfSideCount
153 /*! \var Int32 ImageBase::_sfSideSize
157 /*! \var bool ImageBase::_sfForceCompressedData
158 Set to true if using the image to keep unknown data for textures.
159 Generally used in conjunction with TextureChunk::externalFormat.
162 /*! \var bool ImageBase::_sfForceAlphaChannel
163 Set to true if using the image to keep unknown data for textures.
164 Generally used in conjunction with TextureChunk::externalFormat.
167 /*! \var bool ImageBase::_sfForceColorChannel
168 Set to true if using the image to keep unknown data for textures.
169 Generally used in conjunction with TextureChunk::externalFormat.
172 /*! \var bool ImageBase::_sfForceAlphaBinary
173 Set to true if using the image to prevent depth sorting for
174 SimpleTexturedMaterials using this Image.
177 /*! \var Real32 ImageBase::_sfResX
181 /*! \var Real32 ImageBase::_sfResY
185 /*! \var UInt16 ImageBase::_sfResUnit
186 resolution unit (invalid=0, none=1, inch=2)
189 /*! \var bool ImageBase::_sfClearOnLoad
190 Set to true if the image data should be cleared after it has been uploaded to the graphics
191 card and is no longer needed in main memory.
195 /***************************************************************************\
196 * FieldType/FieldTrait Instantiation *
197 \***************************************************************************/
199 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
200 PointerType FieldTraits
<Image
*, nsOSG
>::_type(
202 "AttachmentContainerPtr",
203 Image::getClassType(),
207 OSG_FIELDTRAITS_GETTYPE_NS(Image
*, nsOSG
)
209 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
213 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
217 DataType
&FieldTraits
< Image
*, nsOSG
+ 1 >::getType(void)
219 return FieldTraits
<Image
*, nsOSG
>::getType();
223 OSG_EXPORT_PTR_SFIELD(ChildPointerSField
,
225 UnrecordedRefCountPolicy
,
229 /***************************************************************************\
230 * Field Description *
231 \***************************************************************************/
233 void ImageBase::classDescInserter(TypeObject
&oType
)
235 FieldDescriptionBase
*pDesc
= NULL
;
238 pDesc
= new MFParentFieldContainerPtr::Description(
239 MFParentFieldContainerPtr::getClassType(),
242 ParentsFieldId
, ParentsFieldMask
,
244 (Field::MFDefaultFlags
| Field::FStdAccess
),
245 static_cast <FieldEditMethodSig
>(&Image::invalidEditField
),
246 static_cast <FieldGetMethodSig
>(&Image::invalidGetField
));
248 oType
.addInitialDesc(pDesc
);
250 pDesc
= new SFInt32::Description(
251 SFInt32::getClassType(),
253 "Image dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.\n",
254 DimensionFieldId
, DimensionFieldMask
,
256 (Field::SFDefaultFlags
| Field::FStdAccess
),
257 static_cast<FieldEditMethodSig
>(&Image::editHandleDimension
),
258 static_cast<FieldGetMethodSig
>(&Image::getHandleDimension
));
260 oType
.addInitialDesc(pDesc
);
262 pDesc
= new SFInt32::Description(
263 SFInt32::getClassType(),
266 WidthFieldId
, WidthFieldMask
,
268 (Field::SFDefaultFlags
| Field::FStdAccess
),
269 static_cast<FieldEditMethodSig
>(&Image::editHandleWidth
),
270 static_cast<FieldGetMethodSig
>(&Image::getHandleWidth
));
272 oType
.addInitialDesc(pDesc
);
274 pDesc
= new SFInt32::Description(
275 SFInt32::getClassType(),
278 HeightFieldId
, HeightFieldMask
,
280 (Field::SFDefaultFlags
| Field::FStdAccess
),
281 static_cast<FieldEditMethodSig
>(&Image::editHandleHeight
),
282 static_cast<FieldGetMethodSig
>(&Image::getHandleHeight
));
284 oType
.addInitialDesc(pDesc
);
286 pDesc
= new SFInt32::Description(
287 SFInt32::getClassType(),
290 DepthFieldId
, DepthFieldMask
,
292 (Field::SFDefaultFlags
| Field::FStdAccess
),
293 static_cast<FieldEditMethodSig
>(&Image::editHandleDepth
),
294 static_cast<FieldGetMethodSig
>(&Image::getHandleDepth
));
296 oType
.addInitialDesc(pDesc
);
298 pDesc
= new SFInt32::Description(
299 SFInt32::getClassType(),
301 "Bytes of data per pixel.\n",
302 BppFieldId
, BppFieldMask
,
304 (Field::SFDefaultFlags
| Field::FStdAccess
),
305 static_cast<FieldEditMethodSig
>(&Image::editHandleBpp
),
306 static_cast<FieldGetMethodSig
>(&Image::getHandleBpp
));
308 oType
.addInitialDesc(pDesc
);
310 pDesc
= new SFInt32::Description(
311 SFInt32::getClassType(),
314 MipMapCountFieldId
, MipMapCountFieldMask
,
316 (Field::SFDefaultFlags
| Field::FStdAccess
),
317 static_cast<FieldEditMethodSig
>(&Image::editHandleMipMapCount
),
318 static_cast<FieldGetMethodSig
>(&Image::getHandleMipMapCount
));
320 oType
.addInitialDesc(pDesc
);
322 pDesc
= new SFInt32::Description(
323 SFInt32::getClassType(),
325 "The number of frames in the data.\n",
326 FrameCountFieldId
, FrameCountFieldMask
,
328 (Field::SFDefaultFlags
| Field::FStdAccess
),
329 static_cast<FieldEditMethodSig
>(&Image::editHandleFrameCount
),
330 static_cast<FieldGetMethodSig
>(&Image::getHandleFrameCount
));
332 oType
.addInitialDesc(pDesc
);
334 pDesc
= new SFTime::Description(
335 SFTime::getClassType(),
337 "Time between frames. Determines the frame rate.\n",
338 FrameDelayFieldId
, FrameDelayFieldMask
,
340 (Field::SFDefaultFlags
| Field::FStdAccess
),
341 static_cast<FieldEditMethodSig
>(&Image::editHandleFrameDelay
),
342 static_cast<FieldGetMethodSig
>(&Image::getHandleFrameDelay
));
344 oType
.addInitialDesc(pDesc
);
346 pDesc
= new SFUInt32::Description(
347 SFUInt32::getClassType(),
350 PixelFormatFieldId
, PixelFormatFieldMask
,
352 (Field::SFDefaultFlags
| Field::FStdAccess
),
353 static_cast<FieldEditMethodSig
>(&Image::editHandlePixelFormat
),
354 static_cast<FieldGetMethodSig
>(&Image::getHandlePixelFormat
));
356 oType
.addInitialDesc(pDesc
);
358 pDesc
= new MFUInt8::Description(
359 MFUInt8::getClassType(),
361 "The pixel data buffer. This is where the data for the image is stored.\n",
362 PixelFieldId
, PixelFieldMask
,
364 (Field::MFDefaultFlags
| Field::FStdAccess
),
365 static_cast<FieldEditMethodSig
>(&Image::editHandlePixel
),
366 static_cast<FieldGetMethodSig
>(&Image::getHandlePixel
));
368 oType
.addInitialDesc(pDesc
);
370 pDesc
= new SFInt32::Description(
371 SFInt32::getClassType(),
374 FrameSizeFieldId
, FrameSizeFieldMask
,
376 (Field::SFDefaultFlags
| Field::FStdAccess
),
377 static_cast<FieldEditMethodSig
>(&Image::editHandleFrameSize
),
378 static_cast<FieldGetMethodSig
>(&Image::getHandleFrameSize
));
380 oType
.addInitialDesc(pDesc
);
382 pDesc
= new SFString::Description(
383 SFString::getClassType(),
385 "Texture file path.\n",
386 NameFieldId
, NameFieldMask
,
388 (Field::SFDefaultFlags
| Field::FStdAccess
),
389 static_cast<FieldEditMethodSig
>(&Image::editHandleName
),
390 static_cast<FieldGetMethodSig
>(&Image::getHandleName
));
392 oType
.addInitialDesc(pDesc
);
394 pDesc
= new SFInt32::Description(
395 SFInt32::getClassType(),
397 "Type of image data.\n",
398 DataTypeFieldId
, DataTypeFieldMask
,
400 (Field::SFDefaultFlags
| Field::FStdAccess
),
401 static_cast<FieldEditMethodSig
>(&Image::editHandleDataType
),
402 static_cast<FieldGetMethodSig
>(&Image::getHandleDataType
));
404 oType
.addInitialDesc(pDesc
);
406 pDesc
= new SFInt32::Description(
407 SFInt32::getClassType(),
409 "Size (in byte) of a single component of the image. Necessary\n"
410 "for High Dynamic Range and other higher-level image types.\n",
411 ComponentSizeFieldId
, ComponentSizeFieldMask
,
413 (Field::SFDefaultFlags
| Field::FStdAccess
),
414 static_cast<FieldEditMethodSig
>(&Image::editHandleComponentSize
),
415 static_cast<FieldGetMethodSig
>(&Image::getHandleComponentSize
));
417 oType
.addInitialDesc(pDesc
);
419 pDesc
= new SFInt32::Description(
420 SFInt32::getClassType(),
423 SideCountFieldId
, SideCountFieldMask
,
425 (Field::SFDefaultFlags
| Field::FStdAccess
),
426 static_cast<FieldEditMethodSig
>(&Image::editHandleSideCount
),
427 static_cast<FieldGetMethodSig
>(&Image::getHandleSideCount
));
429 oType
.addInitialDesc(pDesc
);
431 pDesc
= new SFInt32::Description(
432 SFInt32::getClassType(),
435 SideSizeFieldId
, SideSizeFieldMask
,
437 (Field::SFDefaultFlags
| Field::FStdAccess
),
438 static_cast<FieldEditMethodSig
>(&Image::editHandleSideSize
),
439 static_cast<FieldGetMethodSig
>(&Image::getHandleSideSize
));
441 oType
.addInitialDesc(pDesc
);
443 pDesc
= new SFBool::Description(
444 SFBool::getClassType(),
445 "forceCompressedData",
446 "Set to true if using the image to keep unknown data for textures.\n"
447 "Generally used in conjunction with TextureChunk::externalFormat.\n",
448 ForceCompressedDataFieldId
, ForceCompressedDataFieldMask
,
450 (Field::SFDefaultFlags
| Field::FStdAccess
),
451 static_cast<FieldEditMethodSig
>(&Image::editHandleForceCompressedData
),
452 static_cast<FieldGetMethodSig
>(&Image::getHandleForceCompressedData
));
454 oType
.addInitialDesc(pDesc
);
456 pDesc
= new SFBool::Description(
457 SFBool::getClassType(),
459 "Set to true if using the image to keep unknown data for textures.\n"
460 "Generally used in conjunction with TextureChunk::externalFormat.\n",
461 ForceAlphaChannelFieldId
, ForceAlphaChannelFieldMask
,
463 (Field::SFDefaultFlags
| Field::FStdAccess
),
464 static_cast<FieldEditMethodSig
>(&Image::editHandleForceAlphaChannel
),
465 static_cast<FieldGetMethodSig
>(&Image::getHandleForceAlphaChannel
));
467 oType
.addInitialDesc(pDesc
);
469 pDesc
= new SFBool::Description(
470 SFBool::getClassType(),
472 "Set to true if using the image to keep unknown data for textures.\n"
473 "Generally used in conjunction with TextureChunk::externalFormat.\n",
474 ForceColorChannelFieldId
, ForceColorChannelFieldMask
,
476 (Field::SFDefaultFlags
| Field::FStdAccess
),
477 static_cast<FieldEditMethodSig
>(&Image::editHandleForceColorChannel
),
478 static_cast<FieldGetMethodSig
>(&Image::getHandleForceColorChannel
));
480 oType
.addInitialDesc(pDesc
);
482 pDesc
= new SFBool::Description(
483 SFBool::getClassType(),
485 "Set to true if using the image to prevent depth sorting for \n"
486 "SimpleTexturedMaterials using this Image.\n",
487 ForceAlphaBinaryFieldId
, ForceAlphaBinaryFieldMask
,
489 (Field::SFDefaultFlags
| Field::FStdAccess
),
490 static_cast<FieldEditMethodSig
>(&Image::editHandleForceAlphaBinary
),
491 static_cast<FieldGetMethodSig
>(&Image::getHandleForceAlphaBinary
));
493 oType
.addInitialDesc(pDesc
);
495 pDesc
= new SFReal32::Description(
496 SFReal32::getClassType(),
499 ResXFieldId
, ResXFieldMask
,
501 (Field::SFDefaultFlags
| Field::FStdAccess
),
502 static_cast<FieldEditMethodSig
>(&Image::editHandleResX
),
503 static_cast<FieldGetMethodSig
>(&Image::getHandleResX
));
505 oType
.addInitialDesc(pDesc
);
507 pDesc
= new SFReal32::Description(
508 SFReal32::getClassType(),
511 ResYFieldId
, ResYFieldMask
,
513 (Field::SFDefaultFlags
| Field::FStdAccess
),
514 static_cast<FieldEditMethodSig
>(&Image::editHandleResY
),
515 static_cast<FieldGetMethodSig
>(&Image::getHandleResY
));
517 oType
.addInitialDesc(pDesc
);
519 pDesc
= new SFUInt16::Description(
520 SFUInt16::getClassType(),
522 "resolution unit (invalid=0, none=1, inch=2)\n",
523 ResUnitFieldId
, ResUnitFieldMask
,
525 (Field::SFDefaultFlags
| Field::FStdAccess
),
526 static_cast<FieldEditMethodSig
>(&Image::editHandleResUnit
),
527 static_cast<FieldGetMethodSig
>(&Image::getHandleResUnit
));
529 oType
.addInitialDesc(pDesc
);
531 pDesc
= new SFBool::Description(
532 SFBool::getClassType(),
534 "Set to true if the image data should be cleared after it has been uploaded to the graphics\n"
535 "card and is no longer needed in main memory.\n",
536 ClearOnLoadFieldId
, ClearOnLoadFieldMask
,
538 (Field::SFDefaultFlags
| Field::FStdAccess
),
539 static_cast<FieldEditMethodSig
>(&Image::editHandleClearOnLoad
),
540 static_cast<FieldGetMethodSig
>(&Image::getHandleClearOnLoad
));
542 oType
.addInitialDesc(pDesc
);
546 ImageBase::TypeObject
ImageBase::_type(
547 ImageBase::getClassname(),
548 Inherited::getClassname(),
551 reinterpret_cast<PrototypeCreateF
>(&ImageBase::createEmptyLocal
),
552 reinterpret_cast<InitContainerF
>(&Image::initMethod
),
553 reinterpret_cast<ExitContainerF
>(&Image::exitMethod
),
554 reinterpret_cast<InitalInsertDescFunc
>(&Image::classDescInserter
),
556 (ComponentSizeFieldMask
| SideSizeFieldMask
| FrameSizeFieldMask
),
557 "<?xml version=\"1.0\"?>\n"
561 " parent=\"AttachmentContainer\"\n"
562 " library=\"System\"\n"
563 " pointerfieldtypes=\"both\"\n"
564 " structure=\"concrete\"\n"
565 " systemcomponent=\"true\"\n"
566 " parentsystemcomponent=\"true\"\n"
567 " decoratable=\"false\"\n"
568 " useLocalIncludes=\"false\"\n"
569 " fieldsUnmarkedOnCreate=\"(ComponentSizeFieldMask | SideSizeFieldMask | FrameSizeFieldMask)\"\n"
570 " childFields=\"single\"\n"
571 " docGroupBase=\"GrpSystemImage\"\n"
574 " 1D/2D/3D Image with various pixel types data, optionally also can hold\n"
575 " mipMap and simple multi-frame data.\n"
578 "\t name=\"parents\"\n"
579 "\t type=\"FieldContainer\"\n"
580 "\t cardinality=\"multi\"\n"
581 "\t visibility=\"internal\"\n"
582 "\t access=\"none\"\n"
583 " category=\"parentpointer\"\n"
587 "\t name=\"dimension\"\n"
588 "\t type=\"Int32\"\n"
589 "\t cardinality=\"single\"\n"
590 "\t visibility=\"external\"\n"
591 "\t defaultValue=\"0\"\n"
592 "\t access=\"public\"\n"
594 "\tImage dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.\n"
597 "\t name=\"width\"\n"
598 "\t type=\"Int32\"\n"
599 "\t cardinality=\"single\"\n"
600 "\t visibility=\"external\"\n"
601 "\t defaultValue=\"0\"\n"
602 "\t access=\"public\"\n"
606 "\t name=\"height\"\n"
607 "\t type=\"Int32\"\n"
608 "\t cardinality=\"single\"\n"
609 "\t visibility=\"external\"\n"
610 "\t defaultValue=\"1\"\n"
611 "\t access=\"public\"\n"
615 "\t name=\"depth\"\n"
616 "\t type=\"Int32\"\n"
617 "\t cardinality=\"single\"\n"
618 "\t visibility=\"external\"\n"
619 "\t defaultValue=\"1\"\n"
620 "\t access=\"public\"\n"
625 "\t type=\"Int32\"\n"
626 "\t cardinality=\"single\"\n"
627 "\t visibility=\"external\"\n"
628 "\t defaultValue=\"1\"\n"
629 "\t access=\"public\"\n"
631 " Bytes of data per pixel.\n"
634 "\t name=\"mipMapCount\"\n"
635 "\t type=\"Int32\"\n"
636 "\t cardinality=\"single\"\n"
637 "\t visibility=\"external\"\n"
638 "\t defaultValue=\"1\"\n"
639 "\t access=\"public\"\n"
643 "\t name=\"frameCount\"\n"
644 "\t type=\"Int32\"\n"
645 "\t cardinality=\"single\"\n"
646 "\t visibility=\"external\"\n"
647 "\t defaultValue=\"1\"\n"
648 "\t access=\"public\"\n"
650 " The number of frames in the data.\n"
653 "\t name=\"frameDelay\"\n"
655 "\t cardinality=\"single\"\n"
656 "\t visibility=\"external\"\n"
657 "\t defaultValue=\"0\"\n"
658 "\t access=\"public\"\n"
660 " Time between frames. Determines the frame rate.\n"
663 "\t name=\"pixelFormat\"\n"
664 "\t type=\"UInt32\"\n"
665 "\t cardinality=\"single\"\n"
666 "\t visibility=\"external\"\n"
667 "\t defaultValue=\"Image::OSG_INVALID_PF\"\n"
668 "\t access=\"public\"\n"
672 "\t name=\"pixel\"\n"
673 "\t type=\"UInt8\"\n"
674 "\t cardinality=\"multi\"\n"
675 "\t visibility=\"external\"\n"
676 "\t access=\"public\"\n"
678 " The pixel data buffer. This is where the data for the image is stored.\n"
681 "\t name=\"frameSize\"\n"
682 "\t type=\"Int32\"\n"
683 "\t cardinality=\"single\"\n"
684 "\t visibility=\"internal\"\n"
685 "\t defaultValue=\"0\"\n"
686 "\t access=\"public\"\n"
691 "\t type=\"std::string\"\n"
692 "\t cardinality=\"single\"\n"
693 "\t visibility=\"external\"\n"
694 "\t access=\"public\"\n"
696 "\tTexture file path.\n"
699 "\t name=\"dataType\"\n"
700 "\t type=\"Int32\"\n"
701 "\t cardinality=\"single\"\n"
702 "\t visibility=\"external\"\n"
703 "\t defaultValue=\"GL_UNSIGNED_BYTE\"\n"
704 "\t defaultHeader=\""OSGGL.h"\"\n"
705 "\t access=\"public\"\n"
707 "\tType of image data.\n"
710 "\t name=\"componentSize\"\n"
711 "\t type=\"Int32\"\n"
712 "\t cardinality=\"single\"\n"
713 "\t visibility=\"internal\"\n"
714 "\t defaultValue=\"1\"\n"
715 "\t access=\"protected\"\n"
717 "\tSize (in byte) of a single component of the image. Necessary\n"
718 " for High Dynamic Range and other higher-level image types.\n"
721 "\t name=\"sideCount\"\n"
722 "\t type=\"Int32\"\n"
723 "\t cardinality=\"single\"\n"
724 "\t visibility=\"external\"\n"
725 "\t defaultValue=\"1\"\n"
726 "\t access=\"public\"\n"
730 "\t name=\"sideSize\"\n"
731 "\t type=\"Int32\"\n"
732 "\t cardinality=\"single\"\n"
733 "\t visibility=\"internal\"\n"
734 "\t defaultValue=\"0\"\n"
735 "\t access=\"public\"\n"
739 "\t name=\"forceCompressedData\"\n"
741 "\t cardinality=\"single\"\n"
742 "\t visibility=\"external\"\n"
743 "\t defaultValue=\"false\"\n"
744 "\t access=\"public\"\n"
746 " Set to true if using the image to keep unknown data for textures.\n"
747 " Generally used in conjunction with TextureChunk::externalFormat.\n"
750 "\t name=\"forceAlphaChannel\"\n"
752 "\t cardinality=\"single\"\n"
753 "\t visibility=\"external\"\n"
754 "\t defaultValue=\"false\"\n"
755 "\t access=\"public\"\n"
757 " Set to true if using the image to keep unknown data for textures.\n"
758 " Generally used in conjunction with TextureChunk::externalFormat.\n"
761 "\t name=\"forceColorChannel\"\n"
763 "\t cardinality=\"single\"\n"
764 "\t visibility=\"external\"\n"
765 "\t defaultValue=\"false\"\n"
766 "\t access=\"public\"\n"
768 " Set to true if using the image to keep unknown data for textures.\n"
769 " Generally used in conjunction with TextureChunk::externalFormat.\n"
772 "\t name=\"forceAlphaBinary\"\n"
774 "\t cardinality=\"single\"\n"
775 "\t visibility=\"external\"\n"
776 "\t defaultValue=\"false\"\n"
777 "\t access=\"public\"\n"
779 " Set to true if using the image to prevent depth sorting for \n"
780 " SimpleTexturedMaterials using this Image.\n"
784 "\t type=\"Real32\"\n"
785 "\t cardinality=\"single\"\n"
786 "\t visibility=\"external\"\n"
787 "\t defaultValue=\"72.0f\"\n"
788 "\t access=\"public\"\n"
793 "\t type=\"Real32\"\n"
794 "\t cardinality=\"single\"\n"
795 "\t visibility=\"external\"\n"
796 "\t defaultValue=\"72.0f\"\n"
797 "\t access=\"public\"\n"
801 "\t name=\"resUnit\"\n"
802 "\t type=\"UInt16\"\n"
803 "\t cardinality=\"single\"\n"
804 "\t visibility=\"external\"\n"
805 "\t defaultValue=\"2\"\n"
806 "\t access=\"public\"\n"
808 "\tresolution unit (invalid=0, none=1, inch=2)\n"
811 "\t name=\"clearOnLoad\"\n"
813 "\t cardinality=\"single\"\n"
814 "\t visibility=\"external\"\n"
815 "\t defaultValue=\"false\"\n"
816 "\t access=\"public\"\n"
818 " Set to true if the image data should be cleared after it has been uploaded to the graphics\n"
819 " card and is no longer needed in main memory.\n"
821 "</FieldContainer>\n",
822 "1D/2D/3D Image with various pixel types data, optionally also can hold\n"
823 "mipMap and simple multi-frame data.\n"
826 /*------------------------------ get -----------------------------------*/
828 FieldContainerType
&ImageBase::getType(void)
833 const FieldContainerType
&ImageBase::getType(void) const
838 UInt32
ImageBase::getContainerSize(void) const
840 return sizeof(Image
);
843 /*------------------------- decorator get ------------------------------*/
847 SFInt32
*ImageBase::editSFDimension(void)
849 editSField(DimensionFieldMask
);
851 return &_sfDimension
;
854 const SFInt32
*ImageBase::getSFDimension(void) const
856 return &_sfDimension
;
860 SFInt32
*ImageBase::editSFWidth(void)
862 editSField(WidthFieldMask
);
867 const SFInt32
*ImageBase::getSFWidth(void) const
873 SFInt32
*ImageBase::editSFHeight(void)
875 editSField(HeightFieldMask
);
880 const SFInt32
*ImageBase::getSFHeight(void) const
886 SFInt32
*ImageBase::editSFDepth(void)
888 editSField(DepthFieldMask
);
893 const SFInt32
*ImageBase::getSFDepth(void) const
899 SFInt32
*ImageBase::editSFBpp(void)
901 editSField(BppFieldMask
);
906 const SFInt32
*ImageBase::getSFBpp(void) const
912 SFInt32
*ImageBase::editSFMipMapCount(void)
914 editSField(MipMapCountFieldMask
);
916 return &_sfMipMapCount
;
919 const SFInt32
*ImageBase::getSFMipMapCount(void) const
921 return &_sfMipMapCount
;
925 SFInt32
*ImageBase::editSFFrameCount(void)
927 editSField(FrameCountFieldMask
);
929 return &_sfFrameCount
;
932 const SFInt32
*ImageBase::getSFFrameCount(void) const
934 return &_sfFrameCount
;
938 SFTime
*ImageBase::editSFFrameDelay(void)
940 editSField(FrameDelayFieldMask
);
942 return &_sfFrameDelay
;
945 const SFTime
*ImageBase::getSFFrameDelay(void) const
947 return &_sfFrameDelay
;
951 SFUInt32
*ImageBase::editSFPixelFormat(void)
953 editSField(PixelFormatFieldMask
);
955 return &_sfPixelFormat
;
958 const SFUInt32
*ImageBase::getSFPixelFormat(void) const
960 return &_sfPixelFormat
;
964 MFUInt8
*ImageBase::editMFPixel(void)
966 editMField(PixelFieldMask
, _mfPixel
);
971 const MFUInt8
*ImageBase::getMFPixel(void) const
977 SFInt32
*ImageBase::editSFFrameSize(void)
979 editSField(FrameSizeFieldMask
);
981 return &_sfFrameSize
;
984 const SFInt32
*ImageBase::getSFFrameSize(void) const
986 return &_sfFrameSize
;
990 SFString
*ImageBase::editSFName(void)
992 editSField(NameFieldMask
);
997 const SFString
*ImageBase::getSFName(void) const
1003 SFInt32
*ImageBase::editSFDataType(void)
1005 editSField(DataTypeFieldMask
);
1007 return &_sfDataType
;
1010 const SFInt32
*ImageBase::getSFDataType(void) const
1012 return &_sfDataType
;
1016 SFInt32
*ImageBase::editSFComponentSize(void)
1018 editSField(ComponentSizeFieldMask
);
1020 return &_sfComponentSize
;
1023 const SFInt32
*ImageBase::getSFComponentSize(void) const
1025 return &_sfComponentSize
;
1029 SFInt32
*ImageBase::editSFSideCount(void)
1031 editSField(SideCountFieldMask
);
1033 return &_sfSideCount
;
1036 const SFInt32
*ImageBase::getSFSideCount(void) const
1038 return &_sfSideCount
;
1042 SFInt32
*ImageBase::editSFSideSize(void)
1044 editSField(SideSizeFieldMask
);
1046 return &_sfSideSize
;
1049 const SFInt32
*ImageBase::getSFSideSize(void) const
1051 return &_sfSideSize
;
1055 SFBool
*ImageBase::editSFForceCompressedData(void)
1057 editSField(ForceCompressedDataFieldMask
);
1059 return &_sfForceCompressedData
;
1062 const SFBool
*ImageBase::getSFForceCompressedData(void) const
1064 return &_sfForceCompressedData
;
1068 SFBool
*ImageBase::editSFForceAlphaChannel(void)
1070 editSField(ForceAlphaChannelFieldMask
);
1072 return &_sfForceAlphaChannel
;
1075 const SFBool
*ImageBase::getSFForceAlphaChannel(void) const
1077 return &_sfForceAlphaChannel
;
1081 SFBool
*ImageBase::editSFForceColorChannel(void)
1083 editSField(ForceColorChannelFieldMask
);
1085 return &_sfForceColorChannel
;
1088 const SFBool
*ImageBase::getSFForceColorChannel(void) const
1090 return &_sfForceColorChannel
;
1094 SFBool
*ImageBase::editSFForceAlphaBinary(void)
1096 editSField(ForceAlphaBinaryFieldMask
);
1098 return &_sfForceAlphaBinary
;
1101 const SFBool
*ImageBase::getSFForceAlphaBinary(void) const
1103 return &_sfForceAlphaBinary
;
1107 SFReal32
*ImageBase::editSFResX(void)
1109 editSField(ResXFieldMask
);
1114 const SFReal32
*ImageBase::getSFResX(void) const
1120 SFReal32
*ImageBase::editSFResY(void)
1122 editSField(ResYFieldMask
);
1127 const SFReal32
*ImageBase::getSFResY(void) const
1133 SFUInt16
*ImageBase::editSFResUnit(void)
1135 editSField(ResUnitFieldMask
);
1140 const SFUInt16
*ImageBase::getSFResUnit(void) const
1146 SFBool
*ImageBase::editSFClearOnLoad(void)
1148 editSField(ClearOnLoadFieldMask
);
1150 return &_sfClearOnLoad
;
1153 const SFBool
*ImageBase::getSFClearOnLoad(void) const
1155 return &_sfClearOnLoad
;
1163 /*------------------------------ access -----------------------------------*/
1165 SizeT
ImageBase::getBinSize(ConstFieldMaskArg whichField
)
1167 SizeT returnValue
= Inherited::getBinSize(whichField
);
1169 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
1171 returnValue
+= _mfParents
.getBinSize();
1173 if(FieldBits::NoField
!= (DimensionFieldMask
& whichField
))
1175 returnValue
+= _sfDimension
.getBinSize();
1177 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1179 returnValue
+= _sfWidth
.getBinSize();
1181 if(FieldBits::NoField
!= (HeightFieldMask
& whichField
))
1183 returnValue
+= _sfHeight
.getBinSize();
1185 if(FieldBits::NoField
!= (DepthFieldMask
& whichField
))
1187 returnValue
+= _sfDepth
.getBinSize();
1189 if(FieldBits::NoField
!= (BppFieldMask
& whichField
))
1191 returnValue
+= _sfBpp
.getBinSize();
1193 if(FieldBits::NoField
!= (MipMapCountFieldMask
& whichField
))
1195 returnValue
+= _sfMipMapCount
.getBinSize();
1197 if(FieldBits::NoField
!= (FrameCountFieldMask
& whichField
))
1199 returnValue
+= _sfFrameCount
.getBinSize();
1201 if(FieldBits::NoField
!= (FrameDelayFieldMask
& whichField
))
1203 returnValue
+= _sfFrameDelay
.getBinSize();
1205 if(FieldBits::NoField
!= (PixelFormatFieldMask
& whichField
))
1207 returnValue
+= _sfPixelFormat
.getBinSize();
1209 if(FieldBits::NoField
!= (PixelFieldMask
& whichField
))
1211 returnValue
+= _mfPixel
.getBinSize();
1213 if(FieldBits::NoField
!= (FrameSizeFieldMask
& whichField
))
1215 returnValue
+= _sfFrameSize
.getBinSize();
1217 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
1219 returnValue
+= _sfName
.getBinSize();
1221 if(FieldBits::NoField
!= (DataTypeFieldMask
& whichField
))
1223 returnValue
+= _sfDataType
.getBinSize();
1225 if(FieldBits::NoField
!= (ComponentSizeFieldMask
& whichField
))
1227 returnValue
+= _sfComponentSize
.getBinSize();
1229 if(FieldBits::NoField
!= (SideCountFieldMask
& whichField
))
1231 returnValue
+= _sfSideCount
.getBinSize();
1233 if(FieldBits::NoField
!= (SideSizeFieldMask
& whichField
))
1235 returnValue
+= _sfSideSize
.getBinSize();
1237 if(FieldBits::NoField
!= (ForceCompressedDataFieldMask
& whichField
))
1239 returnValue
+= _sfForceCompressedData
.getBinSize();
1241 if(FieldBits::NoField
!= (ForceAlphaChannelFieldMask
& whichField
))
1243 returnValue
+= _sfForceAlphaChannel
.getBinSize();
1245 if(FieldBits::NoField
!= (ForceColorChannelFieldMask
& whichField
))
1247 returnValue
+= _sfForceColorChannel
.getBinSize();
1249 if(FieldBits::NoField
!= (ForceAlphaBinaryFieldMask
& whichField
))
1251 returnValue
+= _sfForceAlphaBinary
.getBinSize();
1253 if(FieldBits::NoField
!= (ResXFieldMask
& whichField
))
1255 returnValue
+= _sfResX
.getBinSize();
1257 if(FieldBits::NoField
!= (ResYFieldMask
& whichField
))
1259 returnValue
+= _sfResY
.getBinSize();
1261 if(FieldBits::NoField
!= (ResUnitFieldMask
& whichField
))
1263 returnValue
+= _sfResUnit
.getBinSize();
1265 if(FieldBits::NoField
!= (ClearOnLoadFieldMask
& whichField
))
1267 returnValue
+= _sfClearOnLoad
.getBinSize();
1273 void ImageBase::copyToBin(BinaryDataHandler
&pMem
,
1274 ConstFieldMaskArg whichField
)
1276 Inherited::copyToBin(pMem
, whichField
);
1278 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
1280 _mfParents
.copyToBin(pMem
);
1282 if(FieldBits::NoField
!= (DimensionFieldMask
& whichField
))
1284 _sfDimension
.copyToBin(pMem
);
1286 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1288 _sfWidth
.copyToBin(pMem
);
1290 if(FieldBits::NoField
!= (HeightFieldMask
& whichField
))
1292 _sfHeight
.copyToBin(pMem
);
1294 if(FieldBits::NoField
!= (DepthFieldMask
& whichField
))
1296 _sfDepth
.copyToBin(pMem
);
1298 if(FieldBits::NoField
!= (BppFieldMask
& whichField
))
1300 _sfBpp
.copyToBin(pMem
);
1302 if(FieldBits::NoField
!= (MipMapCountFieldMask
& whichField
))
1304 _sfMipMapCount
.copyToBin(pMem
);
1306 if(FieldBits::NoField
!= (FrameCountFieldMask
& whichField
))
1308 _sfFrameCount
.copyToBin(pMem
);
1310 if(FieldBits::NoField
!= (FrameDelayFieldMask
& whichField
))
1312 _sfFrameDelay
.copyToBin(pMem
);
1314 if(FieldBits::NoField
!= (PixelFormatFieldMask
& whichField
))
1316 _sfPixelFormat
.copyToBin(pMem
);
1318 if(FieldBits::NoField
!= (PixelFieldMask
& whichField
))
1320 _mfPixel
.copyToBin(pMem
);
1322 if(FieldBits::NoField
!= (FrameSizeFieldMask
& whichField
))
1324 _sfFrameSize
.copyToBin(pMem
);
1326 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
1328 _sfName
.copyToBin(pMem
);
1330 if(FieldBits::NoField
!= (DataTypeFieldMask
& whichField
))
1332 _sfDataType
.copyToBin(pMem
);
1334 if(FieldBits::NoField
!= (ComponentSizeFieldMask
& whichField
))
1336 _sfComponentSize
.copyToBin(pMem
);
1338 if(FieldBits::NoField
!= (SideCountFieldMask
& whichField
))
1340 _sfSideCount
.copyToBin(pMem
);
1342 if(FieldBits::NoField
!= (SideSizeFieldMask
& whichField
))
1344 _sfSideSize
.copyToBin(pMem
);
1346 if(FieldBits::NoField
!= (ForceCompressedDataFieldMask
& whichField
))
1348 _sfForceCompressedData
.copyToBin(pMem
);
1350 if(FieldBits::NoField
!= (ForceAlphaChannelFieldMask
& whichField
))
1352 _sfForceAlphaChannel
.copyToBin(pMem
);
1354 if(FieldBits::NoField
!= (ForceColorChannelFieldMask
& whichField
))
1356 _sfForceColorChannel
.copyToBin(pMem
);
1358 if(FieldBits::NoField
!= (ForceAlphaBinaryFieldMask
& whichField
))
1360 _sfForceAlphaBinary
.copyToBin(pMem
);
1362 if(FieldBits::NoField
!= (ResXFieldMask
& whichField
))
1364 _sfResX
.copyToBin(pMem
);
1366 if(FieldBits::NoField
!= (ResYFieldMask
& whichField
))
1368 _sfResY
.copyToBin(pMem
);
1370 if(FieldBits::NoField
!= (ResUnitFieldMask
& whichField
))
1372 _sfResUnit
.copyToBin(pMem
);
1374 if(FieldBits::NoField
!= (ClearOnLoadFieldMask
& whichField
))
1376 _sfClearOnLoad
.copyToBin(pMem
);
1380 void ImageBase::copyFromBin(BinaryDataHandler
&pMem
,
1381 ConstFieldMaskArg whichField
)
1383 Inherited::copyFromBin(pMem
, whichField
);
1385 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
1387 editMField(ParentsFieldMask
, _mfParents
);
1388 _mfParents
.copyFromBin(pMem
);
1390 if(FieldBits::NoField
!= (DimensionFieldMask
& whichField
))
1392 editSField(DimensionFieldMask
);
1393 _sfDimension
.copyFromBin(pMem
);
1395 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1397 editSField(WidthFieldMask
);
1398 _sfWidth
.copyFromBin(pMem
);
1400 if(FieldBits::NoField
!= (HeightFieldMask
& whichField
))
1402 editSField(HeightFieldMask
);
1403 _sfHeight
.copyFromBin(pMem
);
1405 if(FieldBits::NoField
!= (DepthFieldMask
& whichField
))
1407 editSField(DepthFieldMask
);
1408 _sfDepth
.copyFromBin(pMem
);
1410 if(FieldBits::NoField
!= (BppFieldMask
& whichField
))
1412 editSField(BppFieldMask
);
1413 _sfBpp
.copyFromBin(pMem
);
1415 if(FieldBits::NoField
!= (MipMapCountFieldMask
& whichField
))
1417 editSField(MipMapCountFieldMask
);
1418 _sfMipMapCount
.copyFromBin(pMem
);
1420 if(FieldBits::NoField
!= (FrameCountFieldMask
& whichField
))
1422 editSField(FrameCountFieldMask
);
1423 _sfFrameCount
.copyFromBin(pMem
);
1425 if(FieldBits::NoField
!= (FrameDelayFieldMask
& whichField
))
1427 editSField(FrameDelayFieldMask
);
1428 _sfFrameDelay
.copyFromBin(pMem
);
1430 if(FieldBits::NoField
!= (PixelFormatFieldMask
& whichField
))
1432 editSField(PixelFormatFieldMask
);
1433 _sfPixelFormat
.copyFromBin(pMem
);
1435 if(FieldBits::NoField
!= (PixelFieldMask
& whichField
))
1437 editMField(PixelFieldMask
, _mfPixel
);
1438 _mfPixel
.copyFromBin(pMem
);
1440 if(FieldBits::NoField
!= (FrameSizeFieldMask
& whichField
))
1442 editSField(FrameSizeFieldMask
);
1443 _sfFrameSize
.copyFromBin(pMem
);
1445 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
1447 editSField(NameFieldMask
);
1448 _sfName
.copyFromBin(pMem
);
1450 if(FieldBits::NoField
!= (DataTypeFieldMask
& whichField
))
1452 editSField(DataTypeFieldMask
);
1453 _sfDataType
.copyFromBin(pMem
);
1455 if(FieldBits::NoField
!= (ComponentSizeFieldMask
& whichField
))
1457 editSField(ComponentSizeFieldMask
);
1458 _sfComponentSize
.copyFromBin(pMem
);
1460 if(FieldBits::NoField
!= (SideCountFieldMask
& whichField
))
1462 editSField(SideCountFieldMask
);
1463 _sfSideCount
.copyFromBin(pMem
);
1465 if(FieldBits::NoField
!= (SideSizeFieldMask
& whichField
))
1467 editSField(SideSizeFieldMask
);
1468 _sfSideSize
.copyFromBin(pMem
);
1470 if(FieldBits::NoField
!= (ForceCompressedDataFieldMask
& whichField
))
1472 editSField(ForceCompressedDataFieldMask
);
1473 _sfForceCompressedData
.copyFromBin(pMem
);
1475 if(FieldBits::NoField
!= (ForceAlphaChannelFieldMask
& whichField
))
1477 editSField(ForceAlphaChannelFieldMask
);
1478 _sfForceAlphaChannel
.copyFromBin(pMem
);
1480 if(FieldBits::NoField
!= (ForceColorChannelFieldMask
& whichField
))
1482 editSField(ForceColorChannelFieldMask
);
1483 _sfForceColorChannel
.copyFromBin(pMem
);
1485 if(FieldBits::NoField
!= (ForceAlphaBinaryFieldMask
& whichField
))
1487 editSField(ForceAlphaBinaryFieldMask
);
1488 _sfForceAlphaBinary
.copyFromBin(pMem
);
1490 if(FieldBits::NoField
!= (ResXFieldMask
& whichField
))
1492 editSField(ResXFieldMask
);
1493 _sfResX
.copyFromBin(pMem
);
1495 if(FieldBits::NoField
!= (ResYFieldMask
& whichField
))
1497 editSField(ResYFieldMask
);
1498 _sfResY
.copyFromBin(pMem
);
1500 if(FieldBits::NoField
!= (ResUnitFieldMask
& whichField
))
1502 editSField(ResUnitFieldMask
);
1503 _sfResUnit
.copyFromBin(pMem
);
1505 if(FieldBits::NoField
!= (ClearOnLoadFieldMask
& whichField
))
1507 editSField(ClearOnLoadFieldMask
);
1508 _sfClearOnLoad
.copyFromBin(pMem
);
1512 //! create a new instance of the class
1513 ImageTransitPtr
ImageBase::createLocal(BitVector bFlags
)
1517 if(getClassType().getPrototype() != NULL
)
1519 FieldContainerTransitPtr tmpPtr
=
1520 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
1522 fc
= dynamic_pointer_cast
<Image
>(tmpPtr
);
1528 //! create a new instance of the class, copy the container flags
1529 ImageTransitPtr
ImageBase::createDependent(BitVector bFlags
)
1533 if(getClassType().getPrototype() != NULL
)
1535 FieldContainerTransitPtr tmpPtr
=
1536 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
1538 fc
= dynamic_pointer_cast
<Image
>(tmpPtr
);
1544 //! create a new instance of the class
1545 ImageTransitPtr
ImageBase::create(void)
1549 if(getClassType().getPrototype() != NULL
)
1551 FieldContainerTransitPtr tmpPtr
=
1552 getClassType().getPrototype()-> shallowCopy();
1554 fc
= dynamic_pointer_cast
<Image
>(tmpPtr
);
1560 Image
*ImageBase::createEmptyLocal(BitVector bFlags
)
1564 newPtr
<Image
>(returnValue
, bFlags
);
1566 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1571 //! create an empty new instance of the class, do not copy the prototype
1572 Image
*ImageBase::createEmpty(void)
1576 newPtr
<Image
>(returnValue
, Thread::getCurrentLocalFlags());
1578 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
1579 ~Thread::getCurrentLocalFlags();
1585 FieldContainerTransitPtr
ImageBase::shallowCopyLocal(
1586 BitVector bFlags
) const
1590 newPtr(tmpPtr
, dynamic_cast<const Image
*>(this), bFlags
);
1592 FieldContainerTransitPtr
returnValue(tmpPtr
);
1594 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1599 FieldContainerTransitPtr
ImageBase::shallowCopyDependent(
1600 BitVector bFlags
) const
1604 newPtr(tmpPtr
, dynamic_cast<const Image
*>(this), ~bFlags
);
1606 FieldContainerTransitPtr
returnValue(tmpPtr
);
1608 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1613 FieldContainerTransitPtr
ImageBase::shallowCopy(void) const
1618 dynamic_cast<const Image
*>(this),
1619 Thread::getCurrentLocalFlags());
1621 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
1623 FieldContainerTransitPtr
returnValue(tmpPtr
);
1631 /*------------------------- constructors ----------------------------------*/
1633 ImageBase::ImageBase(void) :
1636 _sfDimension (Int32(0)),
1637 _sfWidth (Int32(0)),
1638 _sfHeight (Int32(1)),
1639 _sfDepth (Int32(1)),
1641 _sfMipMapCount (Int32(1)),
1642 _sfFrameCount (Int32(1)),
1643 _sfFrameDelay (Time(0)),
1644 _sfPixelFormat (UInt32(Image::OSG_INVALID_PF
)),
1646 _sfFrameSize (Int32(0)),
1648 _sfDataType (Int32(GL_UNSIGNED_BYTE
)),
1649 _sfComponentSize (Int32(1)),
1650 _sfSideCount (Int32(1)),
1651 _sfSideSize (Int32(0)),
1652 _sfForceCompressedData (bool(false)),
1653 _sfForceAlphaChannel (bool(false)),
1654 _sfForceColorChannel (bool(false)),
1655 _sfForceAlphaBinary (bool(false)),
1656 _sfResX (Real32(72.0f
)),
1657 _sfResY (Real32(72.0f
)),
1658 _sfResUnit (UInt16(2)),
1659 _sfClearOnLoad (bool(false))
1663 ImageBase::ImageBase(const ImageBase
&source
) :
1666 _sfDimension (source
._sfDimension
),
1667 _sfWidth (source
._sfWidth
),
1668 _sfHeight (source
._sfHeight
),
1669 _sfDepth (source
._sfDepth
),
1670 _sfBpp (source
._sfBpp
),
1671 _sfMipMapCount (source
._sfMipMapCount
),
1672 _sfFrameCount (source
._sfFrameCount
),
1673 _sfFrameDelay (source
._sfFrameDelay
),
1674 _sfPixelFormat (source
._sfPixelFormat
),
1675 _mfPixel (source
._mfPixel
),
1676 _sfFrameSize (source
._sfFrameSize
),
1677 _sfName (source
._sfName
),
1678 _sfDataType (source
._sfDataType
),
1679 _sfComponentSize (source
._sfComponentSize
),
1680 _sfSideCount (source
._sfSideCount
),
1681 _sfSideSize (source
._sfSideSize
),
1682 _sfForceCompressedData (source
._sfForceCompressedData
),
1683 _sfForceAlphaChannel (source
._sfForceAlphaChannel
),
1684 _sfForceColorChannel (source
._sfForceColorChannel
),
1685 _sfForceAlphaBinary (source
._sfForceAlphaBinary
),
1686 _sfResX (source
._sfResX
),
1687 _sfResY (source
._sfResY
),
1688 _sfResUnit (source
._sfResUnit
),
1689 _sfClearOnLoad (source
._sfClearOnLoad
)
1694 /*-------------------------- destructors ----------------------------------*/
1696 ImageBase::~ImageBase(void)
1699 /*-------------------------------------------------------------------------*/
1700 /* Parent linking */
1702 bool ImageBase::linkParent(
1703 FieldContainer
* const pParent
,
1704 UInt16
const childFieldId
,
1705 UInt16
const parentFieldId
)
1707 if(parentFieldId
== ParentsFieldId
)
1709 FieldContainer
* pTypedParent
=
1710 dynamic_cast< FieldContainer
* >(pParent
);
1712 if(pTypedParent
!= NULL
)
1714 editMField(ParentsFieldMask
, _mfParents
);
1716 _mfParents
.push_back(pTypedParent
, childFieldId
);
1724 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
1727 bool ImageBase::unlinkParent(
1728 FieldContainer
* const pParent
,
1729 UInt16
const parentFieldId
)
1731 if(parentFieldId
== ParentsFieldId
)
1733 FieldContainer
* pTypedParent
=
1734 dynamic_cast< FieldContainer
* >(pParent
);
1736 if(pTypedParent
!= NULL
)
1738 Int32 iParentIdx
= _mfParents
.findIndex(pTypedParent
);
1740 if(iParentIdx
!= -1)
1742 editMField(ParentsFieldMask
, _mfParents
);
1744 _mfParents
.erase(iParentIdx
);
1749 SWARNING
<< "Child ([" << this
1750 << "] id [" << this->getId()
1751 << "] type [" << this->getType().getCName()
1752 << "] parentFieldId [" << parentFieldId
1753 << "]) - Parent ([" << pParent
1754 << "] id [" << pParent
->getId()
1755 << "] type [" << pParent
->getType().getCName()
1756 << "]): link inconsistent!"
1765 return Inherited::unlinkParent(pParent
, parentFieldId
);
1770 GetFieldHandlePtr
ImageBase::getHandleParents (void) const
1772 MFParentFieldContainerPtr::GetHandlePtr returnValue
;
1777 EditFieldHandlePtr
ImageBase::editHandleParents (void)
1779 EditFieldHandlePtr returnValue
;
1784 GetFieldHandlePtr
ImageBase::getHandleDimension (void) const
1786 SFInt32::GetHandlePtr
returnValue(
1787 new SFInt32::GetHandle(
1789 this->getType().getFieldDesc(DimensionFieldId
),
1790 const_cast<ImageBase
*>(this)));
1795 EditFieldHandlePtr
ImageBase::editHandleDimension (void)
1797 SFInt32::EditHandlePtr
returnValue(
1798 new SFInt32::EditHandle(
1800 this->getType().getFieldDesc(DimensionFieldId
),
1804 editSField(DimensionFieldMask
);
1809 GetFieldHandlePtr
ImageBase::getHandleWidth (void) const
1811 SFInt32::GetHandlePtr
returnValue(
1812 new SFInt32::GetHandle(
1814 this->getType().getFieldDesc(WidthFieldId
),
1815 const_cast<ImageBase
*>(this)));
1820 EditFieldHandlePtr
ImageBase::editHandleWidth (void)
1822 SFInt32::EditHandlePtr
returnValue(
1823 new SFInt32::EditHandle(
1825 this->getType().getFieldDesc(WidthFieldId
),
1829 editSField(WidthFieldMask
);
1834 GetFieldHandlePtr
ImageBase::getHandleHeight (void) const
1836 SFInt32::GetHandlePtr
returnValue(
1837 new SFInt32::GetHandle(
1839 this->getType().getFieldDesc(HeightFieldId
),
1840 const_cast<ImageBase
*>(this)));
1845 EditFieldHandlePtr
ImageBase::editHandleHeight (void)
1847 SFInt32::EditHandlePtr
returnValue(
1848 new SFInt32::EditHandle(
1850 this->getType().getFieldDesc(HeightFieldId
),
1854 editSField(HeightFieldMask
);
1859 GetFieldHandlePtr
ImageBase::getHandleDepth (void) const
1861 SFInt32::GetHandlePtr
returnValue(
1862 new SFInt32::GetHandle(
1864 this->getType().getFieldDesc(DepthFieldId
),
1865 const_cast<ImageBase
*>(this)));
1870 EditFieldHandlePtr
ImageBase::editHandleDepth (void)
1872 SFInt32::EditHandlePtr
returnValue(
1873 new SFInt32::EditHandle(
1875 this->getType().getFieldDesc(DepthFieldId
),
1879 editSField(DepthFieldMask
);
1884 GetFieldHandlePtr
ImageBase::getHandleBpp (void) const
1886 SFInt32::GetHandlePtr
returnValue(
1887 new SFInt32::GetHandle(
1889 this->getType().getFieldDesc(BppFieldId
),
1890 const_cast<ImageBase
*>(this)));
1895 EditFieldHandlePtr
ImageBase::editHandleBpp (void)
1897 SFInt32::EditHandlePtr
returnValue(
1898 new SFInt32::EditHandle(
1900 this->getType().getFieldDesc(BppFieldId
),
1904 editSField(BppFieldMask
);
1909 GetFieldHandlePtr
ImageBase::getHandleMipMapCount (void) const
1911 SFInt32::GetHandlePtr
returnValue(
1912 new SFInt32::GetHandle(
1914 this->getType().getFieldDesc(MipMapCountFieldId
),
1915 const_cast<ImageBase
*>(this)));
1920 EditFieldHandlePtr
ImageBase::editHandleMipMapCount (void)
1922 SFInt32::EditHandlePtr
returnValue(
1923 new SFInt32::EditHandle(
1925 this->getType().getFieldDesc(MipMapCountFieldId
),
1929 editSField(MipMapCountFieldMask
);
1934 GetFieldHandlePtr
ImageBase::getHandleFrameCount (void) const
1936 SFInt32::GetHandlePtr
returnValue(
1937 new SFInt32::GetHandle(
1939 this->getType().getFieldDesc(FrameCountFieldId
),
1940 const_cast<ImageBase
*>(this)));
1945 EditFieldHandlePtr
ImageBase::editHandleFrameCount (void)
1947 SFInt32::EditHandlePtr
returnValue(
1948 new SFInt32::EditHandle(
1950 this->getType().getFieldDesc(FrameCountFieldId
),
1954 editSField(FrameCountFieldMask
);
1959 GetFieldHandlePtr
ImageBase::getHandleFrameDelay (void) const
1961 SFTime::GetHandlePtr
returnValue(
1962 new SFTime::GetHandle(
1964 this->getType().getFieldDesc(FrameDelayFieldId
),
1965 const_cast<ImageBase
*>(this)));
1970 EditFieldHandlePtr
ImageBase::editHandleFrameDelay (void)
1972 SFTime::EditHandlePtr
returnValue(
1973 new SFTime::EditHandle(
1975 this->getType().getFieldDesc(FrameDelayFieldId
),
1979 editSField(FrameDelayFieldMask
);
1984 GetFieldHandlePtr
ImageBase::getHandlePixelFormat (void) const
1986 SFUInt32::GetHandlePtr
returnValue(
1987 new SFUInt32::GetHandle(
1989 this->getType().getFieldDesc(PixelFormatFieldId
),
1990 const_cast<ImageBase
*>(this)));
1995 EditFieldHandlePtr
ImageBase::editHandlePixelFormat (void)
1997 SFUInt32::EditHandlePtr
returnValue(
1998 new SFUInt32::EditHandle(
2000 this->getType().getFieldDesc(PixelFormatFieldId
),
2004 editSField(PixelFormatFieldMask
);
2009 GetFieldHandlePtr
ImageBase::getHandlePixel (void) const
2011 MFUInt8::GetHandlePtr
returnValue(
2012 new MFUInt8::GetHandle(
2014 this->getType().getFieldDesc(PixelFieldId
),
2015 const_cast<ImageBase
*>(this)));
2020 EditFieldHandlePtr
ImageBase::editHandlePixel (void)
2022 MFUInt8::EditHandlePtr
returnValue(
2023 new MFUInt8::EditHandle(
2025 this->getType().getFieldDesc(PixelFieldId
),
2029 editMField(PixelFieldMask
, _mfPixel
);
2034 GetFieldHandlePtr
ImageBase::getHandleFrameSize (void) const
2036 SFInt32::GetHandlePtr
returnValue(
2037 new SFInt32::GetHandle(
2039 this->getType().getFieldDesc(FrameSizeFieldId
),
2040 const_cast<ImageBase
*>(this)));
2045 EditFieldHandlePtr
ImageBase::editHandleFrameSize (void)
2047 SFInt32::EditHandlePtr
returnValue(
2048 new SFInt32::EditHandle(
2050 this->getType().getFieldDesc(FrameSizeFieldId
),
2054 editSField(FrameSizeFieldMask
);
2059 GetFieldHandlePtr
ImageBase::getHandleName (void) const
2061 SFString::GetHandlePtr
returnValue(
2062 new SFString::GetHandle(
2064 this->getType().getFieldDesc(NameFieldId
),
2065 const_cast<ImageBase
*>(this)));
2070 EditFieldHandlePtr
ImageBase::editHandleName (void)
2072 SFString::EditHandlePtr
returnValue(
2073 new SFString::EditHandle(
2075 this->getType().getFieldDesc(NameFieldId
),
2079 editSField(NameFieldMask
);
2084 GetFieldHandlePtr
ImageBase::getHandleDataType (void) const
2086 SFInt32::GetHandlePtr
returnValue(
2087 new SFInt32::GetHandle(
2089 this->getType().getFieldDesc(DataTypeFieldId
),
2090 const_cast<ImageBase
*>(this)));
2095 EditFieldHandlePtr
ImageBase::editHandleDataType (void)
2097 SFInt32::EditHandlePtr
returnValue(
2098 new SFInt32::EditHandle(
2100 this->getType().getFieldDesc(DataTypeFieldId
),
2104 editSField(DataTypeFieldMask
);
2109 GetFieldHandlePtr
ImageBase::getHandleComponentSize (void) const
2111 SFInt32::GetHandlePtr
returnValue(
2112 new SFInt32::GetHandle(
2114 this->getType().getFieldDesc(ComponentSizeFieldId
),
2115 const_cast<ImageBase
*>(this)));
2120 EditFieldHandlePtr
ImageBase::editHandleComponentSize (void)
2122 SFInt32::EditHandlePtr
returnValue(
2123 new SFInt32::EditHandle(
2125 this->getType().getFieldDesc(ComponentSizeFieldId
),
2129 editSField(ComponentSizeFieldMask
);
2134 GetFieldHandlePtr
ImageBase::getHandleSideCount (void) const
2136 SFInt32::GetHandlePtr
returnValue(
2137 new SFInt32::GetHandle(
2139 this->getType().getFieldDesc(SideCountFieldId
),
2140 const_cast<ImageBase
*>(this)));
2145 EditFieldHandlePtr
ImageBase::editHandleSideCount (void)
2147 SFInt32::EditHandlePtr
returnValue(
2148 new SFInt32::EditHandle(
2150 this->getType().getFieldDesc(SideCountFieldId
),
2154 editSField(SideCountFieldMask
);
2159 GetFieldHandlePtr
ImageBase::getHandleSideSize (void) const
2161 SFInt32::GetHandlePtr
returnValue(
2162 new SFInt32::GetHandle(
2164 this->getType().getFieldDesc(SideSizeFieldId
),
2165 const_cast<ImageBase
*>(this)));
2170 EditFieldHandlePtr
ImageBase::editHandleSideSize (void)
2172 SFInt32::EditHandlePtr
returnValue(
2173 new SFInt32::EditHandle(
2175 this->getType().getFieldDesc(SideSizeFieldId
),
2179 editSField(SideSizeFieldMask
);
2184 GetFieldHandlePtr
ImageBase::getHandleForceCompressedData (void) const
2186 SFBool::GetHandlePtr
returnValue(
2187 new SFBool::GetHandle(
2188 &_sfForceCompressedData
,
2189 this->getType().getFieldDesc(ForceCompressedDataFieldId
),
2190 const_cast<ImageBase
*>(this)));
2195 EditFieldHandlePtr
ImageBase::editHandleForceCompressedData(void)
2197 SFBool::EditHandlePtr
returnValue(
2198 new SFBool::EditHandle(
2199 &_sfForceCompressedData
,
2200 this->getType().getFieldDesc(ForceCompressedDataFieldId
),
2204 editSField(ForceCompressedDataFieldMask
);
2209 GetFieldHandlePtr
ImageBase::getHandleForceAlphaChannel (void) const
2211 SFBool::GetHandlePtr
returnValue(
2212 new SFBool::GetHandle(
2213 &_sfForceAlphaChannel
,
2214 this->getType().getFieldDesc(ForceAlphaChannelFieldId
),
2215 const_cast<ImageBase
*>(this)));
2220 EditFieldHandlePtr
ImageBase::editHandleForceAlphaChannel(void)
2222 SFBool::EditHandlePtr
returnValue(
2223 new SFBool::EditHandle(
2224 &_sfForceAlphaChannel
,
2225 this->getType().getFieldDesc(ForceAlphaChannelFieldId
),
2229 editSField(ForceAlphaChannelFieldMask
);
2234 GetFieldHandlePtr
ImageBase::getHandleForceColorChannel (void) const
2236 SFBool::GetHandlePtr
returnValue(
2237 new SFBool::GetHandle(
2238 &_sfForceColorChannel
,
2239 this->getType().getFieldDesc(ForceColorChannelFieldId
),
2240 const_cast<ImageBase
*>(this)));
2245 EditFieldHandlePtr
ImageBase::editHandleForceColorChannel(void)
2247 SFBool::EditHandlePtr
returnValue(
2248 new SFBool::EditHandle(
2249 &_sfForceColorChannel
,
2250 this->getType().getFieldDesc(ForceColorChannelFieldId
),
2254 editSField(ForceColorChannelFieldMask
);
2259 GetFieldHandlePtr
ImageBase::getHandleForceAlphaBinary (void) const
2261 SFBool::GetHandlePtr
returnValue(
2262 new SFBool::GetHandle(
2263 &_sfForceAlphaBinary
,
2264 this->getType().getFieldDesc(ForceAlphaBinaryFieldId
),
2265 const_cast<ImageBase
*>(this)));
2270 EditFieldHandlePtr
ImageBase::editHandleForceAlphaBinary(void)
2272 SFBool::EditHandlePtr
returnValue(
2273 new SFBool::EditHandle(
2274 &_sfForceAlphaBinary
,
2275 this->getType().getFieldDesc(ForceAlphaBinaryFieldId
),
2279 editSField(ForceAlphaBinaryFieldMask
);
2284 GetFieldHandlePtr
ImageBase::getHandleResX (void) const
2286 SFReal32::GetHandlePtr
returnValue(
2287 new SFReal32::GetHandle(
2289 this->getType().getFieldDesc(ResXFieldId
),
2290 const_cast<ImageBase
*>(this)));
2295 EditFieldHandlePtr
ImageBase::editHandleResX (void)
2297 SFReal32::EditHandlePtr
returnValue(
2298 new SFReal32::EditHandle(
2300 this->getType().getFieldDesc(ResXFieldId
),
2304 editSField(ResXFieldMask
);
2309 GetFieldHandlePtr
ImageBase::getHandleResY (void) const
2311 SFReal32::GetHandlePtr
returnValue(
2312 new SFReal32::GetHandle(
2314 this->getType().getFieldDesc(ResYFieldId
),
2315 const_cast<ImageBase
*>(this)));
2320 EditFieldHandlePtr
ImageBase::editHandleResY (void)
2322 SFReal32::EditHandlePtr
returnValue(
2323 new SFReal32::EditHandle(
2325 this->getType().getFieldDesc(ResYFieldId
),
2329 editSField(ResYFieldMask
);
2334 GetFieldHandlePtr
ImageBase::getHandleResUnit (void) const
2336 SFUInt16::GetHandlePtr
returnValue(
2337 new SFUInt16::GetHandle(
2339 this->getType().getFieldDesc(ResUnitFieldId
),
2340 const_cast<ImageBase
*>(this)));
2345 EditFieldHandlePtr
ImageBase::editHandleResUnit (void)
2347 SFUInt16::EditHandlePtr
returnValue(
2348 new SFUInt16::EditHandle(
2350 this->getType().getFieldDesc(ResUnitFieldId
),
2354 editSField(ResUnitFieldMask
);
2359 GetFieldHandlePtr
ImageBase::getHandleClearOnLoad (void) const
2361 SFBool::GetHandlePtr
returnValue(
2362 new SFBool::GetHandle(
2364 this->getType().getFieldDesc(ClearOnLoadFieldId
),
2365 const_cast<ImageBase
*>(this)));
2370 EditFieldHandlePtr
ImageBase::editHandleClearOnLoad (void)
2372 SFBool::EditHandlePtr
returnValue(
2373 new SFBool::EditHandle(
2375 this->getType().getFieldDesc(ClearOnLoadFieldId
),
2379 editSField(ClearOnLoadFieldMask
);
2385 #ifdef OSG_MT_CPTR_ASPECT
2386 void ImageBase::execSyncV( FieldContainer
&oFrom
,
2387 ConstFieldMaskArg whichField
,
2388 AspectOffsetStore
&oOffsets
,
2389 ConstFieldMaskArg syncMode
,
2390 const UInt32 uiSyncInfo
)
2392 Image
*pThis
= static_cast<Image
*>(this);
2394 pThis
->execSync(static_cast<Image
*>(&oFrom
),
2403 #ifdef OSG_MT_CPTR_ASPECT
2404 FieldContainer
*ImageBase::createAspectCopy(
2405 const FieldContainer
*pRefAspect
) const
2409 newAspectCopy(returnValue
,
2410 dynamic_cast<const Image
*>(pRefAspect
),
2411 dynamic_cast<const Image
*>(this));
2417 void ImageBase::resolveLinks(void)
2419 Inherited::resolveLinks();
2421 #ifdef OSG_MT_CPTR_ASPECT
2422 AspectOffsetStore oOffsets
;
2424 _pAspectStore
->fillOffsetArray(oOffsets
, this);
2427 #ifdef OSG_MT_CPTR_ASPECT
2428 _mfPixel
.terminateShare(Thread::getCurrentAspect(),