71 const auto& facesEntity = facesEntities[facesEntityIdx];
72 const auto& faces = facesEntity.getFaces();
73 const auto& nodeTransformedVertices = objectNode->
mesh->
vertices;
75 float distanceFromCamera;
78 for (
auto i = 0; i < faces.size(); i++) {
81 Console::println(
string(
"TransparentRenderFacesPool::createTransparentRenderFaces(): Too many transparent render faces"));
85 auto faceVertexIndices = faces[i].getVertexIndices();
86 faceCenter.
set(0.0f, 0.0f, 0.0f);
87 faceCenter.
add((*nodeTransformedVertices)[faceVertexIndices[0]]);
88 faceCenter.
add((*nodeTransformedVertices)[faceVertexIndices[1]]);
89 faceCenter.
add((*nodeTransformedVertices)[faceVertexIndices[2]]);
90 faceCenter.
scale(1.0f / 3.0f);
91 faceCenter = modelViewMatrix.
multiply(faceCenter);
92 distanceFromCamera = -faceCenter.
getZ();
95 transparentRenderFace->
objectNode = objectNode;
96 transparentRenderFace->facesEntityIdx = facesEntityIdx;
97 transparentRenderFace->faceIdx = faceIdx;
98 transparentRenderFace->distanceFromCamera = distanceFromCamera;
111 *transparentRenderFace = *srcTransparentRenderFace;
Represents a model face, consisting of vertex, normal, tangent and bitangent vectors,...
Node faces entity A node can have multiple entities containing faces and a applied material.
const vector< FacesEntity > & getFacesEntities() const
Object node mesh specifically for rendering.
const vector< Vector3 > * vertices
Object node specifically for rendering.
Transparent render faces pool.
Transparent render faces pool.
static constexpr int32_t FACES_MAX
vector< TransparentRenderFace * > & getTransparentRenderFaces()
TransparentRenderFacesPool_TransparentRenderFacesPool transparentRenderFacesPool
void createTransparentRenderFaces(Matrix4x4 &modelViewMatrix, ObjectNode *objectNode, int32_t facesEntityIdx, int32_t faceIdx)
Creates an array of transparent render faces from.
void merge(TransparentRenderFacesPool *srcTransparentRenderFacesPool)
Merges given transparent render faces pool into this pool.
vector< TransparentRenderFace * > transparentRenderFaces
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Vector3 multiply(const Vector3 &vector3) const
Multiplies this matrix with vector3.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & add(float scalar)
Adds a scalar.
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.
T * allocate()
Allocate a new element from pool.
void reset()
Reset this pool.
Transparent face to be rendered.
#define FORBID_CLASS_COPY(CLASS)