25 assert(revolvePoints.size() >= 2 &&
"Error: Not enough revolve points.");
26 assert(revolveAxis !=
SLVec3f::ZERO &&
"Error axis is a zero vector.");
27 assert(
slices >= 3 &&
"Error: Not enough slices.");
60 UV[0].resize(
P.size());
66 segments.push_back(0);
72 segments.push_back(len);
76 for (
auto& segment : segments)
77 segment /= totalLenght;
111 vector<SLVec3ui> faces;
148 assert(!faces.empty() &&
"SLRevolver::buildMesh: No faces defined!");
152 if (
P.size() < 65536)
155 I16.resize(faces.size() * 3);
156 for (
auto face : faces)
166 I32.resize(faces.size() * 3);
167 for (
auto face : faces)
vector< SLfloat > SLVfloat
vector< SLVec3f > SLVVec3f
Toplevel holder of the assets meshes, materials, textures and shaders.
void rotate(T degAng, T axisx, T axisy, T axisz)
SLVec3< T > multVec(SLVec3< T > v) const
void identity()
Sets the identity matrix.
Defines a standard CG material with textures and a shader program.
An SLMesh object is a triangulated mesh, drawn with one draw call.
SLVuint I32
Vector of vertex indices 32 bit.
SLVushort I16
Vector of vertex indices 16 bit.
virtual void calcNormals()
SLMesh::calcNormals recalculates vertex normals for triangle meshes.
SLVVec3f N
Vector for vertex normals (opt.) layout (location = 1)
virtual void deleteData()
SLMesh::deleteData deletes all mesh data and vbo's.
SLVVec2f UV[2]
Array of 2 Vectors for tex. coords. (opt.) layout (location = 2)
SLVVec3f P
Vector for vertex positions layout (location = 0)
SLbool _smoothLast
flag if the normal of the last point is eqaual to revAxis
SLVec3f _revAxis
axis of revolution
SLbool _smoothFirst
flag if the normal of the first point is eqaual to -revAxis
SLuint _slices
NO. of slices.
void buildMesh(SLMaterial *mat=nullptr)
SLVVec3f _revPoints
Array revolving points.
SLRevolver(SLAssetManager *assetMgr, SLVVec3f revolvePoints, SLVec3f revolveAxis, SLuint slices=36, SLbool smoothFirst=false, SLbool smoothLast=false, SLstring name="revolver mesh", SLMaterial *mat=nullptr)
ctor for generic revolver mesh
The SLScene class represents the top level instance holding the scene structure.
T distSquared(const SLVec3 &q)
Calculate the squared distance from the vector to point q.