mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Added documentation
This commit is contained in:
parent
42c9480271
commit
c5171eb673
@ -6,6 +6,9 @@
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
/**
|
||||
* Data used by Object Instances
|
||||
*/
|
||||
struct ObjectData
|
||||
{
|
||||
uint16_t ID;
|
||||
@ -38,6 +41,9 @@ struct ObjectData
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Data used by vehicles
|
||||
*/
|
||||
struct CarData
|
||||
{
|
||||
enum VehicleClass
|
||||
@ -83,6 +89,9 @@ struct CarData
|
||||
float wheelScale; // used only when type == CAR
|
||||
};
|
||||
|
||||
/**
|
||||
* Data used by peds
|
||||
*/
|
||||
struct CharacterData
|
||||
{
|
||||
uint16_t ID;
|
||||
|
@ -15,8 +15,7 @@ class Animator;
|
||||
class GameWorld;
|
||||
|
||||
/**
|
||||
* @brief The GTAObject struct
|
||||
* Stores data that is relevant to all types of objects.
|
||||
* Stores data used by call types of object instances.
|
||||
*/
|
||||
struct GTAObject
|
||||
{
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
/**
|
||||
* Vehicle handling data
|
||||
*/
|
||||
struct VehicleHandlingInfo
|
||||
{
|
||||
enum EngineType
|
||||
|
@ -4,6 +4,10 @@
|
||||
#include <GL/glew.h>
|
||||
|
||||
class GeometryBuffer;
|
||||
|
||||
/**
|
||||
* DrawBuffer stores VAO state
|
||||
*/
|
||||
class DrawBuffer {
|
||||
GLuint vao;
|
||||
|
||||
|
@ -14,6 +14,12 @@ class GameWorld;
|
||||
class GTAObject;
|
||||
class Animator;
|
||||
|
||||
/**
|
||||
* Renderer
|
||||
*
|
||||
* Handles low level rendering of Models, as well as high level rendering of
|
||||
* objects in the world.
|
||||
*/
|
||||
class GTARenderer
|
||||
{
|
||||
GameWorld* engine;
|
||||
@ -46,6 +52,7 @@ public:
|
||||
size_t rendered;
|
||||
size_t culled;
|
||||
|
||||
/* TODO clean up all these variables */
|
||||
GLint uniModel, uniProj, uniView, uniCol, uniAmbientCol, uniSunDirection, uniDynamicCol;
|
||||
GLint uniMatDiffuse, uniMatAmbient, uniFogStart, uniFogEnd;
|
||||
GLuint worldProgram;
|
||||
@ -59,7 +66,7 @@ public:
|
||||
GLuint debugTex;
|
||||
|
||||
/**
|
||||
* @brief renderWorld renders the world.
|
||||
* Renders the current World.
|
||||
*/
|
||||
void renderWorld();
|
||||
|
||||
@ -67,10 +74,13 @@ public:
|
||||
|
||||
void renderGeometry(Model*, size_t geom, const glm::mat4& modelMatrix, GTAObject* = nullptr);
|
||||
|
||||
/**
|
||||
* Renders a model (who'd have thought)
|
||||
*/
|
||||
void renderModel(Model*, const glm::mat4& modelMatrix, GTAObject* = nullptr, Animator* animator = nullptr);
|
||||
|
||||
/**
|
||||
* @brief renderPaths renders the AI paths.
|
||||
* Debug method renders all AI paths
|
||||
*/
|
||||
void renderPaths();
|
||||
};
|
||||
|
@ -27,6 +27,9 @@ struct AttributeIndex {
|
||||
|
||||
typedef std::vector<AttributeIndex> AttributeList;
|
||||
|
||||
/**
|
||||
* GeometryBuffer stores a set of vertex attribute data
|
||||
*/
|
||||
class GeometryBuffer {
|
||||
GLuint vbo;
|
||||
GLsizei num;
|
||||
@ -42,6 +45,9 @@ public:
|
||||
|
||||
/**
|
||||
* Uploads Vertex Buffer data from an STL vector
|
||||
*
|
||||
* vertex_attributes() is assumed to exist so that vertex types
|
||||
* can implicitly declare the strides and offsets for their data.
|
||||
*/
|
||||
template<class T> void uploadVertices(const std::vector<T>& data) {
|
||||
uploadVertices(data.size(), data.size()*sizeof(T), data.data());
|
||||
|
@ -11,17 +11,10 @@
|
||||
#include "DrawBuffer.hpp"
|
||||
#include "GeometryBuffer.hpp"
|
||||
|
||||
/**
|
||||
* Frame
|
||||
* => Atomic
|
||||
* => Geometry
|
||||
* - defaultRotation
|
||||
* - defaultTranslation
|
||||
*
|
||||
* + setTransform(mat)
|
||||
* + resetTransform()
|
||||
*/
|
||||
|
||||
/**
|
||||
* ModelFrame stores the hierarchy of a model's geometry as well as default
|
||||
* transformations.
|
||||
*/
|
||||
class ModelFrame {
|
||||
glm::mat3 defaultRotation;
|
||||
glm::vec3 defaultTranslation;
|
||||
@ -65,6 +58,10 @@ public:
|
||||
{ return geometries; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Model stores all the data contained within a DFF, as well as data required
|
||||
* to render them.
|
||||
*/
|
||||
class Model
|
||||
{
|
||||
public:
|
||||
@ -108,6 +105,7 @@ public:
|
||||
glm::vec2 texcoord; /* 48 */
|
||||
glm::vec4 colour; /* 64 */
|
||||
|
||||
/** @see GeometryBuffer */
|
||||
static const AttributeList vertex_attributes() {
|
||||
return {
|
||||
{ATRS_Position, 3, sizeof(GeometryVertex), 0ul},
|
||||
@ -145,9 +143,7 @@ public:
|
||||
};
|
||||
|
||||
std::vector<ModelFrame*> frames;
|
||||
|
||||
std::vector<std::string> frameNames;
|
||||
|
||||
/** @TODO clean up this mess a little */
|
||||
std::vector<std::shared_ptr<Geometry>> geometries;
|
||||
std::vector<Atomic> atomics;
|
||||
|
||||
|
@ -52,13 +52,9 @@ Model* LoaderDFF::loadFromMemory(char *data, GameData *gameData)
|
||||
std::string framename(extSec.raw(), extSec.header.size);
|
||||
std::transform(framename.begin(), framename.end(), framename.begin(), ::tolower );
|
||||
|
||||
// !HACK!
|
||||
if(framename == "swaist") {
|
||||
model->rootFrameIdx = model->frameNames.size();
|
||||
}
|
||||
|
||||
if( fn < model->frames.size() ) {
|
||||
model->frames[(fn++)]->setName(framename);
|
||||
model->frames[fn]->setName(framename);
|
||||
fn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user