42 const T W=1) {
x=X;
y=Y;
z=Z;
w=W;}
43 explicit SLVec4 (
const T v[4]) {
x=v[0];
y=v[1];
z=v[2];
w=v[3];}
52 const T W=1) {
x=X;
y=Y;
z=Z;
w=W;}
53 void set (
const T xyz) {
x=xyz;
y=xyz;
z=xyz;
w=1;}
54 void set (
const T v[4]) {
x=v[0];
y=v[1];
z=v[2];
w=v[3];}
84 const SLVec4& v){output<<
"["<<v.
x<<
","<<v.
y<<
","<<v.
z<<
","<<v.
w<<
"]";
return output;}
108 y =
a.z*
b.x -
a.x*
b.z;
109 z =
a.x*
b.y -
a.y*
b.x;
116 if (L>0){
x/=L;
y/=L;
z/=L;
w/=L;}
120 const T max) {
x = (
x>max)?max : (
x<min)?min :
x;
121 y = (
y>max)?max : (
y<min)?min :
y;
122 z = (
z>max)?max : (
z<min)?min :
z;
133 const T factor_b) {T factor_a = 1-factor_b;
134 x =
a.x*factor_a +
b.x*factor_b;
135 y =
a.y*factor_a +
b.y*factor_b;
136 z =
a.z*factor_a +
b.z*factor_b;
137 w =
a.w*factor_a +
b.w*factor_b;}
139 else if (
y<=
z)
return y;
142 else if (
y>=
z)
return y;
145 else if (
y<=
z &&
y<=
w)
return y;
146 else if (
z<=
w)
return z;
149 else if (
y>=
z &&
y>=
w)
return y;
150 else if (
z>=
w)
return z;
153 else if (
y>=
z &&
y>=
w)
return 1;
154 else if (
z>=
w)
return 2;
157 else if (
y<=
z &&
y<=
w)
return 1;
158 else if (
z<=
w)
return 2;
164 y= pow(
y,oneOverGamma);
165 z= pow(
z,oneOverGamma);}
168 {
if (str)
SL_LOG(
"%s",str);
169 SL_LOG(
"% 3.3f, % 3.3f, % 3.3f, % 3.3f",
x,
y,
z,
w);
184 float f[4] = {0.0, 0.0f, 0.0f, 1.0f};
185 for (
SLuint i=0; i<components.size(); ++i)
186 f[i] = (
SLfloat)atof(components[i].c_str());
187 x = f[0];
y = f[1];
z = f[2];
w = f[3];
199 T
x = c * (1.0f - (T)fabs((T)fmod(h*3.0f /
Utils::PI, 2.0f) - 1.0f));
203 {
case 0:
return set(m + c, m +
x, m ,
a);
204 case 1:
return set(m +
x, m + c, m ,
a);
205 case 2:
return set(m , m + c, m +
x,
a);
206 case 3:
return set(m , m +
x, m + c,
a);
207 case 4:
return set(m +
x, m , m + c,
a);
208 case 5:
return set(m + c, m , m +
x,
a);
245 typedef vector<SLVec4d> SLVVec4d;
vector< SLstring > SLVstring
vector< SLVec4f > SLVVec4f
vector< SLVec4i > SLVVec4i
vector< SLCol4f > SLVCol4f
SLVec4< SLfloat > SLVec4f
SLVec4< SLfloat > SLCol4f
The SLScene class represents the top level instance holding the scene structure.
2D vector template class for standard 2D vector algebra.
3D vector template class for standard 3D vector algebra.
4D vector template class for standard 4D vector algebra.
SLVec4 & operator*=(const T s)
SLbool operator>=(const SLVec4 &v) const
SLVec4 & operator+=(const SLVec4 &v)
void set(const SLVec3< T > &v)
SLVec4 & operator/=(const T s)
void sub(const SLVec4 &a, const SLVec4 &b)
SLVec4 & operator&=(const SLVec4 &v)
void add(const SLVec4 &a, const SLVec4 &b)
void set(const SLVec4< T > &v)
SLVec4 operator&(const SLVec4 &v) const
SLbool operator<(const SLVec4 &v) const
SLVec4(const SLVec2< T > &v)
SLVec4(const T X, const T Y, const T Z=0, const T W=1)
SLVec4 operator/(const T s) const
void set(const T X, const T Y, const T Z, const T W=1)
void hsva2rgba(const SLVec4 &hsva)
HSVA to RGBA color conversion (http://www.rapidtables.com/convert/color/hsv-to-rgb....
SLVec4 operator+(const SLVec4 &v) const
SLVec4 & operator=(const SLVec2< T > &v)
T diffRGB(const SLVec4 &v)
void cross(const SLVec4 &a, const SLVec4 &b)
friend std::ostream & operator<<(std::ostream &output, const SLVec4 &v)
SLbool operator<=(const SLVec4 &v) const
SLstring toString(SLstring delimiter=", ")
Conversion to string.
SLVec4 & operator-=(const SLVec4 &v)
void gammaCorrect(T oneOverGamma)
Gamma correction.
SLbool operator==(const SLVec4 &v) const
SLVec4(const SLstring &fourFloatsWithDelimiter)
T operator*(const SLVec4 &v) const
void mix(const SLVec4 &a, const SLVec4 &b, const T factor_b)
SLbool operator>(const SLVec4 &v) const
SLVec4(const SLVec3< T > &v)
SLVec4(const SLVec4< T > &v)
void clampMinMax(const T min, const T max)
void set(const SLVec2< T > &v)
void fromString(const SLstring &fourFloatsWithDelimiter, SLchar delimiter=',')
Conversion from string.
SLbool operator!=(const SLVec4 &v) const
void print(const SLchar *str=nullptr)
T clamp(T a, T min, T max)
void splitString(const string &s, char delimiter, vector< string > &splits)
Splits an input string at a delimiter character into a string vector.
static const float ONEOVERPI
string toString(float f, int roundedDecimals)
Returns a string from a float with max. one trailing zero.