osg::VRMLImageTextureDesc Class Reference
[VRML-specific File Input/Output]

VRML Image Texture Desc. More...

#include <OSGVRMLNodeDescs.h>

Inheritance diagram for osg::VRMLImageTextureDesc:

osg::VRMLNodeDesc

List of all members.

Member



FieldNameTypeHash _mFieldTypes
GenericAttPtr _pGenAtt
FieldContainerPtr _pNodeProto
FieldContainerPtr _pNodeCoreProto
Field_pCurrField
std::string _szCurrentName
bool _bSaveOnEnd
static UInt32 _uiIndent = 0
FieldgetField (FieldContainerPtr pFC1, FieldContainerPtr pFC2, GenericAttPtr pGenAtt, const Char8 *szFieldname)

Public Member Functions

Constructors


 VRMLImageTextureDesc (void)
Destructor


virtual ~VRMLImageTextureDesc (void)
Helper


virtual void init (const Char8 *szName)
virtual void reset (void)
Field


virtual bool prototypeAddField (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
virtual void endProtoInterface (void)
virtual void getFieldAndDesc (FieldContainerPtr pFC, const Char8 *szFieldname, Field *&pField, const FieldDescription *&pDesc)
Node


virtual FieldContainerPtr beginNode (const Char8 *szTypename, const Char8 *szName, FieldContainerPtr pCurrentFC)
virtual void endNode (FieldContainerPtr)
Dump


virtual void dump (const Char8 *szNodeName)
Helper


virtual void setOnEndSave (const Char8 *szName)
virtual void clearOnEndSave (void)
virtual bool getOnEndSave (void)
virtual const Char8getSavename (void)
virtual FieldContainerPtr getSaveFieldContainer (void)
Field


virtual FieldgetField (const Char8 *szFieldname)
Prototypes


virtual void prototypeAddFieldValue (const Char8 *szFieldVal)
FieldValue


virtual void addFieldValue (Field *pField, const Char8 *szFieldVal)
virtual bool use (FieldContainerPtr)

Static Public Member Functions

Class Get


static UInt32 getIndent (void)
static void incIndent (void)
static void decIndent (void)
static void resetIndent (void)

Protected Types

typedef std::map< const Char8
*, UInt32, LTString
FieldNameTypeHash

Protected Attributes

Member


SFString _defaultURL
SFBool _defaultRepeatS
SFBool _defaultRepeatT
MFString _url
SFBool _repeatS
SFBool _repeatT

Private Types

typedef VRMLNodeDesc Inherited

Private Member Functions

 VRMLImageTextureDesc (const VRMLImageTextureDesc &source)
 prohibit default function (move to 'public' if needed)
void operator= (const VRMLImageTextureDesc &source)
 prohibit default function (move to 'public' if needed)


Detailed Description

VRML Texture description

Definition at line 1114 of file OSGVRMLNodeDescs.h.


Member Typedef Documentation

Definition at line 1195 of file OSGVRMLNodeDescs.h.

typedef std::map< const Char8 *, UInt32, LTString> osg::VRMLNodeDesc::FieldNameTypeHash [protected, inherited]

Definition at line 298 of file OSGVRMLNodeDescs.h.


Constructor & Destructor Documentation

VRMLImageTextureDesc::VRMLImageTextureDesc ( void   ) 

Definition at line 3402 of file OSGVRMLNodeDescs.cpp.

03402                                                :
03403     Inherited(),
03404 
03405     _defaultURL    (),
03406     _defaultRepeatS(),
03407     _defaultRepeatT(),
03408 
03409     _url           (),
03410     _repeatS       (),
03411     _repeatT       ()
03412 {
03413 }

VRMLImageTextureDesc::~VRMLImageTextureDesc ( void   )  [virtual]

Definition at line 3418 of file OSGVRMLNodeDescs.cpp.

03419 {
03420 }

osg::VRMLImageTextureDesc::VRMLImageTextureDesc ( const VRMLImageTextureDesc source  )  [private]


Member Function Documentation

void VRMLImageTextureDesc::init ( const Char8 szName  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3425 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::getIndent(), osg::indentLog(), and PINFO.

03426 {
03427 #ifdef OSG_DEBUG_VRML
03428     indentLog(getIndent(), PINFO);
03429     PINFO << "ImageTextureDesc::init : " << szName << std::endl;
03430 #endif
03431 }

void VRMLImageTextureDesc::reset ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3433 of file OSGVRMLNodeDescs.cpp.

03434 {
03435 }

bool VRMLImageTextureDesc::prototypeAddField ( const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3440 of file OSGVRMLNodeDescs.cpp.

References _defaultRepeatS, _defaultRepeatT, _defaultURL, osg::VRMLNodeDesc::_pCurrField, osg::VRMLNodeDesc::getIndent(), osg::indentLog(), PINFO, and osg::stringcasecmp().

03443 {
03444     bool bFound = false;
03445 
03446     _pCurrField = NULL;
03447 
03448     if(stringcasecmp("url", szFieldname) == 0)
03449     {
03450         _pCurrField = &_defaultURL;
03451 
03452         bFound = true;
03453     }
03454     else if(stringcasecmp("repeatS", szFieldname) == 0)
03455     {
03456         _pCurrField = &_defaultRepeatS;
03457 
03458         bFound = true;
03459     }
03460     else if(stringcasecmp("repeatT", szFieldname) == 0)
03461     {
03462         _pCurrField = &_defaultRepeatT;
03463 
03464         bFound = true;
03465     }
03466 
03467     if(bFound == true)
03468     {
03469 #ifdef OSG_DEBUG_VRML
03470         indentLog(getIndent(), PINFO);
03471         PINFO << "ImageTextureDesc::prototypeAddField : add part "
03472               << szFieldname
03473               << std::endl;
03474 #endif
03475 
03476         return true;
03477     }
03478     else
03479     {
03480         return false;
03481     }
03482 }

void VRMLImageTextureDesc::endProtoInterface ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3484 of file OSGVRMLNodeDescs.cpp.

03485 {
03486 }

void VRMLImageTextureDesc::getFieldAndDesc ( FieldContainerPtr  pFC,
const Char8 szFieldname,
Field *&  pField,
const FieldDescription *&  pDesc 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3488 of file OSGVRMLNodeDescs.cpp.

References _repeatS, _repeatT, _url, and osg::stringcasecmp().

03493 {
03494     if(stringcasecmp("url", szFieldname) == 0)
03495     {
03496         pField = &_url;
03497     }
03498     else if(stringcasecmp("repeatS", szFieldname) == 0)
03499     {
03500         pField = &_repeatS;
03501     }
03502     else if(stringcasecmp("repeatT", szFieldname) == 0)
03503     {
03504         pField = &_repeatT;
03505     }
03506 
03507     pDesc = NULL;
03508 }

FieldContainerPtr VRMLImageTextureDesc::beginNode ( const Char8 szTypename,
const Char8 szName,
FieldContainerPtr  pCurrentFC 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3513 of file OSGVRMLNodeDescs.cpp.

References _defaultRepeatS, _defaultRepeatT, _repeatS, _repeatT, _url, osg::MField< FieldTypeT, fieldNameSpace >::clear(), osg::TextureChunkBase::create(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), and PINFO.

03517 {
03518     TextureChunkPtr returnValue = TextureChunk::create();
03519 
03520 #ifdef OSG_DEBUG_VRML
03521     indentLog(getIndent(), PINFO);
03522     PINFO << "Begin ImageTexture " << &(*returnValue) << std::endl;
03523 
03524     incIndent();
03525 #endif
03526 
03527     _url.clear();
03528 
03529     _repeatS = _defaultRepeatS;
03530     _repeatT = _defaultRepeatT;
03531 
03532     return returnValue;
03533 }

void VRMLImageTextureDesc::endNode ( FieldContainerPtr  pFC  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3535 of file OSGVRMLNodeDescs.cpp.

References _repeatS, _repeatT, _url, osg::beginEditCP(), osg::AttachmentPtr::dcast(), osg::VRMLNodeDesc::decIndent(), osg::endEditCP(), osg::ImageBase::ForceAlphaBinaryFieldMask, osg::VRMLNodeDesc::getIndent(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::indentLog(), osg::NullFC, PINFO, PNOTICE, PWARNING, osg::ImageFileHandler::read(), and osg::ImageFileHandler::the().

03536 {
03537     TextureChunkPtr  pTexture = NullFC;
03538 
03539     pTexture = TextureChunkPtr::dcast(pFC);
03540 
03541 
03542     if(pTexture != NullFC)
03543     {
03544 #ifdef OSG_DEBUG_VRML
03545         PNOTICE << "VRMLImageTextureDesc::endNode : Reading texture "
03546                 << _url[0].c_str() << std::endl;
03547 #endif
03548 
03549         ImagePtr pImage = ImageFileHandler::the().read(_url[0].c_str());
03550 
03551         if(pImage != NullFC)
03552         {
03553             beginEditCP(pImage, Image::ForceAlphaBinaryFieldMask);
03554             pImage->setForceAlphaBinary(pImage->calcIsAlphaBinary());
03555             endEditCP(pImage, Image::ForceAlphaBinaryFieldMask);
03556 
03557             beginEditCP(pTexture);
03558             pTexture->setImage(pImage);
03559 
03560             if(_repeatS.getValue() == true)
03561             {
03562                 pTexture->setWrapS(GL_REPEAT);
03563             }
03564             else
03565             {
03566                 pTexture->setWrapS(GL_CLAMP);
03567             }
03568             if(_repeatT.getValue() == true)
03569             {
03570                 pTexture->setWrapT(GL_REPEAT);
03571             }
03572             else
03573             {
03574                 pTexture->setWrapT(GL_CLAMP);
03575             }
03576             pTexture->setEnvMode(GL_MODULATE);
03577             endEditCP(pTexture);
03578         }
03579         else
03580         {
03581             PWARNING << "VRMLImageTextureDesc::endNode : "
03582                      << "Couldn't read texture "
03583                      << _url[0].c_str()
03584                      << " !!!"
03585                      << std::endl;
03586         }
03587     }
03588     else
03589     {
03590         PWARNING <<  "VRMLImageTextureDesc::endNode : Invalid texture ptr"
03591                  << std::endl;
03592     }
03593 
03594 #ifdef OSG_DEBUG_VRML
03595     decIndent();
03596 
03597     indentLog(getIndent(), PINFO);
03598     PINFO << "End ImageTexture "
03599           << _url[0].c_str() << " "
03600           << _repeatS.getValue()    << " "
03601           << _repeatT.getValue()    << " "
03602           << &(*pFC) << std::endl;
03603 #endif
03604 }

void VRMLImageTextureDesc::dump ( const Char8 szNodeName  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3609 of file OSGVRMLNodeDescs.cpp.

03610 {
03611 }

void osg::VRMLImageTextureDesc::operator= ( const VRMLImageTextureDesc source  )  [private]

UInt32 VRMLNodeDesc::getIndent ( void   )  [static, inherited]

Definition at line 128 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_uiIndent.

Referenced by osg::VRMLNodeFactory< BaseT >::addFieldValue(), osg::VRMLNodeFactory< BaseT >::beginEventInDecl(), osg::VRMLNodeFactory< BaseT >::beginEventOutDecl(), osg::VRMLViewpointDesc::beginNode(), osg::VRMLInlineDesc::beginNode(), osg::VRMLGroupDesc::beginNode(), osg::VRMLSwitchDesc::beginNode(), osg::VRMLLODDesc::beginNode(), osg::VRMLPixelTextureDesc::beginNode(), beginNode(), osg::VRMLTextureTransformDesc::beginNode(), osg::VRMLAppearanceDesc::beginNode(), osg::VRMLGeometryPointSetDesc::beginNode(), osg::VRMLGeometryDesc::beginNode(), osg::VRMLShapeDesc::beginNode(), osg::VRMLFile::beginNode(), osg::VRMLNodeFactory< BaseT >::beginProto(), osg::VRMLFile::endField(), osg::VRMLViewpointDesc::endNode(), osg::VRMLInlineDesc::endNode(), osg::VRMLExtrusionDesc::endNode(), osg::VRMLGroupDesc::endNode(), osg::VRMLSwitchDesc::endNode(), osg::VRMLLODDesc::endNode(), osg::VRMLPixelTextureDesc::endNode(), endNode(), osg::VRMLTextureTransformDesc::endNode(), osg::VRMLAppearanceDesc::endNode(), osg::VRMLGeometryObjectDesc::endNode(), osg::VRMLGeometryPointSetDesc::endNode(), osg::VRMLGeometryDesc::endNode(), osg::VRMLShapeDesc::endNode(), osg::VRMLFile::endNode(), osg::VRMLNodeFactory< BaseT >::findNodeDesc(), osg::VRMLNodeDesc::getField(), osg::VRMLViewpointDesc::getFieldAndDesc(), osg::VRMLInlineDesc::getFieldAndDesc(), osg::VRMLExtrusionDesc::getFieldAndDesc(), osg::VRMLGroupDesc::getFieldAndDesc(), osg::VRMLSwitchDesc::getFieldAndDesc(), osg::VRMLLODDesc::getFieldAndDesc(), osg::VRMLAppearanceDesc::getFieldAndDesc(), osg::VRMLGeometryObjectDesc::getFieldAndDesc(), osg::VRMLGeometryPartDesc::getFieldAndDesc(), osg::VRMLGeometryPointSetDesc::getFieldAndDesc(), osg::VRMLGeometryDesc::getFieldAndDesc(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::VRMLNodeDesc::getFieldAndDesc(), osg::VRMLFile::getFieldType(), osg::VRMLInlineDesc::init(), osg::VRMLExtrusionDesc::init(), osg::VRMLGroupDesc::init(), osg::VRMLSwitchDesc::init(), osg::VRMLLODDesc::init(), osg::VRMLPixelTextureDesc::init(), init(), osg::VRMLTextureTransformDesc::init(), osg::VRMLMaterialDesc::init(), osg::VRMLAppearanceDesc::init(), osg::VRMLGeometryObjectDesc::init(), osg::VRMLGeometryPartDesc::init(), osg::VRMLGeometryPointSetDesc::init(), osg::VRMLGeometryDesc::init(), osg::VRMLShapeDesc::init(), osg::VRMLPixelTextureDesc::prototypeAddField(), prototypeAddField(), osg::VRMLTextureTransformDesc::prototypeAddField(), osg::VRMLMaterialDesc::prototypeAddField(), osg::VRMLGeometryPartDesc::prototypeAddField(), osg::VRMLGeometryPointSetDesc::prototypeAddField(), osg::VRMLGeometryDesc::prototypeAddField(), osg::VRMLShapeDesc::prototypeAddField(), osg::VRMLNodeDesc::prototypeAddField(), osg::VRMLFile::setContainerFieldValue(), and osg::VRMLFile::use().

00129 {
00130     return _uiIndent;
00131 }

void VRMLNodeDesc::incIndent ( void   )  [static, inherited]

void VRMLNodeDesc::decIndent ( void   )  [static, inherited]

void VRMLNodeDesc::resetIndent ( void   )  [static, inherited]

void VRMLNodeDesc::setOnEndSave ( const Char8 szName  )  [virtual, inherited]

Definition at line 209 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd, and osg::VRMLNodeDesc::_szCurrentName.

Referenced by osg::VRMLFile::beginNode().

00210 {
00211     _szCurrentName = szName; // does that make a copy? I expect it to...
00212     _bSaveOnEnd = true;
00213 }

void VRMLNodeDesc::clearOnEndSave ( void   )  [virtual, inherited]

Definition at line 215 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

Referenced by osg::VRMLFile::endNode().

00216 {
00217     _bSaveOnEnd = false;
00218 }

bool VRMLNodeDesc::getOnEndSave ( void   )  [virtual, inherited]

Definition at line 220 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

Referenced by osg::VRMLFile::endNode().

00221 {
00222     return _bSaveOnEnd;
00223 }

const Char8 * VRMLNodeDesc::getSavename ( void   )  [virtual, inherited]

Definition at line 225 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_szCurrentName.

Referenced by osg::VRMLFile::endNode().

00226 {
00227     return _szCurrentName.c_str();
00228 }

FieldContainerPtr VRMLNodeDesc::getSaveFieldContainer ( void   )  [virtual, inherited]

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 230 of file OSGVRMLNodeDescs.cpp.

References osg::NullFC.

Referenced by osg::VRMLFile::endNode().

00231 {
00232     return NullFC;
00233 }

Field * VRMLNodeDesc::getField ( const Char8 szFieldname  )  [virtual, inherited]

Field * VRMLNodeDesc::getField ( FieldContainerPtr  pFC1,
FieldContainerPtr  pFC2,
GenericAttPtr  pGenAtt,
const Char8 szFieldname 
) [protected, inherited]

Definition at line 607 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::decIndent(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, and PINFO.

00611 {
00612     Field *returnValue = NULL;
00613 
00614     if(szFieldname == NULL)
00615     {
00616         return returnValue;
00617     }
00618 
00619 #ifdef OSG_DEBUG_VRML
00620     indentLog(getIndent(), PINFO);
00621     PINFO << "VRMLNodeDesc::getField " << std::endl;
00622 
00623     incIndent();
00624 
00625     indentLog(getIndent(), PINFO);
00626     PINFO << "Trying to find field : " << szFieldname << std::endl;
00627 #endif
00628 
00629     if(pFC1 != NullFC)
00630     {
00631         returnValue = pFC1->getField(szFieldname);
00632     }
00633 
00634 #ifdef OSG_DEBUG_VRML
00635     incIndent();
00636 
00637     indentLog(getIndent(), PINFO);
00638     PINFO << "Got this from node : " << returnValue << std::endl;
00639 #endif
00640 
00641     if(returnValue != NULL)
00642         return returnValue;
00643 
00644     if(pFC2 != NullFC)
00645     {
00646         returnValue = pFC2->getField(szFieldname);
00647 
00648 #ifdef OSG_DEBUG_VRML
00649         indentLog(getIndent(), PINFO);
00650         PINFO << "Got this from nodecore : " << returnValue << std::endl;
00651 #endif
00652     }
00653     else
00654     {
00655 #ifdef OSG_DEBUG_VRML
00656         indentLog(getIndent(), PINFO);
00657         PINFO << "No core to check" << std::endl;
00658 #endif
00659     }
00660 
00661 
00662     if(returnValue != NULL)
00663         return returnValue;
00664 
00665     if(pGenAtt != NullFC)
00666     {
00667         returnValue = pGenAtt->getField(szFieldname);
00668     }
00669 
00670 #ifdef OSG_DEBUG_VRML
00671     indentLog(getIndent(), PINFO);
00672     PINFO << "Got this from attachment : " << returnValue << std::endl;
00673 
00674     decIndent();
00675     decIndent();
00676 #endif
00677 
00678     return returnValue;
00679 }

void VRMLNodeDesc::prototypeAddFieldValue ( const Char8 szFieldVal  )  [virtual, inherited]

Definition at line 477 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pCurrField, and osg::Field::pushValueByStr().

Referenced by osg::VRMLNodeFactory< BaseT >::addFieldValue().

00478 {
00479     if(_pCurrField       != NULL)
00480     {
00481         _pCurrField->pushValueByStr(szFieldVal);
00482     }
00483 }

void VRMLNodeDesc::addFieldValue ( Field pField,
const Char8 szFieldVal 
) [virtual, inherited]

Reimplemented in osg::VRMLGeometryDesc, osg::VRMLGeometryPointSetDesc, and osg::VRMLPixelTextureDesc.

Definition at line 551 of file OSGVRMLNodeDescs.cpp.

References osg::Field::pushValueByStr().

Referenced by osg::VRMLFile::addFieldValue().

00553 {
00554     if(pField != NULL)
00555     {
00556         pField->pushValueByStr(szFieldVal);
00557     }
00558 }

bool VRMLNodeDesc::use ( FieldContainerPtr   )  [virtual, inherited]

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 560 of file OSGVRMLNodeDescs.cpp.

Referenced by osg::VRMLFile::use().

00561 {
00562     return false;
00563 }


Member Data Documentation

Definition at line 1183 of file OSGVRMLNodeDescs.h.

Referenced by prototypeAddField().

Definition at line 1184 of file OSGVRMLNodeDescs.h.

Referenced by beginNode(), and prototypeAddField().

Definition at line 1185 of file OSGVRMLNodeDescs.h.

Referenced by beginNode(), and prototypeAddField().

Definition at line 1187 of file OSGVRMLNodeDescs.h.

Referenced by beginNode(), endNode(), and getFieldAndDesc().

Definition at line 1188 of file OSGVRMLNodeDescs.h.

Referenced by beginNode(), endNode(), and getFieldAndDesc().

Definition at line 1189 of file OSGVRMLNodeDescs.h.

Referenced by beginNode(), endNode(), and getFieldAndDesc().

UInt32 VRMLNodeDesc::_uiIndent = 0 [static, protected, inherited]

Definition at line 307 of file OSGVRMLNodeDescs.h.

Field* osg::VRMLNodeDesc::_pCurrField [protected, inherited]

std::string osg::VRMLNodeDesc::_szCurrentName [protected, inherited]

bool osg::VRMLNodeDesc::_bSaveOnEnd [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:05:20 2008 for OpenSG by  doxygen 1.5.5