forked from mirrors/0ad
Removes mentions of legacy and unused GL calls, unifies AsFloatArray.
This was SVN commit r25961.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
void SetIdentity();
|
||||
// set this matrix to the zero matrix
|
||||
void SetZero();
|
||||
// set this matrix to the orthogonal projection matrix (as with glOrtho)
|
||||
// set this matrix to the orthogonal projection matrix
|
||||
void SetOrtho(float left, float right, float bottom, float top, float near, float far);
|
||||
// set this matrix to the perspective projection matrix
|
||||
void SetPerspective(float fov, float aspect, float near, float far);
|
||||
|
||||
+13
-2
@@ -120,8 +120,19 @@ class CVector3D
|
||||
void Normalize();
|
||||
CVector3D Normalized() const;
|
||||
|
||||
// Returns 3 element array of floats, e.g. for glVertex3fv
|
||||
const float* GetFloatArray() const { return &X; }
|
||||
// Returns 3 element array of floats, e.g. for vec3 uniforms.
|
||||
const float* AsFloatArray() const
|
||||
{
|
||||
// Additional check to prevent a weird compiler has a different
|
||||
// alignement for an array and a class members.
|
||||
static_assert(
|
||||
sizeof(CVector3D) == sizeof(float) * 3u &&
|
||||
offsetof(CVector3D, X) == 0 &&
|
||||
offsetof(CVector3D, Y) == sizeof(float) &&
|
||||
offsetof(CVector3D, Z) == sizeof(float) * 2u,
|
||||
"Vector3D should be properly layouted to use AsFloatArray");
|
||||
return &X;
|
||||
}
|
||||
};
|
||||
|
||||
extern float MaxComponent(const CVector3D& v);
|
||||
|
||||
Reference in New Issue
Block a user