vertexprogram.cpp

来自「最新osg包」· C++ 代码 · 共 69 行

CPP
69
字号
/********************************************************************** * *    FILE:            VertexProgram.cpp * *    DESCRIPTION:    Read/Write osg::VertexProgram in binary format to disk. * *    CREATED BY:     rpk@blue-newt.com * *    HISTORY:        Created 04/20/2004 * *    Copyright 2004 Blue Newt Software **********************************************************************/#include "Exception.h"#include "VertexProgram.h"#include "Object.h"using namespace ive;void VertexProgram::write( DataOutputStream* out ){    // Write VertexProgram identification.    out->writeInt( IVEVERTEXPROGRAM );    // 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("Material::write(): Could not cast this osg::VertexProgram to an osg::Object.");    }    // Write VertexProgram properties.    // Write program.    out->writeString( this->getVertexProgram() );}void VertexProgram::read(DataInputStream* in){    // Read VertexProgram identification.    int id = in->peekInt();    if( id == IVEVERTEXPROGRAM )    {        // Code to read VertexProgram properties.        id = in->readInt();        // handle Object data        osg::Object*  obj = dynamic_cast<osg::Object*>(this);        if( obj )        {            ( ( ive::Object* )( obj ) )->read( in );        }        else        {            throw Exception( "Material::read(): Could not cast this osg::VertexProgram to an osg::Object." );        }        // Read data        std::string fp = in->readString();        this->setVertexProgram( fp );    }    else    {        throw Exception("VertexProgram::read(): Expected VertexProgram identification.");    }}

⌨️ 快捷键说明

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