From 37ba5e51f6fc25df05a44f4ccab9645ea25ca85a Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sun, 1 Dec 2013 22:42:47 +0000 Subject: [PATCH] minor fixing --- include/Render/RenderMisc.h | 11 +++++++++++ src/Render/RenderMisc.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/include/Render/RenderMisc.h b/include/Render/RenderMisc.h index 4156b87..9a35896 100644 --- a/include/Render/RenderMisc.h +++ b/include/Render/RenderMisc.h @@ -123,6 +123,13 @@ void FillVertexCoordVec(std::vector& coordVec, int pos, vec2 posFrom, vec2 void FillTexCoordVec(std::vector& coordVec, int pos, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1)); //Adds rect points (6 tex coords) into coordVec +void FillVertexCoordVec_4Points(std::vector& coordVec, int pos, vec2 pos1, vec2 pos2, vec2 pos3, vec2 pos4); +//Adds rect points (6 vertices) into coordVec + +void FillTexCoordVec_4Points(std::vector& coordVec, int pos, vec2 texCoord1 = vec2(0,0), vec2 texCoord2 = vec2(1,0), vec2 texCoord3 = vec2(1,1), vec2 texCoord4 = vec2(0,1)); +//Adds rect points (6 tex coords) into coordVec + + std::vector MakeVertexCoordVec(vec2 posFrom, vec2 posTo); //Creates array of rect (6 vertices) @@ -153,6 +160,10 @@ TDataTriangleList& InsertIntoDataTriangleList(TDataTriangleList& triangleList, c void Replace6PointsInTriangleList(TDataTriangleList& triangleList, int pos, vec2 posFrom, vec2 posTo, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1)); //Replaces one rect in triangleList at position pos by new rect. pos is position in array for first vertex of a rectangle +void Replace6PointsInTriangleList_4Points(TDataTriangleList& triangleList, int pos, vec2 pos1, vec2 pos2, vec2 pos3, vec2 pos4, vec2 texCoord1 = vec2(0,0), vec2 texCoord2 = vec2(1,0), vec2 texCoord3 = vec2(1,1), vec2 texCoord4 = vec2(0,1)); +//Replaces one rect in triangleList at position pos by new rect. pos is position in array for first vertex of a rectangle + + TTriangleList MakeTriangleList(vec2 posFrom, vec2 posTo, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1)); //Creates triangle list containing rect diff --git a/src/Render/RenderMisc.cpp b/src/Render/RenderMisc.cpp index 1646d57..91697d7 100644 --- a/src/Render/RenderMisc.cpp +++ b/src/Render/RenderMisc.cpp @@ -221,6 +221,26 @@ void FillTexCoordVec(std::vector& coordVec, int pos, vec2 texCoordFrom, ve } +void FillVertexCoordVec_4Points(std::vector& coordVec, int pos, vec2 pos1, vec2 pos2, vec2 pos3, vec2 pos4) +{ + coordVec[pos] = vec3(pos1, 0); + coordVec[pos+1] = vec3(pos2, 0); + coordVec[pos+2] = vec3(pos3, 0); + coordVec[pos+3] = vec3(pos3, 0); + coordVec[pos+4] = vec3(pos4, 0); + coordVec[pos+5] = vec3(pos1, 0); +} + +void FillTexCoordVec_4Points(std::vector& coordVec, int pos, vec2 texCoord1, vec2 texCoord2, vec2 texCoord3, vec2 texCoord4) +{ + coordVec[pos] = texCoord1; + coordVec[pos+1] = texCoord2; + coordVec[pos+2] = texCoord3; + coordVec[pos+3] = texCoord3; + coordVec[pos+4] = texCoord4; + coordVec[pos+5] = texCoord1; +} + std::vector MakeVertexCoordVec(vec2 posFrom, vec2 posTo) { @@ -351,6 +371,12 @@ void Replace6PointsInTriangleList(TDataTriangleList& triangleList, int pos, vec2 FillTexCoordVec(triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB], pos, texCoordFrom, texCoordTo); } +void Replace6PointsInTriangleList_4Points(TDataTriangleList& triangleList, int pos, vec2 pos1, vec2 pos2, vec2 pos3, vec2 pos4, vec2 texCoord1, vec2 texCoord2, vec2 texCoord3, vec2 texCoord4) +{ + FillVertexCoordVec_4Points(triangleList.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB], pos, pos1, pos2, pos3, pos4); + FillTexCoordVec_4Points(triangleList.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB], pos, texCoord1, texCoord2, texCoord3, texCoord4); +} + void CheckGlError(const std::string& msg)