MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / GenerateCubicSphere

Function GenerateCubicSphere

src/Nazara/Utility/AlgorithmUtility.cpp:901–927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899 }
900
901 void GenerateCubicSphere(float size, unsigned int subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, unsigned int indexOffset)
902 {
903 ///DOC: Cette fonction va accéder aux pointeurs en écriture ET en lecture
904 unsigned int vertexCount;
905 ComputeBoxIndexVertexCount(Vector3ui(subdivision), nullptr, &vertexCount);
906
907 // On envoie une matrice identité de sorte à ce que la boîte ne subisse aucune transformation (rendant plus facile l'étape suivante)
908 GenerateBox(Vector3f(size, size, size), Vector3ui(subdivision), Matrix4f::Identity(), textureCoords, vertexPointers, indices, nullptr, indexOffset);
909
910 if (aabb)
911 {
912 Vector3f totalSize = size * matrix.GetScale();
913 aabb->Set(-totalSize, totalSize);
914 }
915
916 for (unsigned int i = 0; i < vertexCount; ++i)
917 {
918 Vector3f normal = vertexPointers.positionPtr->GetNormal();
919
920 *vertexPointers.positionPtr++ = matrix.Transform(size * normal);
921
922 if (vertexPointers.normalPtr)
923 *vertexPointers.normalPtr++ = normal;
924
925 ///FIXME: *vertexPointers.tangentPtr++ = ???
926 }
927 }
928
929 void GenerateIcoSphere(float size, unsigned int recursionLevel, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, unsigned int indexOffset)
930 {

Callers 1

BuildSubMeshMethod · 0.85

Calls 5

GenerateBoxFunction · 0.85
TransformMethod · 0.80
GetScaleMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected