Plane primitives no longer rely on normal vector
Former-commit-id: 66e1e2a83799055ad773f7b145e569469f68279a
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
void NzPrimitiveList::AddBox(const NzVector3f& lengths, const NzVector3ui& subdivision, const NzMatrix4f& matrix)
|
||||
{
|
||||
NzPrimitive primitive;
|
||||
primitive.matrix = matrix;
|
||||
primitive.type = nzPrimitiveType_Box;
|
||||
primitive.box.lengths = lengths;
|
||||
primitive.box.matrix = matrix;
|
||||
primitive.box.subdivision = subdivision;
|
||||
|
||||
m_primitives.push_back(primitive);
|
||||
@@ -25,8 +25,8 @@ void NzPrimitiveList::AddBox(const NzVector3f& lengths, const NzVector3ui& subdi
|
||||
void NzPrimitiveList::AddCubicSphere(float size, unsigned int subdivision, const NzMatrix4f& matrix)
|
||||
{
|
||||
NzPrimitive primitive;
|
||||
primitive.matrix = matrix;
|
||||
primitive.type = nzPrimitiveType_Sphere;
|
||||
primitive.sphere.matrix = matrix;
|
||||
primitive.sphere.size = size;
|
||||
primitive.sphere.type = nzSphereType_Cubic;
|
||||
primitive.sphere.cubic.subdivision = subdivision;
|
||||
@@ -42,8 +42,8 @@ void NzPrimitiveList::AddCubicSphere(float size, unsigned int subdivision, const
|
||||
void NzPrimitiveList::AddIcoSphere(float size, unsigned int recursionLevel, const NzMatrix4f& matrix)
|
||||
{
|
||||
NzPrimitive primitive;
|
||||
primitive.matrix = matrix;
|
||||
primitive.type = nzPrimitiveType_Sphere;
|
||||
primitive.sphere.matrix = matrix;
|
||||
primitive.sphere.size = size;
|
||||
primitive.sphere.type = nzSphereType_Ico;
|
||||
primitive.sphere.ico.recursionLevel = recursionLevel;
|
||||
@@ -56,35 +56,38 @@ void NzPrimitiveList::AddIcoSphere(float size, unsigned int recursionLevel, cons
|
||||
AddIcoSphere(size, recursionLevel, NzMatrix4f::Transform(position, rotation));
|
||||
}
|
||||
|
||||
void NzPrimitiveList::AddPlane(const NzPlanef& plane, const NzVector2f& size, const NzVector2ui& subdivision)
|
||||
void NzPrimitiveList::AddPlane(const NzVector2f& size, const NzVector2ui& subdivision, const NzMatrix4f& matrix)
|
||||
{
|
||||
NzPrimitive primitive;
|
||||
primitive.matrix = matrix;
|
||||
primitive.type = nzPrimitiveType_Plane;
|
||||
primitive.plane.normal = plane.normal;
|
||||
primitive.plane.position = plane.distance * plane.normal;
|
||||
primitive.plane.size = size;
|
||||
primitive.plane.subdivision = subdivision;
|
||||
|
||||
m_primitives.push_back(primitive);
|
||||
}
|
||||
|
||||
void NzPrimitiveList::AddPlane(const NzVector3f& position, const NzVector3f& normal, const NzVector2f& size, const NzVector2ui& subdivision)
|
||||
void NzPrimitiveList::AddPlane(const NzVector2f& size, const NzVector2ui& subdivision, const NzPlanef& plane)
|
||||
{
|
||||
NzPrimitive primitive;
|
||||
primitive.matrix = NzMatrix4f::Transform(plane.distance * plane.normal, NzQuaternionf::RotationBetween(NzVector3f::Up(), plane.normal));
|
||||
primitive.type = nzPrimitiveType_Plane;
|
||||
primitive.plane.normal = normal;
|
||||
primitive.plane.position = position;
|
||||
primitive.plane.size = size;
|
||||
primitive.plane.subdivision = subdivision;
|
||||
|
||||
m_primitives.push_back(primitive);
|
||||
}
|
||||
|
||||
void NzPrimitiveList::AddPlane(const NzVector2f& size, const NzVector2ui& subdivision, const NzVector3f& position, const NzQuaternionf& rotation)
|
||||
{
|
||||
AddPlane(size, subdivision, NzMatrix4f::Transform(position, rotation));
|
||||
}
|
||||
|
||||
void NzPrimitiveList::AddUVSphere(float size, unsigned int slices, unsigned int stacks, const NzMatrix4f& matrix)
|
||||
{
|
||||
NzPrimitive primitive;
|
||||
primitive.matrix = matrix;
|
||||
primitive.type = nzPrimitiveType_Sphere;
|
||||
primitive.sphere.matrix = matrix;
|
||||
primitive.sphere.size = size;
|
||||
primitive.sphere.type = nzSphereType_UV;
|
||||
primitive.sphere.uv.slices = slices;
|
||||
|
||||
Reference in New Issue
Block a user