/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _OPENGLMETAFILESTREAM_INCLUDED_ #define _OPENGLMETAFILESTREAM_INCLUDED_ #include "MetafileStreamBase.h" #include "PseudoGLDefs.h" /** \details Library: Source code provided. */ class OdOpenGLMetafileInputStream : public OdBaseMetafileInputStream { public: /** \details Default constructor for the OdOpenGLMetafileInputStream class. */ OdOpenGLMetafileInputStream() : OdBaseMetafileInputStream() { } /** \details Constructor for the OdOpenGLMetafileInputStream class. \param pIO [in] Pointer to the OdBaseMetafileContainerIOBase instance. */ OdOpenGLMetafileInputStream(OdBaseMetafileContainerIOBase *pIO) : OdBaseMetafileInputStream(pIO) { } // Read OpenGL types #define READ_TYPE_DEF(type) \ type rVal; \ read(&rVal, sizeof(type)); \ return rVal /** \details Reads a value of the OdGLenum type. \returns Read OdGLenum value. */ OdGLenum readGLenum() const { READ_TYPE_DEF(OdGLenum); } /** \details Reads a value of the OdGLboolean type. \returns Read OdGLboolean value. */ OdGLboolean readGLboolean() const { READ_TYPE_DEF(OdGLboolean); } /** \details Reads a value of the OdGLbyte type. \returns Read OdGLbyte value. */ OdGLbyte readGLbyte() const { READ_TYPE_DEF(OdGLbyte); } /** \details Reads a value of the OdGLshort type. \returns Read OdGLshort value. */ OdGLshort readGLshort() const { READ_TYPE_DEF(OdGLshort); } /** \details Reads a value of the OdGLint type. \returns Read OdGLint value. */ OdGLint readGLint() const { READ_TYPE_DEF(OdGLint); } /** \details Reads a value of the OdGLubyte type. \returns Read OdGLubyte value. */ OdGLubyte readGLubyte() const { READ_TYPE_DEF(OdGLubyte); } /** \details Reads a value of the OdGLushort type. \returns Read OdGLushort value. */ OdGLushort readGLushort() const { READ_TYPE_DEF(OdGLushort); } /** \details Reads a value of the OdGLuint type. \returns Read OdGLuint value. */ OdGLuint readGLuint() const { READ_TYPE_DEF(OdGLuint); } /** \details Reads a value of the OdGLfloat type. \returns Read OdGLfloat value. */ OdGLfloat readGLfloat() const { READ_TYPE_DEF(OdGLfloat); } /** \details Reads a value of the OdGLdouble type. \returns Read OdGLdouble value. */ OdGLdouble readGLdouble() const { READ_TYPE_DEF(OdGLdouble); } #undef READ_TYPE_DEF // Read OpenGL arrays #define READ_ARRAY_DEF(type) \ read(pVal, nSize * sizeof(type)) /** \details Reads an array of values of the OdGLenum type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLenumArray(OdGLenum *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLenum); } /** \details Reads an array of values of the OdGLboolean type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLbooleanArray(OdGLboolean *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLboolean); } /** \details Reads an array of values of the OdGLbyte type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLbyteArray(OdGLbyte *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLbyte); } /** \details Reads an array of values of the OdGLshort type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLshortArray(OdGLshort *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLshort); } /** \details Reads an array of values of the OdGLint type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLintArray(OdGLint *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLint); } /** \details Reads an array of values of the OdGLubyte type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLubyteArray(OdGLubyte *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLubyte); } /** \details Reads an array of values of the OdGLushort type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLushortArray(OdGLushort *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLushort); } /** \details Reads an array of values of the OdGLuint type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLuintArray(OdGLuint *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLuint); } /** \details Reads an array of values of the OdGLfloat type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLfloatArray(OdGLfloat *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLfloat); } /** \details Reads an array of values of the OdGLdouble type. \param pVal [out] Pointer to an array of read values. \param nSize [in] Number of values to read. */ void readGLdoubleArray(OdGLdouble *pVal, OdUInt32 nSize) const { READ_ARRAY_DEF(OdGLdouble); } #undef READ_ARRAY_DEF }; /** \details Library: Source code provided. */ class OdOpenGLMetafileOutputStream : public OdBaseMetafileOutputStream { public: /** \details Default constructor for the OdOpenGLMetafileOutputStream class. */ OdOpenGLMetafileOutputStream() : OdBaseMetafileOutputStream() { } /** \details Constructor for the OdOpenGLMetafileOutputStream class. \param pIO [in] Pointer to the OdBaseMetafileContainerIOBase instance. */ OdOpenGLMetafileOutputStream(OdBaseMetafileContainerIOBase *pIO) : OdBaseMetafileOutputStream(pIO) { } // Write OpenGL types #define WRITE_TYPE_DEF(type) \ write(&value, sizeof(type)) /** \details Writes a value of the OdGLenum type. \param value [in] Value to write. */ void writeGLenum(OdGLenum value) { WRITE_TYPE_DEF(OdGLenum); } /** \details Writes a value of the OdGLboolean type. \param value [in] Value to write. */ void writeGLboolean(OdGLboolean value) { WRITE_TYPE_DEF(OdGLboolean); } /** \details Writes a value of the OdGLbyte type. \param value [in] Value to write. */ void writeGLbyte(OdGLbyte value) { WRITE_TYPE_DEF(OdGLbyte); } /** \details Writes a value of the OdGLshort type. \param value [in] Value to write. */ void writeGLshort(OdGLshort value) { WRITE_TYPE_DEF(OdGLshort); } /** \details Writes a value of the OdGLint type. \param value [in] Value to write. */ void writeGLint(OdGLint value) { WRITE_TYPE_DEF(OdGLint); } /** \details Writes a value of the OdGLubyte type. \param value [in] Value to write. */ void writeGLubyte(OdGLubyte value) { WRITE_TYPE_DEF(OdGLubyte); } /** \details Writes a value of the OdGLushort type. \param value [in] Value to write. */ void writeGLushort(OdGLushort value) { WRITE_TYPE_DEF(OdGLushort); } /** \details Writes a value of the OdGLuint type. \param value [in] Value to write. */ void writeGLuint(OdGLuint value) { WRITE_TYPE_DEF(OdGLuint); } /** \details Writes a value of the OdGLfloat type. \param value [in] Value to write. */ void writeGLfloat(OdGLfloat value) { WRITE_TYPE_DEF(OdGLfloat); } /** \details Writes a value of the OdGLdouble type. \param value [in] Value to write. */ void writeGLdouble(OdGLdouble value) { WRITE_TYPE_DEF(OdGLdouble); } #undef WRITE_TYPE_DEF // Write OpenGL arrays #define WRITE_ARRAY_DEF(type) \ write(pVal, nSize * sizeof(type)) /** \details Writes an array of values of the OdGLenum type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLenumArray(const OdGLenum *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLenum); } /** \details Writes an array of values of the OdGLboolean type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLbooleanArray(const OdGLboolean *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLboolean); } /** \details Writes an array of values of the OdGLbyte type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLbyteArray(const OdGLbyte *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLbyte); } /** \details Writes an array of values of the OdGLshort type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLshortArray(const OdGLshort *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLshort); } /** \details Writes an array of values of the OdGLint type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLintArray(const OdGLint *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLint); } /** \details Writes an array of values of the OdGLubyte type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLubyteArray(const OdGLubyte *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLubyte); } /** \details Writes an array of values of the OdGLushort type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLushortArray(const OdGLushort *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLushort); } /** \details Writes an array of values of the OdGLuint type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLuintArray(const OdGLuint *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLuint); } /** \details Writes an array of values of the OdGLfloat type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLfloatArray(const OdGLfloat *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLfloat); } /** \details Writes an array of values of the OdGLdouble type. \param pVal [in] Pointer to an array of values to write. \param nSize [in] Number of values to write. */ void writeGLdoubleArray(const OdGLdouble *pVal, OdUInt32 nSize) { WRITE_ARRAY_DEF(OdGLdouble); } #undef WRITE_ARRAY_DEF }; #endif // _OPENGLMETAFILESTREAM_INCLUDED_