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

📄 blendfunc.cpp

📁 最新osg包
💻 CPP
字号:
/********************************************************************** * *    FILE:            BlendFunc.cpp * *    DESCRIPTION:    Read/Write osg::BlendFunc 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 "BlendFunc.h"#include "Object.h"using namespace ive;void BlendFunc::write(DataOutputStream* out){    bool bSeparate = getSource() != getSourceAlpha() || getDestination() != getDestinationAlpha();    // Write BlendFunc's identification.    out->writeInt(bSeparate ? IVEBLENDFUNCSEPARATE : IVEBLENDFUNC);    // If the osg class is inherited by any other class we should also write this to file.    osg::Object*  obj = dynamic_cast<osg::Object*>(this);    if(obj){        ((ive::Object*)(obj))->write(out);    }    else        throw Exception("BlendFunc::write(): Could not cast this osg::BlendFunc to an osg::Object.");    // Write BlendFunc's properties.    // Write source    out->writeInt(getSource());    // Write destination    out->writeInt(getDestination());    if (bSeparate)    {        // Write source alpha        out->writeInt(getSourceAlpha());        // Write destination alpha        out->writeInt(getDestinationAlpha());    }}void BlendFunc::read(DataInputStream* in){    // Peek on BlendFunc's identification.    int id = in->peekInt();    if(id == IVEBLENDFUNC || id == IVEBLENDFUNCSEPARATE){        // Read BlendFunc's identification.        id = in->readInt();        // If the osg class is inherited by any other class we should also read this from file.        osg::Object*  obj = dynamic_cast<osg::Object*>(this);        if(obj){            ((ive::Object*)(obj))->read(in);        }        else            throw Exception("BlendFunc::read(): Could not cast this osg::BlendFunc to an osg::Object.");        // Read BlendFunc's properties        // Read source        setSource((GLenum)in->readInt());        // Read destination        setDestination((GLenum)in->readInt());        if (id == IVEBLENDFUNCSEPARATE)        {            // Read source alpha            setSourceAlpha((GLenum)in->readInt());            // Read destination alpha            setDestinationAlpha((GLenum)in->readInt());        }    }    else{        throw Exception("BlendFunc::read(): Expected BlendFunc identification.");    }}

⌨️ 快捷键说明

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