Browse Source

Moved Color back to the Math library.

Lasse Öörni 14 years ago
parent
commit
4409bc0df0
4 changed files with 6 additions and 6 deletions
  1. 2 2
      Engine/Engine/MathAPI.cpp
  2. 1 1
      Engine/Graphics/Light.cpp
  3. 0 0
      Engine/Math/Color.cpp
  4. 3 3
      Engine/Math/Color.h

+ 2 - 2
Engine/Engine/MathAPI.cpp

@@ -605,8 +605,8 @@ static void RegisterColor(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Color", "Color opAdd(const Color&in) const", asMETHOD(Color, operator +), asCALL_THISCALL);
     engine->RegisterObjectMethod("Color", "Color opAdd(const Color&in) const", asMETHOD(Color, operator +), asCALL_THISCALL);
     engine->RegisterObjectMethod("Color", "Color Lerp(const Color&in, float) const", asMETHOD(Color, Lerp), asCALL_THISCALL);
     engine->RegisterObjectMethod("Color", "Color Lerp(const Color&in, float) const", asMETHOD(Color, Lerp), asCALL_THISCALL);
     engine->RegisterObjectMethod("Color", "String ToString() const", asMETHOD(Color, ToString), asCALL_THISCALL);
     engine->RegisterObjectMethod("Color", "String ToString() const", asMETHOD(Color, ToString), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Color", "Vector3 get_rgb() const", asMETHOD(Color, GetRGB), asCALL_THISCALL);
-    engine->RegisterObjectMethod("Color", "float get_intensity() const", asMETHOD(Color, GetIntensity), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Color", "Vector3 get_rgb() const", asMETHOD(Color, RGBValues), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Color", "float get_intensity() const", asMETHOD(Color, Intensity), asCALL_THISCALL);
     engine->RegisterObjectProperty("Color", "float r", offsetof(Color, r_));
     engine->RegisterObjectProperty("Color", "float r", offsetof(Color, r_));
     engine->RegisterObjectProperty("Color", "float g", offsetof(Color, g_));
     engine->RegisterObjectProperty("Color", "float g", offsetof(Color, g_));
     engine->RegisterObjectProperty("Color", "float b", offsetof(Color, b_));
     engine->RegisterObjectProperty("Color", "float b", offsetof(Color, b_));

+ 1 - 1
Engine/Graphics/Light.cpp

@@ -469,7 +469,7 @@ void Light::SetShadowMap(Texture2D* shadowMap)
 void Light::SetIntensitySortValue(const Vector3& position)
 void Light::SetIntensitySortValue(const Vector3& position)
 {
 {
     // Directional lights are always assumed to be "infinitely" close, while point and spot lights take distance into account
     // Directional lights are always assumed to be "infinitely" close, while point and spot lights take distance into account
-    float invIntensity = 1.0f / color_.GetIntensity();
+    float invIntensity = 1.0f / color_.Intensity();
     if (lightType_ == LIGHT_DIRECTIONAL)
     if (lightType_ == LIGHT_DIRECTIONAL)
         sortValue_ = invIntensity;
         sortValue_ = invIntensity;
     else
     else

+ 0 - 0
Engine/Core/Color.cpp → Engine/Math/Color.cpp


+ 3 - 3
Engine/Core/Color.h → Engine/Math/Color.h

@@ -99,9 +99,9 @@ public:
     /// Return float data
     /// Return float data
     const float* GetData() const { return &r_; }
     const float* GetData() const { return &r_; }
     /// Return RGB values as a Vector3
     /// Return RGB values as a Vector3
-    Vector3 GetRGB() const { return Vector3(r_, g_, b_); }
-    /// Return intensity
-    float GetIntensity() const { return GetRGB().DotProduct(Vector3(0.333f, 0.333f, 0.333f)); }
+    Vector3 RGBValues() const { return Vector3(r_, g_, b_); }
+    /// Return approximate intensity
+    float Intensity() const { return RGBValues().DotProduct(Vector3(0.333f, 0.333f, 0.333f)); }
     
     
     /// Linear interpolation with another color
     /// Linear interpolation with another color
     Color Lerp(const Color& rhs, float t) const
     Color Lerp(const Color& rhs, float t) const