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

📄 cartoon.cpp

📁 最新osg包
💻 CPP
字号:
/********************************************************************** * *    FILE:           Cartoon.cpp * *    DESCRIPTION:    Read/Write osgFX::Cartoon in binary format to disk. * *    CREATED BY:     Liang Aibin * *    HISTORY:        Created 23.8.2008 * **********************************************************************/#include "Exception.h"#include "Cartoon.h"#include "Effect.h"using namespace ive;void Cartoon::write(DataOutputStream* out){    // Write Cartoon's identification.    out->writeInt(IVECARTOON);    // 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("Cartoon::write(): Could not cast this osgFX::Cartoon to an osgFX::Effect.");    // Write Cartoon's properties.    out->writeVec4(getOutlineColor());    out->writeFloat(getOutlineLineWidth());    out->writeInt(getLightNumber());}void Cartoon::read(DataInputStream* in){    // Peek on Cartoon's identification.    int id = in->peekInt();    if(id == IVECARTOON){        // Read Cartoon'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("Cartoon::read(): Could not cast this osgFX::Cartoon to an osgFX::Effect.");        // Read Cartoon's properties        setOutlineColor(in->readVec4());        setOutlineLineWidth(in->readFloat());        setLightNumber(in->readInt());    }    else{        throw Exception("Cartoon::read(): Expected Cartoon identification.");    }}

⌨️ 快捷键说明

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