Files
OpenSceneGraph/src/osgPlugins/bsp/VBSPGeometry.h
Robert Osfield bf8c3cc07e From Jason Daly, "This is a plugin (two, actually) that will allow OSG to load .bsp map files from Valve's Source Engine games (Half-Life 2, etc.). One plugin (called "vbsp" to distinguish it from the Quake 3 bsp loader) reads the .bsp file itself, and the other ("vtf") reads the texture files.
The set up for this to work is a bit more complex than most files, since the engine expects all files to be in a certain place, and it tends to mix case a lot.  I tried to explain everything in the VBSP_README.txt file."

This plugin has been integrated with the pre-exisiting bsp plugin.
2008-11-24 11:39:02 +00:00

55 lines
1.4 KiB
C++

#ifndef VBSP_GEOMETRY_H
#define VBSP_GEOMETRY_H
#include <osg/Array>
#include <osg/Geometry>
#include "VBSPReader.h"
namespace bsp
{
class VBSPGeometry
{
protected:
VBSPReader * vbsp_reader;
osg::ref_ptr<osg::Vec3Array> vertex_array;
osg::ref_ptr<osg::Vec3Array> normal_array;
osg::ref_ptr<osg::Vec2Array> texcoord_array;
osg::ref_ptr<osg::DrawArrayLengths> primitive_set;
osg::ref_ptr<osg::Vec3Array> disp_vertex_array;
osg::ref_ptr<osg::Vec3Array> disp_normal_array;
osg::ref_ptr<osg::Vec2Array> disp_texcoord_array;
osg::ref_ptr<osg::FloatArray> disp_vertex_attr_array;
osg::ref_ptr<osg::DrawElementsUInt> disp_primitive_set;
bool doesEdgeExist(int row, int col, int direction,
int vertsPerEdge);
osg::Vec3f getNormalFromEdges(int row, int col,
unsigned char edgeBits,
int firstVertex, int vertsPerEdge);
void createDispSurface(Face & face, DisplaceInfo & dispInfo);
public:
VBSPGeometry(VBSPReader * reader);
virtual ~VBSPGeometry();
void addFace(int faceIndex);
osg::ref_ptr<osg::Group> createGeometry();
};
}
#endif