Show chunk.h syntax highlighted
/***************************************************************************
chunk.h - ABT room chunk
-------------------
begin : Thu Feb 08 2005
copyright : (C) 2005 by Anders Dahnielson
email : anderss@dahnnielson.com
***************************************************************************
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
***************************************************************************/
#ifndef __NEOABT_CHUNK_H
#define __NEOABT_CHUNK_H
/**
* \file neoabt/chunk.h
* ABT room chunk
*/
#include "base.h"
#ifdef HAVE_NEOCHUNKIO
#include <neochunkio/room.h>
#include <neoengine/vertexbuffer.h>
#include <neoengine/polygonbuffer.h>
#include <neoengine/material.h>
#include <vector>
namespace NeoABT
{
/**
* \brief Chunk type identifier class with builtin chunk type identifiers
* \author Anders Dahnielson (anders@dahnielson.com)
**/
class NEOABT_API ABTChunkType
{
public:
/**
* \enum CHUNKTYPE
* \brief Builtin chunk type identifiers and string identifiers
*/
enum CHUNKTYPE
{
ABTROOM = 0x20a3, // "abt"
ABTGEOM = 0x20e0 // "abtgeom"
};
};
/**
* \brief ABT geometry chunk
* \author Anders Dahnielson (anders@dahnielson.com)
**/
class NEOABT_API ABTGeometryChunk : public NeoChunkIO::ComplexChunk
{
public:
/*! Vertex buffer index */
int m_iVertexBuffer;
/*! Polygon buffer */
NeoEngine::PolygonBufferPtr m_pkPolygonBuffer;
/*! Material */
NeoEngine::MaterialPtr m_pkMaterial;
/**
* Initialize chunk
* \param usType Chunk type
* \param rstrType Chunk type as string
* \param rstrID Chunk ID string
*/
ABTGeometryChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : NeoChunkIO::ComplexChunk( usType, rstrType, rstrID ) {}
/**
* Deallocate data and subchunks
*/
virtual ~ABTGeometryChunk() {}
/**
* Parse chunk data
* \param uiFlags Parse flags
* \param pkFileManager File manager
* \return <0 if error, >0 if successful (0 reserved)
*/
virtual int ParseData( unsigned int uiFlags, NeoEngine::FileManager *pkFileManager );
/**
* Allocate new chunk
* \param usType Type identifier
* \param rstrType Type identifier as string
* \param rstrID ID string
* \return New chunk
*/
static NeoChunkIO::Chunk *Allocator( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID ) { return new ABTGeometryChunk( usType, rstrType, rstrID ); }
};
/**
* \brief Room chunk
* \author Anders Dahnielson (anders@dahnielson.com)
**/
class NEOABT_API ABTRoomChunk : public NeoChunkIO::RoomChunk
{
public:
/*! All vertex buffers */
std::vector< NeoEngine::VertexBufferPtr > m_vpkVertexBuffers;
/**
* Initialize chunk
* \param usType Chunk type
* \param rstrType Chunk type as string
* \param rstrID Chunk ID string
*/
ABTRoomChunk( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID = "" ) : NeoChunkIO::RoomChunk( usType, rstrType, rstrID ) {}
/**
* Setup chunk with default values
* \param rstrID Chunk ID string, default empty
*/
ABTRoomChunk( const NeoEngine::HashString &rstrID = "" ) : NeoChunkIO::RoomChunk( ABTChunkType::ABTROOM, "abt", rstrID ) {}
/**
* Deallocate data and subchunks
*/
virtual ~ABTRoomChunk() {}
/**
* Parse chunk data
* \param uiFlags Parse flags
* \param pkFileManager File manager
* \return <0 if error, >0 if successful (0 reserved)
*/
virtual int ParseData( unsigned int uiFlags, NeoEngine::FileManager *pkFileManager );
/**
* Allocate new chunk
* \param usType Type identifier
* \param rstrType Type identifier as string
* \param rstrID ID string
* \return New chunk
*/
static NeoChunkIO::Chunk *Allocator( unsigned short usType, const NeoEngine::HashString &rstrType, const NeoEngine::HashString &rstrID ) { return new ABTRoomChunk( usType, rstrType, rstrID ); }
};
};
#endif
#endif
See more files for this project here