Match and link CLight *FINALLY*

This commit is contained in:
Phillip Stephens 2022-10-09 10:47:52 -07:00
parent a110979970
commit ff90f64231
3 changed files with 17 additions and 4 deletions

View File

@ -50,6 +50,7 @@ COMPLETE_OBJECTS = [
"Kyoto/Basics/COsContextDolphin",
"Kyoto/Basics/CSWDataDolphin",
"Kyoto/Audio/CSfxHandle",
"Kyoto/Graphics/CLight",
"Kyoto/Graphics/CGX",
"Kyoto/Particles/CIntElement",
"Kyoto/Particles/CWarp",

View File

@ -507,7 +507,7 @@ KYOTO_1 :=\
$(BUILD_DIR)/asm/Kyoto/Text/CWordInstruction.o\
$(BUILD_DIR)/asm/Kyoto/Text/CBlockInstruction.o\
$(BUILD_DIR)/asm/Kyoto/Text/CFont.o\
$(BUILD_DIR)/asm/Kyoto/Graphics/CLight.o\
$(BUILD_DIR)/src/Kyoto/Graphics/CLight.o\
$(BUILD_DIR)/asm/Kyoto/Graphics/CCubeModel.o\
$(BUILD_DIR)/src/Kyoto/Graphics/CGX.o\
$(BUILD_DIR)/asm/Kyoto/Graphics/CTevCombiners.o\

View File

@ -1,13 +1,15 @@
#include <float.h>
#include "Kyoto/Graphics/CLight.hpp"
#include "Kyoto/Math/CMath.hpp"
#include "rstl/math.hpp"
static const float gkEpsilon32 = FLT_EPSILON;
const CVector3f CLight::kDefaultPosition(0.f, 0.f, 0.f);
const CVector3f CLight::kDefaultDirection(0.f, -1.f, 0.f);
static const float gkEpsilon32 = FLT_EPSILON;
CLight::CLight(ELightType type, const CVector3f& position, const CVector3f& direction,
const CColor& color, float cutoff)
: x0_pos(position)
@ -52,10 +54,12 @@ CLight CLight::BuildLocalAmbient(const CVector3f& pos, const CColor& col) {
return CLight(kLT_LocalAmbient, pos, kDefaultDirection, col, 180.f);
}
CLight CLight::BuildDirectional(const CVector3f& direction, const CColor& col) {
return CLight(kLT_Directional, kDefaultPosition, direction, col, 180.f);
}
CLight CLight::BuildPoint(const CVector3f& pos, const CColor& color) {
return CLight(kLT_Point, pos, kDefaultDirection, color, 180.f);
}
@ -71,6 +75,7 @@ CLight CLight::BuildCustom(const CVector3f& pos, const CVector3f& dir, const CCo
return CLight(pos, dir, color, distC, distL, distQ, angleC, angleL, angleQ);
}
void CLight::SetAttenuation(float constant, float linear, float quadratic) {
x24_distC = constant;
x28_distL = linear;
@ -79,6 +84,7 @@ void CLight::SetAttenuation(float constant, float linear, float quadratic) {
x4c_24_intensityDirty = true;
}
void CLight::SetAngleAttenuation(float constant, float linear, float quadratic) {
x30_angleC = constant;
x34_angleL = linear;
@ -105,9 +111,10 @@ float CLight::GetRadius() const {
return x44_cachedRadius;
}
float CLight::CalculateLightRadius() const {
if (x28_distL < gkEpsilon32 && x2c_distQ < gkEpsilon32) {
return FLT_MAX;
return 3.0E36f;
}
float intensity = GetIntensity();
@ -140,6 +147,11 @@ float CLight::GetIntensity() const {
}
return x48_cachedIntensity;
}
// Hack for float ordering
static void StrippedFunc() {
static float f1 = -1.f;
static float f2 = 0.f;
}
CVector3f CLight::GetNormalIndependentLightingAtPoint(const CVector3f& point) const {
CVector3f floatCol(x18_color.GetRed(), x18_color.GetGreen(), x18_color.GetBlue());