Skip to content

Commit

Permalink
Added Dot to Vector3 and better shader error
Browse files Browse the repository at this point in the history
-Vector3 now has Dot product function which takes another Vector3. I
will have to clean up the GSmath at some point and implement all the
useful functions at once.
-The get_uniform macro will now print the name of the uniform as well.
  • Loading branch information
TheExDeus committed Oct 21, 2015
1 parent e9ccc92 commit 1ea05bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ENIGMAsystem/SHELL/Graphics_Systems/General/GSmath.cpp
Expand Up @@ -43,6 +43,11 @@ Vector3 Vector3::Cross(const Vector3& v) const
return Vector3(_x, _y, _z);
}

gs_scalar Vector3::Dot(const Vector3& v) const
{
return x * v.x + y * v.y + z * v.z;
}

Vector3& Vector3::Normalize()
{
const gs_scalar Length = sqrt(x * x + y * y + z * z);
Expand Down
1 change: 1 addition & 0 deletions ENIGMAsystem/SHELL/Graphics_Systems/General/GSmath.h
Expand Up @@ -77,6 +77,7 @@ namespace enigma
}

Vector3 Cross(const Vector3& v) const;
gs_scalar Dot(const Vector3& v) const;
Vector3& Normalize();
void Rotate(gs_scalar Angle, const Vector3& Axis);
};
Expand Down
2 changes: 1 addition & 1 deletion ENIGMAsystem/SHELL/Graphics_Systems/OpenGL3/GL3shader.cpp
Expand Up @@ -50,7 +50,7 @@
printf("%s - Uniform at location %i not found!\n", str, location);\
return;\
}else if ( uniter->second.size != usize ){\
printf("%s - Uniform at location %i with %i arguments is accesed by a function with %i arguments!\n", str, location, uniter->second.size, usize);\
printf("%s - Uniform [%s] at location %i with %i arguments is accesed by a function with %i arguments!\n", str, uniter->second.name.c_str(), location, uniter->second.size, usize);\
}

#define get_attribute(atiter,location)\
Expand Down

0 comments on commit 1ea05bc

Please sign in to comment.