add interface for sun clamp

This commit is contained in:
Ian Curtis 2017-09-02 14:54:16 +00:00
parent 266c911133
commit 2786d95795
5 changed files with 35 additions and 2 deletions

View file

@ -18,6 +18,7 @@ public:
virtual void AttachMemory(const uint32_t *cullingRAMLoPtr, const uint32_t *cullingRAMHiPtr, const uint32_t *polyRAMPtr, const uint32_t *vromPtr, const uint16_t *textureRAMPtr) = 0;
virtual void SetStepping(int stepping) = 0;
virtual bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes, unsigned totalXRes, unsigned totalYRes) = 0;
virtual void SetSunClamp(bool enable) = 0;
virtual ~IRender3D()
{

View file

@ -1297,6 +1297,10 @@ bool CLegacy3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
return OKAY;
}
void CLegacy3D::SetSunClamp(bool enable)
{
}
CLegacy3D::CLegacy3D(const Util::Config::Node &config)
: m_config(config)
{

View file

@ -327,6 +327,16 @@ public:
* destructor is called. Prints own error messages.
*/
bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes, unsigned totalXRes, unsigned totalYRes);
/*
* SetSunClamp(bool enable);
*
* Sets or unsets the clamped light model
*
* Parameters:
* enable Set clamp mode
*/
void SetSunClamp(bool enable);
/*
* CLegacy3D(void):

View file

@ -24,6 +24,7 @@ CNew3D::CNew3D(const Util::Config::Node &config, std::string gameName)
m_polyRAM = nullptr;
m_vrom = nullptr;
m_textureRAM = nullptr;
m_sunClamp = true;
}
CNew3D::~CNew3D()
@ -791,12 +792,13 @@ void CNew3D::RenderViewport(UINT32 addr)
m_gameName == "von2" ||
m_gameName == "von254g" ||
m_gameName == "von2a") {
vp->sunClamp = false;
m_sunClamp = false;
}
else {
vp->sunClamp = true;
m_sunClamp = true;
}
vp->sunClamp = m_sunClamp;
vp->intensityClamp = (m_step == 0x10); // just step 1.0 ?
vp->hardwareStep = m_step;
@ -1608,5 +1610,10 @@ void CNew3D::CalcViewport(Viewport* vp, float near, float far)
}
}
void CNew3D::SetSunClamp(bool enable)
{
m_sunClamp = enable;
}
} // New3D

View file

@ -141,6 +141,16 @@ public:
*/
bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes, unsigned totalXRes, unsigned totalYRes);
/*
* SetSunClamp(bool enable);
*
* Sets or unsets the clamped light model
*
* Parameters:
* enable Set clamp mode
*/
void SetSunClamp(bool enable);
/*
* CRender3D(config):
* ~CRender3D(void):
@ -193,6 +203,7 @@ private:
// Misc
std::string m_gameName;
bool m_sunClamp;
// Stepping
int m_step;