29 int* numberOfCoordinatesPtr)
31 ASSERT(normalsPtrPtr != NULL,
32 "Cannot use null pointer while calculating coordinates.");
40 *normalsPtrPtr = (
float*) malloc(numberOfNormalsCoordinates *
sizeof(
float));
43 ASSERT(*normalsPtrPtr != NULL,
44 "Could not allocate memory for result array.");
51 (*normalsPtrPtr)[currentIndex++] = 0.0f;
52 (*normalsPtrPtr)[currentIndex++] = 1.0f;
53 (*normalsPtrPtr)[currentIndex++] = 0.0f;
56 if (numberOfCoordinatesPtr != NULL)
58 *numberOfCoordinatesPtr = numberOfNormalsCoordinates;
64 int* numberOfCoordinatesPtr,
65 int* numberOfPointsPtr,
78 const Vec3f coordinatesOfPointA = {-1.0f, 0.0f, -1.0f };
79 const Vec3f coordinatesOfPointB = { 1.0f, 0.0f, -1.0f };
80 const Vec3f coordinatesOfPointC = { 1.0f, 0.0f, 1.0f };
81 const Vec3f coordinatesOfPointD = {-1.0f, 0.0f, 1.0f };
83 ASSERT(coordinatesPtrPtr != NULL,
84 "Cannot use null pointer while calculating plane coordinates.")
89 const
int numberOfSquareCoordinates = numberOfPoints *
90 NUMBER_OF_POINT_COORDINATES;
93 *coordinatesPtrPtr = (
float*) malloc(numberOfSquareCoordinates * sizeof(
float));
96 ASSERT(*coordinatesPtrPtr != NULL,
97 "Could not allocate memory for
plane coordinates result array.")
100 int currentIndex = 0;
104 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
x;
105 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.
y;
106 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.z;
109 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointB.x;
110 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointB.y;
111 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointB.z;
114 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.x;
115 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.y;
116 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.z;
120 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.x;
121 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.y;
122 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointA.z;
124 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.x;
125 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.y;
126 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointC.z;
128 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointD.x;
129 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointD.y;
130 (*coordinatesPtrPtr)[currentIndex++] = coordinatesOfPointD.z;
132 if (scalingFactor != 1.0
f)
134 for (
int i = 0; i < numberOfSquareCoordinates; i++)
140 if (numberOfCoordinatesPtr != NULL)
142 *numberOfCoordinatesPtr = numberOfSquareCoordinates;
145 if (numberOfPointsPtr != NULL)
147 *numberOfPointsPtr = numberOfPoints;
static void getTriangleRepresentation(int *numberOfCoordinates, float **coordinates)
Get coordinates of points which make up a plane. The plane is located in XZ space.
#define NUMBER_OF_TRIANGLE_VERTICES
Number of vertices which make up a triangle shape.
static void getNormals(int *numberOfCoordinates, float **normals)
Get normals for plane placed in XZ space.
GLint GLint GLint GLint GLint x
#define NUMBER_OF_POINT_COORDINATES
Number of coordinates for a point in 3D space.
#define NUMBER_OF_TRIANGLES_IN_QUAD
Number of triangles which make up a quad.