TDME2  1.9.200
RenderTransparentRenderPointsPool.cpp
Go to the documentation of this file.
2 
3 #include <algorithm>
4 #include <string>
5 #include <vector>
6 
7 #include <tdme/tdme.h>
8 #include <tdme/engine/Color4.h>
11 #include <tdme/math/Matrix4x4.h>
12 #include <tdme/math/Vector3.h>
13 #include <tdme/utilities/Console.h>
14 
15 using std::string;
16 using std::vector;
17 
25 
26 RenderTransparentRenderPointsPool::RenderTransparentRenderPointsPool(int32_t pointsMax)
27 {
28  transparentRenderPoints.resize(pointsMax);
29  reset();
30 }
31 
33 }
34 
36 {
37  auto pool2Points = pool2->getTransparentRenderPoints();
38  for (auto i = 0; i < pool2->getTransparentRenderPointsCount(); i++) {
39  auto point = pool2Points[i];
40  // check for pool overflow
41  if (poolIdx >= transparentRenderPoints.size()) {
42  Console::println(string("RenderTransparentRenderPointsPool::merge(): Too many transparent render points"));
43  return;
44  }
45  //
46  point->point = cameraMatrix.multiply(point->point);
47  // create point in pool
49  }
50 }
51 
53 {
54  poolIdx = 0;
55  for (auto i = 0; i < transparentRenderPoints.size(); i++) transparentRenderPoints[i] = nullptr;
56 }
57 
59 {
60  std::sort(
63  [](const TransparentRenderPoint* point1, const TransparentRenderPoint* point2) {
64  return -point1->point.getZ() > -point2->point.getZ();
65  }
66  );
67 }
Color 4 definition class.
Definition: Color4.h:18
void merge(TransparentRenderPointsPool *pool2, const Matrix4x4 &cameraMatrix)
Merge another pool into this pool.
const vector< TransparentRenderPoint * > & getTransparentRenderPoints()
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
Vector3 multiply(const Vector3 &vector3) const
Multiplies this matrix with vector3.
Definition: Matrix4x4.h:225
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
Console class.
Definition: Console.h:29