resonance 1.0.1
Loading...
Searching...
No Matches
tunnelsortentry.h
Go to the documentation of this file.
1#pragma once
2
3#include "math/vector3.h"
4#include "rnd/mesh.h"
5#include "rnd/meshvert.h"
6
7namespace Rnd {
8
17public:
29 TunnelSortEntry(Mesh *pMesh, int nIndex, const Vector3 &eye) : mMesh(pMesh), mIndex(nIndex) {
30 const std::vector<MeshVert> &verts = pMesh->mVertsOwner->mVerts;
31 Vector3 sum;
32 sum.w = 1.0f;
33 Rnd::Add(&verts[0].mPoint.x, &verts[1].mPoint.x, &sum.x);
34 Vector3 midpoint;
35 midpoint.w = 1.0f;
36 Vec3Scale(&sum.x, 0.5f, &midpoint.x);
37 const float flX = midpoint.x - eye.x;
38 const float flY = midpoint.y - eye.y;
39 const float flZ = midpoint.z - eye.z;
40 mDistanceSq = flX * flX + flY * flY + flZ * flZ;
41 }
42
45 int mIndex;
46};
47
48} // namespace Rnd
Indexed triangle mesh with one material.
Definition mesh.h:46
std::vector< MeshVert > mVerts
Definition mesh.h:704
Mesh * mVertsOwner
Definition mesh.h:726
TunnelSortEntry(Mesh *pMesh, int nIndex, const Vector3 &eye)
Key a mesh by the squared distance from eye to the midpoint of its first two vertices.
Definition tunnelsortentry.h:29
Mesh * mMesh
Definition tunnelsortentry.h:44
int mIndex
Definition tunnelsortentry.h:45
float mDistanceSq
Definition tunnelsortentry.h:43
The rendering engine.
Definition animhelper.h:3
void Add(const Vector2 &a, const Vector2 &b, Vector2 &out)
Add two two-component vectors.
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12
float w
Definition vector3.h:16
float x
Definition vector3.h:13
float y
Definition vector3.h:14
float z
Definition vector3.h:15
void Vec3Scale(const float *pSrc, float flScale, float *pOut)
Multiply a three-component vector by a scalar.