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

📄 anisotropiclighting.cpp

📁 最新osg包
💻 CPP
字号:
/********************************************************************** * *    FILE:           AnisotropicLighting.cpp * *    DESCRIPTION:    Read/Write osgFX::AnisotropicLighting in binary format to disk. * *    CREATED BY:     Liang Aibin * *    HISTORY:        Created 23.8.2008 * **********************************************************************/#include "Exception.h"#include "AnisotropicLighting.h"#include "Effect.h"using namespace ive;void AnisotropicLighting::write(DataOutputStream* out){    // Write AnisotropicLighting's identification.    out->writeInt(IVEANISOTROPICLIGHTING);    // If the osg class is inherited by any other class we should also write this to file.    osgFX::Effect*  effect = dynamic_cast<osgFX::Effect*>(this);    if(effect){        ((ive::Effect*)(effect))->write(out);    }    else        throw Exception("AnisotropicLighting::write(): Could not cast this osgFX::AnisotropicLighting to an osgFX::Effect.");    // Write AnisotropicLighting's properties.    out->writeImage(getLightingMap());    out->writeInt(getLightNumber());}void AnisotropicLighting::read(DataInputStream* in){    // Peek on AnisotropicLighting's identification.    int id = in->peekInt();    if(id == IVEANISOTROPICLIGHTING){        // Read AnisotropicLighting's identification.        id = in->readInt();        // If the osg class is inherited by any other class we should also read this from file.        osgFX::Effect*  effect = dynamic_cast<osgFX::Effect*>(this);        if(effect){            ((ive::Effect*)(effect))->read(in);        }        else            throw Exception("AnisotropicLighting::read(): Could not cast this osgFX::AnisotropicLighting to an osgFX::Effect.");        // Read AnisotropicLighting's properties        setLightingMap(in->readImage());        setLightNumber(in->readInt());    }    else{        throw Exception("AnisotropicLighting::read(): Expected AnisotropicLighting identification.");    }}

⌨️ 快捷键说明

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