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

📄 drawelementsushort.cpp

📁 最新osg包
💻 CPP
字号:
/********************************************************************** * *    FILE:            DrawElementsUShort.cpp * *    DESCRIPTION:    Read/Write osg::DrawElementsUShort in binary format to disk. * *    CREATED BY:        Auto generated by iveGenerated *                    and later modified by Rune Schmidt Jensen. * *    HISTORY:        Created 20.3.2003 * *    Copyright 2003 VR-C **********************************************************************/#include "Exception.h"#include "DrawElementsUShort.h"#include "PrimitiveSet.h"#include <osg/Endian>using namespace ive;void DrawElementsUShort::write(DataOutputStream* out){    // Write DrawElementsUShort's identification.    out->writeInt(IVEDRAWELEMENTSUSHORT);    // If the osg class is inherited by any other class we should also write this to file.    osg::PrimitiveSet*  prim = dynamic_cast<osg::PrimitiveSet*>(this);    if(prim){        ((ive::PrimitiveSet*)(prim))->write(out);    }    else        throw Exception("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet.");    // Write DrawElementsUShort's properties.    // Write array length and its elements.    out->writeInt(size());    out->writeCharArray((const char*)&front(), size() * SHORTSIZE);}void DrawElementsUShort::read(DataInputStream* in){    // Read DrawElementsUShort's identification.    int id = in->peekInt();    if(id == IVEDRAWELEMENTSUSHORT){        // Code to read DrawElementsUShort's properties.        id = in->readInt();        // If the osg class is inherited by any other class we should also read this from file.        osg::PrimitiveSet*  prim = dynamic_cast<osg::PrimitiveSet*>(this);        if(prim){            ((ive::PrimitiveSet*)(prim))->read(in);        }        else            throw Exception("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet.");        // Read array length and its elements.        int size = in->readInt();        resize(size);        in->readCharArray((char*)&front(), size * SHORTSIZE);                if (in->_byteswap)        {           for (int i = 0 ; i < size ; i++ )           {              osg::swapBytes((char *)&((*this)[i]),SHORTSIZE) ;           }        }            }    else{        throw Exception("DrawElementsUShort::read(): Expected DrawElementsUShort identification.");    }}

⌨️ 快捷键说明

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