diff engine/core/view/renderers/genericrenderer.h @ 583:47b49b9b0c0a

* Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands. * Added a triangle function to backends and genericrenderer, also added the functions to set an alpha value for geometric figures.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 07 Aug 2010 16:36:35 +0000
parents 16c2b3ee59ce
children a2dde16ddc62
line wrap: on
line diff
--- a/engine/core/view/renderers/genericrenderer.h	Tue Aug 03 13:57:12 2010 +0000
+++ b/engine/core/view/renderers/genericrenderer.h	Sat Aug 07 16:36:35 2010 +0000
@@ -92,7 +92,7 @@
 	class GenericRendererLineInfo : public GenericRendererElementInfo {
 	public:
 		void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
-		GenericRendererLineInfo(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b);
+		GenericRendererLineInfo(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
 		virtual ~GenericRendererLineInfo() {};
 	private:
 		GenericRendererNode m_edge1;
@@ -100,22 +100,38 @@
 		uint8_t m_red;
 		uint8_t m_green;
 		uint8_t m_blue;
+		uint8_t m_alpha;
 	};
 	class GenericRendererPointInfo : public GenericRendererElementInfo {
 	public:
 		void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
-		GenericRendererPointInfo(GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b);
+		GenericRendererPointInfo(GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
 		virtual ~GenericRendererPointInfo() {};
 	private:
 		GenericRendererNode m_anchor;
 		uint8_t m_red;
 		uint8_t m_green;
 		uint8_t m_blue;
+		uint8_t m_alpha;
+	};
+	class GenericRendererTriangleInfo : public GenericRendererElementInfo {
+	public:
+		void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
+		GenericRendererTriangleInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
+		virtual ~GenericRendererTriangleInfo() {};
+	private:
+		GenericRendererNode m_edge1;
+		GenericRendererNode m_edge2;
+		GenericRendererNode m_edge3;
+		uint8_t m_red;
+		uint8_t m_green;
+		uint8_t m_blue;
+		uint8_t m_alpha;
 	};
 	class GenericRendererQuadInfo : public GenericRendererElementInfo {
 	public:
 		void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
-		GenericRendererQuadInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b);
+		GenericRendererQuadInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
 		virtual ~GenericRendererQuadInfo() {};
 	private:
 		GenericRendererNode m_edge1;
@@ -125,12 +141,13 @@
 		uint8_t m_red;
 		uint8_t m_green;
 		uint8_t m_blue;
+		uint8_t m_alpha;
 	};
 
 	class GenericRendererVertexInfo : public GenericRendererElementInfo {
 	public:
 		void render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool);
-		GenericRendererVertexInfo(GenericRendererNode center, int size, uint8_t r, uint8_t g, uint8_t b);
+		GenericRendererVertexInfo(GenericRendererNode center, int size, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
 		virtual ~GenericRendererVertexInfo() {};
 	private:
 		GenericRendererNode m_center;
@@ -138,6 +155,7 @@
 		uint8_t m_red;
 		uint8_t m_green;
 		uint8_t m_blue;
+		uint8_t m_alpha;
 	};
 
 	class GenericRendererImageInfo : public GenericRendererElementInfo {
@@ -192,10 +210,11 @@
 		 */
 		static GenericRenderer* getInstance(IRendererContainer* cnt);
 
-		void addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b);
-		void addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b);
-		void addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b);
-		void addVertex(const std::string &group, GenericRendererNode n, int size, uint8_t r, uint8_t g, uint8_t b);
+		void addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
+		void addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
+		void addTriangle(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
+		void addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
+		void addVertex(const std::string &group, GenericRendererNode n, int size, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
 		void addText(const std::string &group, GenericRendererNode n, AbstractFont* font, const std::string &text);
 		void addImage(const std::string &group, GenericRendererNode n, int image);
 		void addAnimation(const std::string &group, GenericRendererNode n, int animation);