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
>(
555 reinterpret_cast<void *>(&Image::classDescInserter
)),
557 (ComponentSizeFieldMask
| SideSizeFieldMask
| FrameSizeFieldMask
),
558 "<?xml version=\"1.0\"?>\n"
562 " parent=\"AttachmentContainer\"\n"
563 " library=\"System\"\n"
564 " pointerfieldtypes=\"both\"\n"
565 " structure=\"concrete\"\n"
566 " systemcomponent=\"true\"\n"
567 " parentsystemcomponent=\"true\"\n"
568 " decoratable=\"false\"\n"
569 " useLocalIncludes=\"false\"\n"
570 " fieldsUnmarkedOnCreate=\"(ComponentSizeFieldMask | SideSizeFieldMask | FrameSizeFieldMask)\"\n"
571 " childFields=\"single\"\n"
572 " docGroupBase=\"GrpSystemImage\"\n"
575 " 1D/2D/3D Image with various pixel types data, optionally also can hold\n"
576 " mipMap and simple multi-frame data.\n"
579 "\t name=\"parents\"\n"
580 "\t type=\"FieldContainer\"\n"
581 "\t cardinality=\"multi\"\n"
582 "\t visibility=\"internal\"\n"
583 "\t access=\"none\"\n"
584 " category=\"parentpointer\"\n"
588 "\t name=\"dimension\"\n"
589 "\t type=\"Int32\"\n"
590 "\t cardinality=\"single\"\n"
591 "\t visibility=\"external\"\n"
592 "\t defaultValue=\"0\"\n"
593 "\t access=\"public\"\n"
595 "\tImage dimension, 0 for invalid, 1 for 1D, 2 for 2D and 3 for 3D data.\n"
598 "\t name=\"width\"\n"
599 "\t type=\"Int32\"\n"
600 "\t cardinality=\"single\"\n"
601 "\t visibility=\"external\"\n"
602 "\t defaultValue=\"0\"\n"
603 "\t access=\"public\"\n"
607 "\t name=\"height\"\n"
608 "\t type=\"Int32\"\n"
609 "\t cardinality=\"single\"\n"
610 "\t visibility=\"external\"\n"
611 "\t defaultValue=\"1\"\n"
612 "\t access=\"public\"\n"
616 "\t name=\"depth\"\n"
617 "\t type=\"Int32\"\n"
618 "\t cardinality=\"single\"\n"
619 "\t visibility=\"external\"\n"
620 "\t defaultValue=\"1\"\n"
621 "\t access=\"public\"\n"
626 "\t type=\"Int32\"\n"
627 "\t cardinality=\"single\"\n"
628 "\t visibility=\"external\"\n"
629 "\t defaultValue=\"1\"\n"
630 "\t access=\"public\"\n"
632 " Bytes of data per pixel.\n"
635 "\t name=\"mipMapCount\"\n"
636 "\t type=\"Int32\"\n"
637 "\t cardinality=\"single\"\n"
638 "\t visibility=\"external\"\n"
639 "\t defaultValue=\"1\"\n"
640 "\t access=\"public\"\n"
644 "\t name=\"frameCount\"\n"
645 "\t type=\"Int32\"\n"
646 "\t cardinality=\"single\"\n"
647 "\t visibility=\"external\"\n"
648 "\t defaultValue=\"1\"\n"
649 "\t access=\"public\"\n"
651 " The number of frames in the data.\n"
654 "\t name=\"frameDelay\"\n"
656 "\t cardinality=\"single\"\n"
657 "\t visibility=\"external\"\n"
658 "\t defaultValue=\"0\"\n"
659 "\t access=\"public\"\n"
661 " Time between frames. Determines the frame rate.\n"
664 "\t name=\"pixelFormat\"\n"
665 "\t type=\"UInt32\"\n"
666 "\t cardinality=\"single\"\n"
667 "\t visibility=\"external\"\n"
668 "\t defaultValue=\"Image::OSG_INVALID_PF\"\n"
669 "\t access=\"public\"\n"
673 "\t name=\"pixel\"\n"
674 "\t type=\"UInt8\"\n"
675 "\t cardinality=\"multi\"\n"
676 "\t visibility=\"external\"\n"
677 "\t access=\"public\"\n"
679 " The pixel data buffer. This is where the data for the image is stored.\n"
682 "\t name=\"frameSize\"\n"
683 "\t type=\"Int32\"\n"
684 "\t cardinality=\"single\"\n"
685 "\t visibility=\"internal\"\n"
686 "\t defaultValue=\"0\"\n"
687 "\t access=\"public\"\n"
692 "\t type=\"std::string\"\n"
693 "\t cardinality=\"single\"\n"
694 "\t visibility=\"external\"\n"
695 "\t access=\"public\"\n"
697 "\tTexture file path.\n"
700 "\t name=\"dataType\"\n"
701 "\t type=\"Int32\"\n"
702 "\t cardinality=\"single\"\n"
703 "\t visibility=\"external\"\n"
704 "\t defaultValue=\"GL_UNSIGNED_BYTE\"\n"
705 "\t defaultHeader=\""OSGGL.h"\"\n"
706 "\t access=\"public\"\n"
708 "\tType of image data.\n"
711 "\t name=\"componentSize\"\n"
712 "\t type=\"Int32\"\n"
713 "\t cardinality=\"single\"\n"
714 "\t visibility=\"internal\"\n"
715 "\t defaultValue=\"1\"\n"
716 "\t access=\"protected\"\n"
718 "\tSize (in byte) of a single component of the image. Necessary\n"
719 " for High Dynamic Range and other higher-level image types.\n"
722 "\t name=\"sideCount\"\n"
723 "\t type=\"Int32\"\n"
724 "\t cardinality=\"single\"\n"
725 "\t visibility=\"external\"\n"
726 "\t defaultValue=\"1\"\n"
727 "\t access=\"public\"\n"
731 "\t name=\"sideSize\"\n"
732 "\t type=\"Int32\"\n"
733 "\t cardinality=\"single\"\n"
734 "\t visibility=\"internal\"\n"
735 "\t defaultValue=\"0\"\n"
736 "\t access=\"public\"\n"
740 "\t name=\"forceCompressedData\"\n"
742 "\t cardinality=\"single\"\n"
743 "\t visibility=\"external\"\n"
744 "\t defaultValue=\"false\"\n"
745 "\t access=\"public\"\n"
747 " Set to true if using the image to keep unknown data for textures.\n"
748 " Generally used in conjunction with TextureChunk::externalFormat.\n"
751 "\t name=\"forceAlphaChannel\"\n"
753 "\t cardinality=\"single\"\n"
754 "\t visibility=\"external\"\n"
755 "\t defaultValue=\"false\"\n"
756 "\t access=\"public\"\n"
758 " Set to true if using the image to keep unknown data for textures.\n"
759 " Generally used in conjunction with TextureChunk::externalFormat.\n"
762 "\t name=\"forceColorChannel\"\n"
764 "\t cardinality=\"single\"\n"
765 "\t visibility=\"external\"\n"
766 "\t defaultValue=\"false\"\n"
767 "\t access=\"public\"\n"
769 " Set to true if using the image to keep unknown data for textures.\n"
770 " Generally used in conjunction with TextureChunk::externalFormat.\n"
773 "\t name=\"forceAlphaBinary\"\n"
775 "\t cardinality=\"single\"\n"
776 "\t visibility=\"external\"\n"
777 "\t defaultValue=\"false\"\n"
778 "\t access=\"public\"\n"
780 " Set to true if using the image to prevent depth sorting for \n"
781 " SimpleTexturedMaterials using this Image.\n"
785 "\t type=\"Real32\"\n"
786 "\t cardinality=\"single\"\n"
787 "\t visibility=\"external\"\n"
788 "\t defaultValue=\"72.0f\"\n"
789 "\t access=\"public\"\n"
794 "\t type=\"Real32\"\n"
795 "\t cardinality=\"single\"\n"
796 "\t visibility=\"external\"\n"
797 "\t defaultValue=\"72.0f\"\n"
798 "\t access=\"public\"\n"
802 "\t name=\"resUnit\"\n"
803 "\t type=\"UInt16\"\n"
804 "\t cardinality=\"single\"\n"
805 "\t visibility=\"external\"\n"
806 "\t defaultValue=\"2\"\n"
807 "\t access=\"public\"\n"
809 "\tresolution unit (invalid=0, none=1, inch=2)\n"
812 "\t name=\"clearOnLoad\"\n"
814 "\t cardinality=\"single\"\n"
815 "\t visibility=\"external\"\n"
816 "\t defaultValue=\"false\"\n"
817 "\t access=\"public\"\n"
819 " Set to true if the image data should be cleared after it has been uploaded to the graphics\n"
820 " card and is no longer needed in main memory.\n"
822 "</FieldContainer>\n",
823 "1D/2D/3D Image with various pixel types data, optionally also can hold\n"
824 "mipMap and simple multi-frame data.\n"
827 /*------------------------------ get -----------------------------------*/
829 FieldContainerType
&ImageBase::getType(void)
834 const FieldContainerType
&ImageBase::getType(void) const
839 UInt32
ImageBase::getContainerSize(void) const
841 return sizeof(Image
);
844 /*------------------------- decorator get ------------------------------*/
848 SFInt32
*ImageBase::editSFDimension(void)
850 editSField(DimensionFieldMask
);
852 return &_sfDimension
;
855 const SFInt32
*ImageBase::getSFDimension(void) const
857 return &_sfDimension
;
861 SFInt32
*ImageBase::editSFWidth(void)
863 editSField(WidthFieldMask
);
868 const SFInt32
*ImageBase::getSFWidth(void) const
874 SFInt32
*ImageBase::editSFHeight(void)
876 editSField(HeightFieldMask
);
881 const SFInt32
*ImageBase::getSFHeight(void) const
887 SFInt32
*ImageBase::editSFDepth(void)
889 editSField(DepthFieldMask
);
894 const SFInt32
*ImageBase::getSFDepth(void) const
900 SFInt32
*ImageBase::editSFBpp(void)
902 editSField(BppFieldMask
);
907 const SFInt32
*ImageBase::getSFBpp(void) const
913 SFInt32
*ImageBase::editSFMipMapCount(void)
915 editSField(MipMapCountFieldMask
);
917 return &_sfMipMapCount
;
920 const SFInt32
*ImageBase::getSFMipMapCount(void) const
922 return &_sfMipMapCount
;
926 SFInt32
*ImageBase::editSFFrameCount(void)
928 editSField(FrameCountFieldMask
);
930 return &_sfFrameCount
;
933 const SFInt32
*ImageBase::getSFFrameCount(void) const
935 return &_sfFrameCount
;
939 SFTime
*ImageBase::editSFFrameDelay(void)
941 editSField(FrameDelayFieldMask
);
943 return &_sfFrameDelay
;
946 const SFTime
*ImageBase::getSFFrameDelay(void) const
948 return &_sfFrameDelay
;
952 SFUInt32
*ImageBase::editSFPixelFormat(void)
954 editSField(PixelFormatFieldMask
);
956 return &_sfPixelFormat
;
959 const SFUInt32
*ImageBase::getSFPixelFormat(void) const
961 return &_sfPixelFormat
;
965 MFUInt8
*ImageBase::editMFPixel(void)
967 editMField(PixelFieldMask
, _mfPixel
);
972 const MFUInt8
*ImageBase::getMFPixel(void) const
978 SFInt32
*ImageBase::editSFFrameSize(void)
980 editSField(FrameSizeFieldMask
);
982 return &_sfFrameSize
;
985 const SFInt32
*ImageBase::getSFFrameSize(void) const
987 return &_sfFrameSize
;
991 SFString
*ImageBase::editSFName(void)
993 editSField(NameFieldMask
);
998 const SFString
*ImageBase::getSFName(void) const
1004 SFInt32
*ImageBase::editSFDataType(void)
1006 editSField(DataTypeFieldMask
);
1008 return &_sfDataType
;
1011 const SFInt32
*ImageBase::getSFDataType(void) const
1013 return &_sfDataType
;
1017 SFInt32
*ImageBase::editSFComponentSize(void)
1019 editSField(ComponentSizeFieldMask
);
1021 return &_sfComponentSize
;
1024 const SFInt32
*ImageBase::getSFComponentSize(void) const
1026 return &_sfComponentSize
;
1030 SFInt32
*ImageBase::editSFSideCount(void)
1032 editSField(SideCountFieldMask
);
1034 return &_sfSideCount
;
1037 const SFInt32
*ImageBase::getSFSideCount(void) const
1039 return &_sfSideCount
;
1043 SFInt32
*ImageBase::editSFSideSize(void)
1045 editSField(SideSizeFieldMask
);
1047 return &_sfSideSize
;
1050 const SFInt32
*ImageBase::getSFSideSize(void) const
1052 return &_sfSideSize
;
1056 SFBool
*ImageBase::editSFForceCompressedData(void)
1058 editSField(ForceCompressedDataFieldMask
);
1060 return &_sfForceCompressedData
;
1063 const SFBool
*ImageBase::getSFForceCompressedData(void) const
1065 return &_sfForceCompressedData
;
1069 SFBool
*ImageBase::editSFForceAlphaChannel(void)
1071 editSField(ForceAlphaChannelFieldMask
);
1073 return &_sfForceAlphaChannel
;
1076 const SFBool
*ImageBase::getSFForceAlphaChannel(void) const
1078 return &_sfForceAlphaChannel
;
1082 SFBool
*ImageBase::editSFForceColorChannel(void)
1084 editSField(ForceColorChannelFieldMask
);
1086 return &_sfForceColorChannel
;
1089 const SFBool
*ImageBase::getSFForceColorChannel(void) const
1091 return &_sfForceColorChannel
;
1095 SFBool
*ImageBase::editSFForceAlphaBinary(void)
1097 editSField(ForceAlphaBinaryFieldMask
);
1099 return &_sfForceAlphaBinary
;
1102 const SFBool
*ImageBase::getSFForceAlphaBinary(void) const
1104 return &_sfForceAlphaBinary
;
1108 SFReal32
*ImageBase::editSFResX(void)
1110 editSField(ResXFieldMask
);
1115 const SFReal32
*ImageBase::getSFResX(void) const
1121 SFReal32
*ImageBase::editSFResY(void)
1123 editSField(ResYFieldMask
);
1128 const SFReal32
*ImageBase::getSFResY(void) const
1134 SFUInt16
*ImageBase::editSFResUnit(void)
1136 editSField(ResUnitFieldMask
);
1141 const SFUInt16
*ImageBase::getSFResUnit(void) const
1147 SFBool
*ImageBase::editSFClearOnLoad(void)
1149 editSField(ClearOnLoadFieldMask
);
1151 return &_sfClearOnLoad
;
1154 const SFBool
*ImageBase::getSFClearOnLoad(void) const
1156 return &_sfClearOnLoad
;
1164 /*------------------------------ access -----------------------------------*/
1166 SizeT
ImageBase::getBinSize(ConstFieldMaskArg whichField
)
1168 SizeT returnValue
= Inherited::getBinSize(whichField
);
1170 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
1172 returnValue
+= _mfParents
.getBinSize();
1174 if(FieldBits::NoField
!= (DimensionFieldMask
& whichField
))
1176 returnValue
+= _sfDimension
.getBinSize();
1178 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1180 returnValue
+= _sfWidth
.getBinSize();
1182 if(FieldBits::NoField
!= (HeightFieldMask
& whichField
))
1184 returnValue
+= _sfHeight
.getBinSize();
1186 if(FieldBits::NoField
!= (DepthFieldMask
& whichField
))
1188 returnValue
+= _sfDepth
.getBinSize();
1190 if(FieldBits::NoField
!= (BppFieldMask
& whichField
))
1192 returnValue
+= _sfBpp
.getBinSize();
1194 if(FieldBits::NoField
!= (MipMapCountFieldMask
& whichField
))
1196 returnValue
+= _sfMipMapCount
.getBinSize();
1198 if(FieldBits::NoField
!= (FrameCountFieldMask
& whichField
))
1200 returnValue
+= _sfFrameCount
.getBinSize();
1202 if(FieldBits::NoField
!= (FrameDelayFieldMask
& whichField
))
1204 returnValue
+= _sfFrameDelay
.getBinSize();
1206 if(FieldBits::NoField
!= (PixelFormatFieldMask
& whichField
))
1208 returnValue
+= _sfPixelFormat
.getBinSize();
1210 if(FieldBits::NoField
!= (PixelFieldMask
& whichField
))
1212 returnValue
+= _mfPixel
.getBinSize();
1214 if(FieldBits::NoField
!= (FrameSizeFieldMask
& whichField
))
1216 returnValue
+= _sfFrameSize
.getBinSize();
1218 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
1220 returnValue
+= _sfName
.getBinSize();
1222 if(FieldBits::NoField
!= (DataTypeFieldMask
& whichField
))
1224 returnValue
+= _sfDataType
.getBinSize();
1226 if(FieldBits::NoField
!= (ComponentSizeFieldMask
& whichField
))
1228 returnValue
+= _sfComponentSize
.getBinSize();
1230 if(FieldBits::NoField
!= (SideCountFieldMask
& whichField
))
1232 returnValue
+= _sfSideCount
.getBinSize();
1234 if(FieldBits::NoField
!= (SideSizeFieldMask
& whichField
))
1236 returnValue
+= _sfSideSize
.getBinSize();
1238 if(FieldBits::NoField
!= (ForceCompressedDataFieldMask
& whichField
))
1240 returnValue
+= _sfForceCompressedData
.getBinSize();
1242 if(FieldBits::NoField
!= (ForceAlphaChannelFieldMask
& whichField
))
1244 returnValue
+= _sfForceAlphaChannel
.getBinSize();
1246 if(FieldBits::NoField
!= (ForceColorChannelFieldMask
& whichField
))
1248 returnValue
+= _sfForceColorChannel
.getBinSize();
1250 if(FieldBits::NoField
!= (ForceAlphaBinaryFieldMask
& whichField
))
1252 returnValue
+= _sfForceAlphaBinary
.getBinSize();
1254 if(FieldBits::NoField
!= (ResXFieldMask
& whichField
))
1256 returnValue
+= _sfResX
.getBinSize();
1258 if(FieldBits::NoField
!= (ResYFieldMask
& whichField
))
1260 returnValue
+= _sfResY
.getBinSize();
1262 if(FieldBits::NoField
!= (ResUnitFieldMask
& whichField
))
1264 returnValue
+= _sfResUnit
.getBinSize();
1266 if(FieldBits::NoField
!= (ClearOnLoadFieldMask
& whichField
))
1268 returnValue
+= _sfClearOnLoad
.getBinSize();
1274 void ImageBase::copyToBin(BinaryDataHandler
&pMem
,
1275 ConstFieldMaskArg whichField
)
1277 Inherited::copyToBin(pMem
, whichField
);
1279 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
1281 _mfParents
.copyToBin(pMem
);
1283 if(FieldBits::NoField
!= (DimensionFieldMask
& whichField
))
1285 _sfDimension
.copyToBin(pMem
);
1287 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1289 _sfWidth
.copyToBin(pMem
);
1291 if(FieldBits::NoField
!= (HeightFieldMask
& whichField
))
1293 _sfHeight
.copyToBin(pMem
);
1295 if(FieldBits::NoField
!= (DepthFieldMask
& whichField
))
1297 _sfDepth
.copyToBin(pMem
);
1299 if(FieldBits::NoField
!= (BppFieldMask
& whichField
))
1301 _sfBpp
.copyToBin(pMem
);
1303 if(FieldBits::NoField
!= (MipMapCountFieldMask
& whichField
))
1305 _sfMipMapCount
.copyToBin(pMem
);
1307 if(FieldBits::NoField
!= (FrameCountFieldMask
& whichField
))
1309 _sfFrameCount
.copyToBin(pMem
);
1311 if(FieldBits::NoField
!= (FrameDelayFieldMask
& whichField
))
1313 _sfFrameDelay
.copyToBin(pMem
);
1315 if(FieldBits::NoField
!= (PixelFormatFieldMask
& whichField
))
1317 _sfPixelFormat
.copyToBin(pMem
);
1319 if(FieldBits::NoField
!= (PixelFieldMask
& whichField
))
1321 _mfPixel
.copyToBin(pMem
);
1323 if(FieldBits::NoField
!= (FrameSizeFieldMask
& whichField
))
1325 _sfFrameSize
.copyToBin(pMem
);
1327 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
1329 _sfName
.copyToBin(pMem
);
1331 if(FieldBits::NoField
!= (DataTypeFieldMask
& whichField
))
1333 _sfDataType
.copyToBin(pMem
);
1335 if(FieldBits::NoField
!= (ComponentSizeFieldMask
& whichField
))
1337 _sfComponentSize
.copyToBin(pMem
);
1339 if(FieldBits::NoField
!= (SideCountFieldMask
& whichField
))
1341 _sfSideCount
.copyToBin(pMem
);
1343 if(FieldBits::NoField
!= (SideSizeFieldMask
& whichField
))
1345 _sfSideSize
.copyToBin(pMem
);
1347 if(FieldBits::NoField
!= (ForceCompressedDataFieldMask
& whichField
))
1349 _sfForceCompressedData
.copyToBin(pMem
);
1351 if(FieldBits::NoField
!= (ForceAlphaChannelFieldMask
& whichField
))
1353 _sfForceAlphaChannel
.copyToBin(pMem
);
1355 if(FieldBits::NoField
!= (ForceColorChannelFieldMask
& whichField
))
1357 _sfForceColorChannel
.copyToBin(pMem
);
1359 if(FieldBits::NoField
!= (ForceAlphaBinaryFieldMask
& whichField
))
1361 _sfForceAlphaBinary
.copyToBin(pMem
);
1363 if(FieldBits::NoField
!= (ResXFieldMask
& whichField
))
1365 _sfResX
.copyToBin(pMem
);
1367 if(FieldBits::NoField
!= (ResYFieldMask
& whichField
))
1369 _sfResY
.copyToBin(pMem
);
1371 if(FieldBits::NoField
!= (ResUnitFieldMask
& whichField
))
1373 _sfResUnit
.copyToBin(pMem
);
1375 if(FieldBits::NoField
!= (ClearOnLoadFieldMask
& whichField
))
1377 _sfClearOnLoad
.copyToBin(pMem
);
1381 void ImageBase::copyFromBin(BinaryDataHandler
&pMem
,
1382 ConstFieldMaskArg whichField
)
1384 Inherited::copyFromBin(pMem
, whichField
);
1386 if(FieldBits::NoField
!= (ParentsFieldMask
& whichField
))
1388 editMField(ParentsFieldMask
, _mfParents
);
1389 _mfParents
.copyFromBin(pMem
);
1391 if(FieldBits::NoField
!= (DimensionFieldMask
& whichField
))
1393 editSField(DimensionFieldMask
);
1394 _sfDimension
.copyFromBin(pMem
);
1396 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1398 editSField(WidthFieldMask
);
1399 _sfWidth
.copyFromBin(pMem
);
1401 if(FieldBits::NoField
!= (HeightFieldMask
& whichField
))
1403 editSField(HeightFieldMask
);
1404 _sfHeight
.copyFromBin(pMem
);
1406 if(FieldBits::NoField
!= (DepthFieldMask
& whichField
))
1408 editSField(DepthFieldMask
);
1409 _sfDepth
.copyFromBin(pMem
);
1411 if(FieldBits::NoField
!= (BppFieldMask
& whichField
))
1413 editSField(BppFieldMask
);
1414 _sfBpp
.copyFromBin(pMem
);
1416 if(FieldBits::NoField
!= (MipMapCountFieldMask
& whichField
))
1418 editSField(MipMapCountFieldMask
);
1419 _sfMipMapCount
.copyFromBin(pMem
);
1421 if(FieldBits::NoField
!= (FrameCountFieldMask
& whichField
))
1423 editSField(FrameCountFieldMask
);
1424 _sfFrameCount
.copyFromBin(pMem
);
1426 if(FieldBits::NoField
!= (FrameDelayFieldMask
& whichField
))
1428 editSField(FrameDelayFieldMask
);
1429 _sfFrameDelay
.copyFromBin(pMem
);
1431 if(FieldBits::NoField
!= (PixelFormatFieldMask
& whichField
))
1433 editSField(PixelFormatFieldMask
);
1434 _sfPixelFormat
.copyFromBin(pMem
);
1436 if(FieldBits::NoField
!= (PixelFieldMask
& whichField
))
1438 editMField(PixelFieldMask
, _mfPixel
);
1439 _mfPixel
.copyFromBin(pMem
);
1441 if(FieldBits::NoField
!= (FrameSizeFieldMask
& whichField
))
1443 editSField(FrameSizeFieldMask
);
1444 _sfFrameSize
.copyFromBin(pMem
);
1446 if(FieldBits::NoField
!= (NameFieldMask
& whichField
))
1448 editSField(NameFieldMask
);
1449 _sfName
.copyFromBin(pMem
);
1451 if(FieldBits::NoField
!= (DataTypeFieldMask
& whichField
))
1453 editSField(DataTypeFieldMask
);
1454 _sfDataType
.copyFromBin(pMem
);
1456 if(FieldBits::NoField
!= (ComponentSizeFieldMask
& whichField
))
1458 editSField(ComponentSizeFieldMask
);
1459 _sfComponentSize
.copyFromBin(pMem
);
1461 if(FieldBits::NoField
!= (SideCountFieldMask
& whichField
))
1463 editSField(SideCountFieldMask
);
1464 _sfSideCount
.copyFromBin(pMem
);
1466 if(FieldBits::NoField
!= (SideSizeFieldMask
& whichField
))
1468 editSField(SideSizeFieldMask
);
1469 _sfSideSize
.copyFromBin(pMem
);
1471 if(FieldBits::NoField
!= (ForceCompressedDataFieldMask
& whichField
))
1473 editSField(ForceCompressedDataFieldMask
);
1474 _sfForceCompressedData
.copyFromBin(pMem
);
1476 if(FieldBits::NoField
!= (ForceAlphaChannelFieldMask
& whichField
))
1478 editSField(ForceAlphaChannelFieldMask
);
1479 _sfForceAlphaChannel
.copyFromBin(pMem
);
1481 if(FieldBits::NoField
!= (ForceColorChannelFieldMask
& whichField
))
1483 editSField(ForceColorChannelFieldMask
);
1484 _sfForceColorChannel
.copyFromBin(pMem
);
1486 if(FieldBits::NoField
!= (ForceAlphaBinaryFieldMask
& whichField
))
1488 editSField(ForceAlphaBinaryFieldMask
);
1489 _sfForceAlphaBinary
.copyFromBin(pMem
);
1491 if(FieldBits::NoField
!= (ResXFieldMask
& whichField
))
1493 editSField(ResXFieldMask
);
1494 _sfResX
.copyFromBin(pMem
);
1496 if(FieldBits::NoField
!= (ResYFieldMask
& whichField
))
1498 editSField(ResYFieldMask
);
1499 _sfResY
.copyFromBin(pMem
);
1501 if(FieldBits::NoField
!= (ResUnitFieldMask
& whichField
))
1503 editSField(ResUnitFieldMask
);
1504 _sfResUnit
.copyFromBin(pMem
);
1506 if(FieldBits::NoField
!= (ClearOnLoadFieldMask
& whichField
))
1508 editSField(ClearOnLoadFieldMask
);
1509 _sfClearOnLoad
.copyFromBin(pMem
);
1513 //! create a new instance of the class
1514 ImageTransitPtr
ImageBase::createLocal(BitVector bFlags
)
1518 if(getClassType().getPrototype() != NULL
)
1520 FieldContainerTransitPtr tmpPtr
=
1521 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
1523 fc
= dynamic_pointer_cast
<Image
>(tmpPtr
);
1529 //! create a new instance of the class, copy the container flags
1530 ImageTransitPtr
ImageBase::createDependent(BitVector bFlags
)
1534 if(getClassType().getPrototype() != NULL
)
1536 FieldContainerTransitPtr tmpPtr
=
1537 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
1539 fc
= dynamic_pointer_cast
<Image
>(tmpPtr
);
1545 //! create a new instance of the class
1546 ImageTransitPtr
ImageBase::create(void)
1550 if(getClassType().getPrototype() != NULL
)
1552 FieldContainerTransitPtr tmpPtr
=
1553 getClassType().getPrototype()-> shallowCopy();
1555 fc
= dynamic_pointer_cast
<Image
>(tmpPtr
);
1561 Image
*ImageBase::createEmptyLocal(BitVector bFlags
)
1565 newPtr
<Image
>(returnValue
, bFlags
);
1567 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1572 //! create an empty new instance of the class, do not copy the prototype
1573 Image
*ImageBase::createEmpty(void)
1577 newPtr
<Image
>(returnValue
, Thread::getCurrentLocalFlags());
1579 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
1580 ~Thread::getCurrentLocalFlags();
1586 FieldContainerTransitPtr
ImageBase::shallowCopyLocal(
1587 BitVector bFlags
) const
1591 newPtr(tmpPtr
, dynamic_cast<const Image
*>(this), bFlags
);
1593 FieldContainerTransitPtr
returnValue(tmpPtr
);
1595 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1600 FieldContainerTransitPtr
ImageBase::shallowCopyDependent(
1601 BitVector bFlags
) const
1605 newPtr(tmpPtr
, dynamic_cast<const Image
*>(this), ~bFlags
);
1607 FieldContainerTransitPtr
returnValue(tmpPtr
);
1609 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1614 FieldContainerTransitPtr
ImageBase::shallowCopy(void) const
1619 dynamic_cast<const Image
*>(this),
1620 Thread::getCurrentLocalFlags());
1622 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
1624 FieldContainerTransitPtr
returnValue(tmpPtr
);
1632 /*------------------------- constructors ----------------------------------*/
1634 ImageBase::ImageBase(void) :
1637 _sfDimension (Int32(0)),
1638 _sfWidth (Int32(0)),
1639 _sfHeight (Int32(1)),
1640 _sfDepth (Int32(1)),
1642 _sfMipMapCount (Int32(1)),
1643 _sfFrameCount (Int32(1)),
1644 _sfFrameDelay (Time(0)),
1645 _sfPixelFormat (UInt32(Image::OSG_INVALID_PF
)),
1647 _sfFrameSize (Int32(0)),
1649 _sfDataType (Int32(GL_UNSIGNED_BYTE
)),
1650 _sfComponentSize (Int32(1)),
1651 _sfSideCount (Int32(1)),
1652 _sfSideSize (Int32(0)),
1653 _sfForceCompressedData (bool(false)),
1654 _sfForceAlphaChannel (bool(false)),
1655 _sfForceColorChannel (bool(false)),
1656 _sfForceAlphaBinary (bool(false)),
1657 _sfResX (Real32(72.0f
)),
1658 _sfResY (Real32(72.0f
)),
1659 _sfResUnit (UInt16(2)),
1660 _sfClearOnLoad (bool(false))
1664 ImageBase::ImageBase(const ImageBase
&source
) :
1667 _sfDimension (source
._sfDimension
),
1668 _sfWidth (source
._sfWidth
),
1669 _sfHeight (source
._sfHeight
),
1670 _sfDepth (source
._sfDepth
),
1671 _sfBpp (source
._sfBpp
),
1672 _sfMipMapCount (source
._sfMipMapCount
),
1673 _sfFrameCount (source
._sfFrameCount
),
1674 _sfFrameDelay (source
._sfFrameDelay
),
1675 _sfPixelFormat (source
._sfPixelFormat
),
1676 _mfPixel (source
._mfPixel
),
1677 _sfFrameSize (source
._sfFrameSize
),
1678 _sfName (source
._sfName
),
1679 _sfDataType (source
._sfDataType
),
1680 _sfComponentSize (source
._sfComponentSize
),
1681 _sfSideCount (source
._sfSideCount
),
1682 _sfSideSize (source
._sfSideSize
),
1683 _sfForceCompressedData (source
._sfForceCompressedData
),
1684 _sfForceAlphaChannel (source
._sfForceAlphaChannel
),
1685 _sfForceColorChannel (source
._sfForceColorChannel
),
1686 _sfForceAlphaBinary (source
._sfForceAlphaBinary
),
1687 _sfResX (source
._sfResX
),
1688 _sfResY (source
._sfResY
),
1689 _sfResUnit (source
._sfResUnit
),
1690 _sfClearOnLoad (source
._sfClearOnLoad
)
1695 /*-------------------------- destructors ----------------------------------*/
1697 ImageBase::~ImageBase(void)
1700 /*-------------------------------------------------------------------------*/
1701 /* Parent linking */
1703 bool ImageBase::linkParent(
1704 FieldContainer
* const pParent
,
1705 UInt16
const childFieldId
,
1706 UInt16
const parentFieldId
)
1708 if(parentFieldId
== ParentsFieldId
)
1710 FieldContainer
* pTypedParent
=
1711 dynamic_cast< FieldContainer
* >(pParent
);
1713 if(pTypedParent
!= NULL
)
1715 editMField(ParentsFieldMask
, _mfParents
);
1717 _mfParents
.push_back(pTypedParent
, childFieldId
);
1725 return Inherited::linkParent(pParent
, childFieldId
, parentFieldId
);
1728 bool ImageBase::unlinkParent(
1729 FieldContainer
* const pParent
,
1730 UInt16
const parentFieldId
)
1732 if(parentFieldId
== ParentsFieldId
)
1734 FieldContainer
* pTypedParent
=
1735 dynamic_cast< FieldContainer
* >(pParent
);
1737 if(pTypedParent
!= NULL
)
1739 Int32 iParentIdx
= _mfParents
.findIndex(pTypedParent
);
1741 if(iParentIdx
!= -1)
1743 editMField(ParentsFieldMask
, _mfParents
);
1745 _mfParents
.erase(iParentIdx
);
1750 SWARNING
<< "Child ([" << this
1751 << "] id [" << this->getId()
1752 << "] type [" << this->getType().getCName()
1753 << "] parentFieldId [" << parentFieldId
1754 << "]) - Parent ([" << pParent
1755 << "] id [" << pParent
->getId()
1756 << "] type [" << pParent
->getType().getCName()
1757 << "]): link inconsistent!"
1766 return Inherited::unlinkParent(pParent
, parentFieldId
);
1771 GetFieldHandlePtr
ImageBase::getHandleParents (void) const
1773 MFParentFieldContainerPtr::GetHandlePtr returnValue
;
1778 EditFieldHandlePtr
ImageBase::editHandleParents (void)
1780 EditFieldHandlePtr returnValue
;
1785 GetFieldHandlePtr
ImageBase::getHandleDimension (void) const
1787 SFInt32::GetHandlePtr
returnValue(
1788 new SFInt32::GetHandle(
1790 this->getType().getFieldDesc(DimensionFieldId
),
1791 const_cast<ImageBase
*>(this)));
1796 EditFieldHandlePtr
ImageBase::editHandleDimension (void)
1798 SFInt32::EditHandlePtr
returnValue(
1799 new SFInt32::EditHandle(
1801 this->getType().getFieldDesc(DimensionFieldId
),
1805 editSField(DimensionFieldMask
);
1810 GetFieldHandlePtr
ImageBase::getHandleWidth (void) const
1812 SFInt32::GetHandlePtr
returnValue(
1813 new SFInt32::GetHandle(
1815 this->getType().getFieldDesc(WidthFieldId
),
1816 const_cast<ImageBase
*>(this)));
1821 EditFieldHandlePtr
ImageBase::editHandleWidth (void)
1823 SFInt32::EditHandlePtr
returnValue(
1824 new SFInt32::EditHandle(
1826 this->getType().getFieldDesc(WidthFieldId
),
1830 editSField(WidthFieldMask
);
1835 GetFieldHandlePtr
ImageBase::getHandleHeight (void) const
1837 SFInt32::GetHandlePtr
returnValue(
1838 new SFInt32::GetHandle(
1840 this->getType().getFieldDesc(HeightFieldId
),
1841 const_cast<ImageBase
*>(this)));
1846 EditFieldHandlePtr
ImageBase::editHandleHeight (void)
1848 SFInt32::EditHandlePtr
returnValue(
1849 new SFInt32::EditHandle(
1851 this->getType().getFieldDesc(HeightFieldId
),
1855 editSField(HeightFieldMask
);
1860 GetFieldHandlePtr
ImageBase::getHandleDepth (void) const
1862 SFInt32::GetHandlePtr
returnValue(
1863 new SFInt32::GetHandle(
1865 this->getType().getFieldDesc(DepthFieldId
),
1866 const_cast<ImageBase
*>(this)));
1871 EditFieldHandlePtr
ImageBase::editHandleDepth (void)
1873 SFInt32::EditHandlePtr
returnValue(
1874 new SFInt32::EditHandle(
1876 this->getType().getFieldDesc(DepthFieldId
),
1880 editSField(DepthFieldMask
);
1885 GetFieldHandlePtr
ImageBase::getHandleBpp (void) const
1887 SFInt32::GetHandlePtr
returnValue(
1888 new SFInt32::GetHandle(
1890 this->getType().getFieldDesc(BppFieldId
),
1891 const_cast<ImageBase
*>(this)));
1896 EditFieldHandlePtr
ImageBase::editHandleBpp (void)
1898 SFInt32::EditHandlePtr
returnValue(
1899 new SFInt32::EditHandle(
1901 this->getType().getFieldDesc(BppFieldId
),
1905 editSField(BppFieldMask
);
1910 GetFieldHandlePtr
ImageBase::getHandleMipMapCount (void) const
1912 SFInt32::GetHandlePtr
returnValue(
1913 new SFInt32::GetHandle(
1915 this->getType().getFieldDesc(MipMapCountFieldId
),
1916 const_cast<ImageBase
*>(this)));
1921 EditFieldHandlePtr
ImageBase::editHandleMipMapCount (void)
1923 SFInt32::EditHandlePtr
returnValue(
1924 new SFInt32::EditHandle(
1926 this->getType().getFieldDesc(MipMapCountFieldId
),
1930 editSField(MipMapCountFieldMask
);
1935 GetFieldHandlePtr
ImageBase::getHandleFrameCount (void) const
1937 SFInt32::GetHandlePtr
returnValue(
1938 new SFInt32::GetHandle(
1940 this->getType().getFieldDesc(FrameCountFieldId
),
1941 const_cast<ImageBase
*>(this)));
1946 EditFieldHandlePtr
ImageBase::editHandleFrameCount (void)
1948 SFInt32::EditHandlePtr
returnValue(
1949 new SFInt32::EditHandle(
1951 this->getType().getFieldDesc(FrameCountFieldId
),
1955 editSField(FrameCountFieldMask
);
1960 GetFieldHandlePtr
ImageBase::getHandleFrameDelay (void) const
1962 SFTime::GetHandlePtr
returnValue(
1963 new SFTime::GetHandle(
1965 this->getType().getFieldDesc(FrameDelayFieldId
),
1966 const_cast<ImageBase
*>(this)));
1971 EditFieldHandlePtr
ImageBase::editHandleFrameDelay (void)
1973 SFTime::EditHandlePtr
returnValue(
1974 new SFTime::EditHandle(
1976 this->getType().getFieldDesc(FrameDelayFieldId
),
1980 editSField(FrameDelayFieldMask
);
1985 GetFieldHandlePtr
ImageBase::getHandlePixelFormat (void) const
1987 SFUInt32::GetHandlePtr
returnValue(
1988 new SFUInt32::GetHandle(
1990 this->getType().getFieldDesc(PixelFormatFieldId
),
1991 const_cast<ImageBase
*>(this)));
1996 EditFieldHandlePtr
ImageBase::editHandlePixelFormat (void)
1998 SFUInt32::EditHandlePtr
returnValue(
1999 new SFUInt32::EditHandle(
2001 this->getType().getFieldDesc(PixelFormatFieldId
),
2005 editSField(PixelFormatFieldMask
);
2010 GetFieldHandlePtr
ImageBase::getHandlePixel (void) const
2012 MFUInt8::GetHandlePtr
returnValue(
2013 new MFUInt8::GetHandle(
2015 this->getType().getFieldDesc(PixelFieldId
),
2016 const_cast<ImageBase
*>(this)));
2021 EditFieldHandlePtr
ImageBase::editHandlePixel (void)
2023 MFUInt8::EditHandlePtr
returnValue(
2024 new MFUInt8::EditHandle(
2026 this->getType().getFieldDesc(PixelFieldId
),
2030 editMField(PixelFieldMask
, _mfPixel
);
2035 GetFieldHandlePtr
ImageBase::getHandleFrameSize (void) const
2037 SFInt32::GetHandlePtr
returnValue(
2038 new SFInt32::GetHandle(
2040 this->getType().getFieldDesc(FrameSizeFieldId
),
2041 const_cast<ImageBase
*>(this)));
2046 EditFieldHandlePtr
ImageBase::editHandleFrameSize (void)
2048 SFInt32::EditHandlePtr
returnValue(
2049 new SFInt32::EditHandle(
2051 this->getType().getFieldDesc(FrameSizeFieldId
),
2055 editSField(FrameSizeFieldMask
);
2060 GetFieldHandlePtr
ImageBase::getHandleName (void) const
2062 SFString::GetHandlePtr
returnValue(
2063 new SFString::GetHandle(
2065 this->getType().getFieldDesc(NameFieldId
),
2066 const_cast<ImageBase
*>(this)));
2071 EditFieldHandlePtr
ImageBase::editHandleName (void)
2073 SFString::EditHandlePtr
returnValue(
2074 new SFString::EditHandle(
2076 this->getType().getFieldDesc(NameFieldId
),
2080 editSField(NameFieldMask
);
2085 GetFieldHandlePtr
ImageBase::getHandleDataType (void) const
2087 SFInt32::GetHandlePtr
returnValue(
2088 new SFInt32::GetHandle(
2090 this->getType().getFieldDesc(DataTypeFieldId
),
2091 const_cast<ImageBase
*>(this)));
2096 EditFieldHandlePtr
ImageBase::editHandleDataType (void)
2098 SFInt32::EditHandlePtr
returnValue(
2099 new SFInt32::EditHandle(
2101 this->getType().getFieldDesc(DataTypeFieldId
),
2105 editSField(DataTypeFieldMask
);
2110 GetFieldHandlePtr
ImageBase::getHandleComponentSize (void) const
2112 SFInt32::GetHandlePtr
returnValue(
2113 new SFInt32::GetHandle(
2115 this->getType().getFieldDesc(ComponentSizeFieldId
),
2116 const_cast<ImageBase
*>(this)));
2121 EditFieldHandlePtr
ImageBase::editHandleComponentSize (void)
2123 SFInt32::EditHandlePtr
returnValue(
2124 new SFInt32::EditHandle(
2126 this->getType().getFieldDesc(ComponentSizeFieldId
),
2130 editSField(ComponentSizeFieldMask
);
2135 GetFieldHandlePtr
ImageBase::getHandleSideCount (void) const
2137 SFInt32::GetHandlePtr
returnValue(
2138 new SFInt32::GetHandle(
2140 this->getType().getFieldDesc(SideCountFieldId
),
2141 const_cast<ImageBase
*>(this)));
2146 EditFieldHandlePtr
ImageBase::editHandleSideCount (void)
2148 SFInt32::EditHandlePtr
returnValue(
2149 new SFInt32::EditHandle(
2151 this->getType().getFieldDesc(SideCountFieldId
),
2155 editSField(SideCountFieldMask
);
2160 GetFieldHandlePtr
ImageBase::getHandleSideSize (void) const
2162 SFInt32::GetHandlePtr
returnValue(
2163 new SFInt32::GetHandle(
2165 this->getType().getFieldDesc(SideSizeFieldId
),
2166 const_cast<ImageBase
*>(this)));
2171 EditFieldHandlePtr
ImageBase::editHandleSideSize (void)
2173 SFInt32::EditHandlePtr
returnValue(
2174 new SFInt32::EditHandle(
2176 this->getType().getFieldDesc(SideSizeFieldId
),
2180 editSField(SideSizeFieldMask
);
2185 GetFieldHandlePtr
ImageBase::getHandleForceCompressedData (void) const
2187 SFBool::GetHandlePtr
returnValue(
2188 new SFBool::GetHandle(
2189 &_sfForceCompressedData
,
2190 this->getType().getFieldDesc(ForceCompressedDataFieldId
),
2191 const_cast<ImageBase
*>(this)));
2196 EditFieldHandlePtr
ImageBase::editHandleForceCompressedData(void)
2198 SFBool::EditHandlePtr
returnValue(
2199 new SFBool::EditHandle(
2200 &_sfForceCompressedData
,
2201 this->getType().getFieldDesc(ForceCompressedDataFieldId
),
2205 editSField(ForceCompressedDataFieldMask
);
2210 GetFieldHandlePtr
ImageBase::getHandleForceAlphaChannel (void) const
2212 SFBool::GetHandlePtr
returnValue(
2213 new SFBool::GetHandle(
2214 &_sfForceAlphaChannel
,
2215 this->getType().getFieldDesc(ForceAlphaChannelFieldId
),
2216 const_cast<ImageBase
*>(this)));
2221 EditFieldHandlePtr
ImageBase::editHandleForceAlphaChannel(void)
2223 SFBool::EditHandlePtr
returnValue(
2224 new SFBool::EditHandle(
2225 &_sfForceAlphaChannel
,
2226 this->getType().getFieldDesc(ForceAlphaChannelFieldId
),
2230 editSField(ForceAlphaChannelFieldMask
);
2235 GetFieldHandlePtr
ImageBase::getHandleForceColorChannel (void) const
2237 SFBool::GetHandlePtr
returnValue(
2238 new SFBool::GetHandle(
2239 &_sfForceColorChannel
,
2240 this->getType().getFieldDesc(ForceColorChannelFieldId
),
2241 const_cast<ImageBase
*>(this)));
2246 EditFieldHandlePtr
ImageBase::editHandleForceColorChannel(void)
2248 SFBool::EditHandlePtr
returnValue(
2249 new SFBool::EditHandle(
2250 &_sfForceColorChannel
,
2251 this->getType().getFieldDesc(ForceColorChannelFieldId
),
2255 editSField(ForceColorChannelFieldMask
);
2260 GetFieldHandlePtr
ImageBase::getHandleForceAlphaBinary (void) const
2262 SFBool::GetHandlePtr
returnValue(
2263 new SFBool::GetHandle(
2264 &_sfForceAlphaBinary
,
2265 this->getType().getFieldDesc(ForceAlphaBinaryFieldId
),
2266 const_cast<ImageBase
*>(this)));
2271 EditFieldHandlePtr
ImageBase::editHandleForceAlphaBinary(void)
2273 SFBool::EditHandlePtr
returnValue(
2274 new SFBool::EditHandle(
2275 &_sfForceAlphaBinary
,
2276 this->getType().getFieldDesc(ForceAlphaBinaryFieldId
),
2280 editSField(ForceAlphaBinaryFieldMask
);
2285 GetFieldHandlePtr
ImageBase::getHandleResX (void) const
2287 SFReal32::GetHandlePtr
returnValue(
2288 new SFReal32::GetHandle(
2290 this->getType().getFieldDesc(ResXFieldId
),
2291 const_cast<ImageBase
*>(this)));
2296 EditFieldHandlePtr
ImageBase::editHandleResX (void)
2298 SFReal32::EditHandlePtr
returnValue(
2299 new SFReal32::EditHandle(
2301 this->getType().getFieldDesc(ResXFieldId
),
2305 editSField(ResXFieldMask
);
2310 GetFieldHandlePtr
ImageBase::getHandleResY (void) const
2312 SFReal32::GetHandlePtr
returnValue(
2313 new SFReal32::GetHandle(
2315 this->getType().getFieldDesc(ResYFieldId
),
2316 const_cast<ImageBase
*>(this)));
2321 EditFieldHandlePtr
ImageBase::editHandleResY (void)
2323 SFReal32::EditHandlePtr
returnValue(
2324 new SFReal32::EditHandle(
2326 this->getType().getFieldDesc(ResYFieldId
),
2330 editSField(ResYFieldMask
);
2335 GetFieldHandlePtr
ImageBase::getHandleResUnit (void) const
2337 SFUInt16::GetHandlePtr
returnValue(
2338 new SFUInt16::GetHandle(
2340 this->getType().getFieldDesc(ResUnitFieldId
),
2341 const_cast<ImageBase
*>(this)));
2346 EditFieldHandlePtr
ImageBase::editHandleResUnit (void)
2348 SFUInt16::EditHandlePtr
returnValue(
2349 new SFUInt16::EditHandle(
2351 this->getType().getFieldDesc(ResUnitFieldId
),
2355 editSField(ResUnitFieldMask
);
2360 GetFieldHandlePtr
ImageBase::getHandleClearOnLoad (void) const
2362 SFBool::GetHandlePtr
returnValue(
2363 new SFBool::GetHandle(
2365 this->getType().getFieldDesc(ClearOnLoadFieldId
),
2366 const_cast<ImageBase
*>(this)));
2371 EditFieldHandlePtr
ImageBase::editHandleClearOnLoad (void)
2373 SFBool::EditHandlePtr
returnValue(
2374 new SFBool::EditHandle(
2376 this->getType().getFieldDesc(ClearOnLoadFieldId
),
2380 editSField(ClearOnLoadFieldMask
);
2386 #ifdef OSG_MT_CPTR_ASPECT
2387 void ImageBase::execSyncV( FieldContainer
&oFrom
,
2388 ConstFieldMaskArg whichField
,
2389 AspectOffsetStore
&oOffsets
,
2390 ConstFieldMaskArg syncMode
,
2391 const UInt32 uiSyncInfo
)
2393 Image
*pThis
= static_cast<Image
*>(this);
2395 pThis
->execSync(static_cast<Image
*>(&oFrom
),
2404 #ifdef OSG_MT_CPTR_ASPECT
2405 FieldContainer
*ImageBase::createAspectCopy(
2406 const FieldContainer
*pRefAspect
) const
2410 newAspectCopy(returnValue
,
2411 dynamic_cast<const Image
*>(pRefAspect
),
2412 dynamic_cast<const Image
*>(this));
2418 void ImageBase::resolveLinks(void)
2420 Inherited::resolveLinks();
2422 #ifdef OSG_MT_CPTR_ASPECT
2423 AspectOffsetStore oOffsets
;
2425 _pAspectStore
->fillOffsetArray(oOffsets
, this);
2428 #ifdef OSG_MT_CPTR_ASPECT
2429 _mfPixel
.terminateShare(Thread::getCurrentAspect(),