Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // (C) 2011 Tim Gurto
- #ifndef GEOMETRY_H
- #define GEOMETRY_H
- #include <map>
- #include "d3d_wrappers.h"
- #include "Shape.h"
- typedef std::map<int, Shape> shapesIndex_t;
- //Maintains a contiguous list of "shapes" (sets of vertices),
- //which can be independently transformed or removed.
- class Geometry{
- const static size_t ARRAY_CHUNK_SIZE;
- const static size_t VERTEX_BUFFER_SIZE;
- //a directory of shapes within the array
- shapesIndex_t shapesIndex_;
- //next shape index; removed shapes' indices are not reclaimed
- int nextIndex_;
- //the vertex array
- CUSTOMVERTEX *array_;
- size_t
- arraySize_,
- totalVertices_;
- public:
- Geometry(LPDIRECT3DVERTEXBUFFER9 *vertexBuffer = 0);
- ~Geometry();
- int addShape(CUSTOMVERTEX* start, size_t size, D3DMATERIAL9 *material = 0); //returns index
- void removeShape(int index);
- //copies vertices into the buffer
- void pushBuffer() const;
- //renders geometry
- void render() const;
- //transform shape
- void translate(int index, float x, float y);
- void rotate(int index, double angle);
- void scale(int index, float x, float y);
- //debugging
- void printShapes() const;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement