68 auto& facesEntity = facesEntities[facesEntityIdx];
69 auto& faces = facesEntity.getFaces();
70 auto nodeTransformedVertices = object3DNode->
mesh->
vertices;
72 float distanceFromCamera;
75 for (
auto i = 0; i < faces.size(); i++) {
78 Console::println(
string(
"TransparentRenderFacesPool::createTransparentRenderFaces(): Too many transparent render faces"));
82 auto faceVertexIndices = faces[i].getVertexIndices();
83 faceCenter.
set(0.0f, 0.0f, 0.0f);
84 faceCenter.
add((*nodeTransformedVertices)[faceVertexIndices[0]]);
85 faceCenter.
add((*nodeTransformedVertices)[faceVertexIndices[1]]);
86 faceCenter.
add((*nodeTransformedVertices)[faceVertexIndices[2]]);
87 faceCenter.
scale(1.0f / 3.0f);
88 faceCenter = modelViewMatrix.
multiply(faceCenter);
89 distanceFromCamera = -faceCenter.
getZ();
93 transparentRenderFace->facesEntityIdx = facesEntityIdx;
94 transparentRenderFace->faceIdx = faceIdx;
95 transparentRenderFace->distanceFromCamera = distanceFromCamera;
108 *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 3D node mesh specifically for rendering.
const vector< Vector3 > * vertices
Object 3d node specifically for rendering.
Transparent render faces pool.
Transparent render faces pool.
static constexpr int32_t FACES_MAX
void createTransparentRenderFaces(Matrix4x4 &modelViewMatrix, Object3DNode *object3DNode, int32_t facesEntityIdx, int32_t faceIdx)
Creates an array of transparent render faces from.
TransparentRenderFacesPool_TransparentRenderFacesPool transparentRenderFacesPool
void merge(TransparentRenderFacesPool *srcTransparentRenderFacesPool)
Merges given transparent render faces pool into this pool.
vector< TransparentRenderFace * > & getTransparentRenderFaces()
TransparentRenderFacesPool()
Public constructor.
vector< TransparentRenderFace * > transparentRenderFaces
Vector3 multiply(const Vector3 &v) const
Multiplies a vector3 with this matrix into destination vector.
Vector3 & set(float x, float y, float z)
Set up vector.
Vector3 & add(const Vector3 &v)
Adds a vector.
Vector3 & scale(float scale)
Scale this vector.
T allocate()
Allocate a new element from pool.
Transparent face to be rendered.
Object3DNode * object3DNode