Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __3D_RENDER_OBJECT__
- #define __3D_RENDER_OBJECT__
- #include <string>
- #include "../core/array.h"
- #include "../core/vectors.h"
- #include "renderer.h"
- #include "bufferObject.h"
- #include "surface.h"
- #include "../math/matrix.h"
- namespace FWrender {
- typedef vec3float verticies_t; // simplifcation
- typedef vec3float normals_t;
- typedef vec3ushort meshes_t;
- class mesh {
- protected:
- array_t<verticies_t> vertList; // mesh data
- array_t<meshes_t> meshList; // .
- array_t<normals_t> normList; // *
- array_t<texUV_t> uvList; // o
- std::string name;
- FWrender::vbo_create * global_vbo;
- public:
- mesh();
- virtual ~mesh();
- // push
- unsigned int pushVert(verticies_t* vert, unsigned int len);
- unsigned int pushMesh(meshes_t* mesh, unsigned int len, unsigned int offset);
- unsigned int pushTextureUV(texUV_t* texuv, unsigned int len);
- //void pushNormals(normals_t* norm, unsigned int len);
- //get
- void getVertV(verticies_t *&ptr, unsigned int &len);
- void getMeshV(meshes_t *&ptr, unsigned int &len);
- void getNormV(normals_t *&ptr, unsigned int &len);
- void getTexuvV(texUV_t *&ptr, unsigned int &len);
- // build
- void calcNormals(); // simply calc normals (retuns if already done)
- void calcNormals(bool forced); // force normal calculating if true.
- void buildArray(); // Builds arrays
- void buildVertArray(); // Builds vertex array only
- //draw
- void draw();
- void drawmesh(unsigned short* mesh, unsigned int len);
- //delete
- void deleteArray();
- };
- class modelSurface{
- private:
- FWrender::material mat;
- FWrender::texture *tex;
- array_t<meshes_t> meshList;
- array_t<meshes_t> faceList;
- public:
- modelSurface();
- ~modelSurface();
- //set
- //void setMaterial(FWrender::material &m);
- void setMaterial(FWrender::material *m);
- //void setTexture(FWrender::texture &t);
- void setTexture(FWrender::texture *t);
- //void setTexture(FWrender::texture &t, int layer);
- void setTexture(FWrender::texture *t, int layer);
- void pushFaceList(unsigned short *faces, int len);
- //get
- void getMeshV(meshes_t *&ptr, unsigned int &len);
- //build
- void buildMeshArray(meshes_t *ptr);
- //draw/bind
- void bind();
- void unbind();
- };
- class model : public mesh{
- private:
- array_t<modelSurface> surfaces;
- FWmath::localCoord_t modelview;
- public:
- model();
- virtual ~model();
- //set
- void insertSurface();
- void setTexture(int num, FWrender::texture &t, int layer);
- void setTexture(int num, FWrender::texture *t, int layer);
- void setMaterial(int num, FWrender::material &m);
- void setMaterial(int num, FWrender::material *m);
- //get
- //draw
- void draw();
- //..
- void fetchDeleteArray();
- };
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement