# Changes 0.2.4-1
- Add GIT_BRANCH (for development and stable) - Write Documentation of - pd-core (exept of vec.hpp) - pd-app - pd-drivers - pd-lib3ds - pd-image - pd-image - pd-ui7
This commit is contained in:
		| @@ -25,19 +25,25 @@ SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| #include <pd/core/common.hpp> | ||||
| #include <pd/core/vec.hpp> | ||||
| #include <pd/lithium/flags.hpp> | ||||
| #include <pd/lithium/texture.hpp> | ||||
| #include <pd/lithium/vertex.hpp> | ||||
| #include <pd/core/vec.hpp> | ||||
|  | ||||
| namespace PD { | ||||
| namespace LI { | ||||
| /// @brief Reform the Drawcommand by generating the Vertexbuffer into it | ||||
| /** | ||||
|  * Lithium Draw Command (containing a list of vertex and index data | ||||
|  * only for this specific command itself) | ||||
|  */ | ||||
| class Command : public SmartCtor<Command> { | ||||
|  public: | ||||
|   Command() {} | ||||
|   ~Command() {} | ||||
|   Command() = default; | ||||
|   ~Command() = default; | ||||
|  | ||||
|   /** | ||||
|    * Copy Constructor [to Copy the Data of a Command Reference] | ||||
|    */ | ||||
|   Command(Command::Ref v) { | ||||
|     this->index = v->index; | ||||
|     this->index_buf = v->index_buf; | ||||
| @@ -47,58 +53,140 @@ class Command : public SmartCtor<Command> { | ||||
|     this->vertex_buf = v->vertex_buf; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Setter for the Commands layer | ||||
|    * @param v layer value | ||||
|    * @return command reference | ||||
|    */ | ||||
|   Command& Layer(int v) { | ||||
|     layer = v; | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Getter for the Layer | ||||
|    * @return layer value | ||||
|    */ | ||||
|   int Layer() const { return layer; } | ||||
|  | ||||
|   /** | ||||
|    * Setter for the Commands Index [used in sorting] | ||||
|    * @param v index value | ||||
|    * @return command reference | ||||
|    */ | ||||
|   Command& Index(int v) { | ||||
|     index = v; | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Getter for the Index | ||||
|    * @return index value | ||||
|    */ | ||||
|   int Index() const { return index; } | ||||
|  | ||||
|   /** | ||||
|    * Setter for the Commands Texture | ||||
|    * @param v Texture reference | ||||
|    * @return command reference | ||||
|    */ | ||||
|   Command& Tex(Texture::Ref v) { | ||||
|     tex = v; | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Getter for the Texture reference | ||||
|    * @return Texture reference | ||||
|    */ | ||||
|   Texture::Ref Tex() const { return tex; } | ||||
|  | ||||
|   /** | ||||
|    * Function to Push a Vertex to the vertexbuffer | ||||
|    * @param v Vertex to push | ||||
|    * @return command reference | ||||
|    */ | ||||
|   Command& PushVertex(const Vertex& v) { | ||||
|     vertex_buf.push_back(v); | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Access to the Index list [used to write index data | ||||
|    * to the real indexbuffer] | ||||
|    * @return const reference to commands idx buffer | ||||
|    */ | ||||
|   const std::vector<u16>& IndexList() const { return index_buf; } | ||||
|   /** | ||||
|    * Access to the Vertex list [used to write vertices | ||||
|    * data to the real vertexbuffer] | ||||
|    * @return const reference to commands vertex buffer | ||||
|    */ | ||||
|   const std::vector<Vertex>& VertexList() const { return vertex_buf; } | ||||
|  | ||||
|   /// ADVANCED /// | ||||
|   // ADVANCED | ||||
|  | ||||
|   /** | ||||
|    * Advanced function to access index list | ||||
|    * | ||||
|    * - This function is UNSAFE to use cause it allows to modify index data | ||||
|    * @return reference to index list | ||||
|    */ | ||||
|   std::vector<u16>& IndexList() { return index_buf; } | ||||
|   /** | ||||
|    * Advanced function to access vertex list | ||||
|    * | ||||
|    * - This function is UNSAFE to use cause it allows to modify index data | ||||
|    * - Using this in StaticText to change Position color and stuff after it is | ||||
|    *   rendered into commands | ||||
|    * @return reference to vertex list | ||||
|    */ | ||||
|   std::vector<Vertex>& VertexList() { return vertex_buf; } | ||||
|  | ||||
|   /** | ||||
|    * Function to Push an index value to indexbuffer | ||||
|    * @param v Index value | ||||
|    * @return command reference | ||||
|    */ | ||||
|   Command& PushIndex(u16 v) { | ||||
|     index_buf.push_back(vertex_buf.size() + v); | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Setter for the Commands RenderMode | ||||
|    * @param v RenderMode | ||||
|    * @return command reference | ||||
|    */ | ||||
|   Command& Rendermode(const RenderMode& v) { | ||||
|     mode = v; | ||||
|     return *this; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Getter for the Commands RenderMode | ||||
|    * @return RenderMode | ||||
|    */ | ||||
|   RenderMode Rendermode() const { return mode; } | ||||
|  | ||||
|  private: | ||||
|   /// Using Default std::vector here | ||||
|   /** | ||||
|    * Vertex Buffer | ||||
|    * | ||||
|    * - Using default vector here as its data will be copied later | ||||
|    */ | ||||
|   std::vector<Vertex> vertex_buf; | ||||
|   /** | ||||
|    * Index Buffer | ||||
|    * | ||||
|    * - Using default vector here as its data will be copied later | ||||
|    */ | ||||
|   std::vector<u16> index_buf; | ||||
|   /** Layer */ | ||||
|   int layer; | ||||
|   /** Texture Reference */ | ||||
|   Texture::Ref tex; | ||||
|   /** Index */ | ||||
|   int index; | ||||
|   /** RenderMode (Default to RenderMode_RGBA) */ | ||||
|   RenderMode mode = RenderMode_RGBA; | ||||
| }; | ||||
| }  // namespace LI | ||||
|   | ||||
		Reference in New Issue
	
	Block a user