⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lightsource.cpp

📁 最新osg包
💻 CPP
字号:
/********************************************************************** * *    FILE:            LightSource.cpp * *    DESCRIPTION:    Read/Write osg::LightSource in binary format to disk. * *    CREATED BY:        Auto generated by iveGenerated *                    and later modified by Rune Schmidt Jensen. * *    HISTORY:        Created 21.3.2003 * *    Copyright 2003 VR-C **********************************************************************/#include "Exception.h"#include "LightSource.h"#include "Group.h"#include "Light.h"using namespace ive;void LightSource::write(DataOutputStream* out){    // Write LightSource's identification.    out->writeInt(IVELIGHTSOURCE);    // If the osg class is inherited by any other class we should also write this to file.    osg::Group*  group = dynamic_cast<osg::Group*>(this);    if(group){        ((ive::Group*)(group))->write(out);    }    else        throw Exception("LightSource::write(): Could not cast this osg::LightSource to an osg::Group.");    // Write LightSource's properties.    // Write out light    out->writeBool(getLight()!=0);    if(getLight())        {        ((ive::Light*)(getLight()))->write(out);    }    // Write reference frame    out->writeInt((int)getReferenceFrame());}void LightSource::read(DataInputStream* in){    // Peek on LightSource's identification.    int id = in->peekInt();    if(id == IVELIGHTSOURCE){        // Read LightSource's identification.        id = in->readInt();        // If the osg class is inherited by any other class we should also read this from file.        osg::Group*  group = dynamic_cast<osg::Group*>(this);        if(group){            ((ive::Group*)(group))->read(in);        }        else            throw Exception("LightSource::read(): Could not cast this osg::LightSource to an osg::Object.");        // Read LightSource's properties        // Read light        if(in->readBool()){            osg::Light* light = new osg::Light();            ((ive::Light*)(light))->read(in);            setLight(light);        }        // Read reference frame        setReferenceFrame((osg::LightSource::ReferenceFrame) in->readInt());    }    else{        throw Exception("LightSource::read(): Expected LightSource identification.");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -