mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-16 17:35:39 +00:00
refactor
This commit is contained in:
parent
eece2d75b4
commit
10a5d2c0e1
|
@ -940,6 +940,48 @@ void CNew3D::OffsetTexCoords(R3DPoly& r3dPoly, float offset[2])
|
|||
}
|
||||
}
|
||||
|
||||
void CNew3D::SetMeshValues(SortingMesh *currentMesh, PolyHeader &ph)
|
||||
{
|
||||
//copy attributes
|
||||
currentMesh->doubleSided = false; // we will double up polys
|
||||
currentMesh->textured = ph.TexEnabled();
|
||||
currentMesh->alphaTest = ph.AlphaTest();
|
||||
currentMesh->textureAlpha = ph.TextureAlpha();
|
||||
currentMesh->polyAlpha = ph.PolyAlpha();
|
||||
currentMesh->lighting = ph.LightEnabled() && !ph.FixedShading();
|
||||
|
||||
if (ph.Layered() || (!ph.TexEnabled() && ph.PolyAlpha())) {
|
||||
currentMesh->layered = true;
|
||||
}
|
||||
|
||||
if (currentMesh->lighting) {
|
||||
if (ph.SpecularEnabled()) {
|
||||
currentMesh->specular = true;
|
||||
currentMesh->shininess = 0;// ph.Shininess();
|
||||
currentMesh->specularCoefficient = 0; // ph.SpecularValue();
|
||||
}
|
||||
}
|
||||
|
||||
currentMesh->fogIntensity = ph.LightModifier();
|
||||
|
||||
if (ph.TexEnabled()) {
|
||||
currentMesh->format = m_texSheet.GetTexFormat(ph.TexFormat(), ph.AlphaTest());
|
||||
|
||||
if (currentMesh->format == 7) {
|
||||
currentMesh->alphaTest = false; // alpha test is a 1 bit test, this format needs a lower threshold, since it has 16 levels of transparency
|
||||
}
|
||||
|
||||
currentMesh->x = ph.X();
|
||||
currentMesh->y = ph.Y();
|
||||
currentMesh->width = ph.TexWidth();
|
||||
currentMesh->height = ph.TexHeight();
|
||||
currentMesh->mirrorU = ph.TexUMirror();
|
||||
currentMesh->mirrorV = ph.TexVMirror();
|
||||
currentMesh->microTexture = ph.MicroTexture();
|
||||
currentMesh->microTextureID = ph.MicroTextureID();
|
||||
}
|
||||
}
|
||||
|
||||
void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
||||
{
|
||||
Vertex prev[4];
|
||||
|
@ -985,44 +1027,8 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
|||
//make space for our vertices
|
||||
currentMesh->polys.reserve(numTriangles);
|
||||
|
||||
//copy attributes
|
||||
currentMesh->doubleSided = false; // we will double up polys
|
||||
currentMesh->textured = ph.TexEnabled();
|
||||
currentMesh->alphaTest = ph.AlphaTest();
|
||||
currentMesh->textureAlpha = ph.TextureAlpha();
|
||||
currentMesh->polyAlpha = ph.PolyAlpha();
|
||||
currentMesh->lighting = ph.LightEnabled() && !ph.FixedShading();
|
||||
|
||||
if (ph.Layered() || (!ph.TexEnabled() && ph.PolyAlpha())) {
|
||||
currentMesh->layered = true;
|
||||
}
|
||||
|
||||
if (currentMesh->lighting) {
|
||||
if (ph.SpecularEnabled()) {
|
||||
currentMesh->specular = true;
|
||||
currentMesh->shininess = 0;// ph.Shininess();
|
||||
currentMesh->specularCoefficient = 0; // ph.SpecularValue();
|
||||
}
|
||||
}
|
||||
|
||||
currentMesh->fogIntensity = ph.LightModifier();
|
||||
|
||||
if (ph.TexEnabled()) {
|
||||
currentMesh->format = m_texSheet.GetTexFormat(ph.TexFormat(), ph.AlphaTest());
|
||||
|
||||
if (currentMesh->format == 7) {
|
||||
currentMesh-> alphaTest = false; // alpha test is a 1 bit test, this format needs a lower threshold, since it has 16 levels of transparency
|
||||
}
|
||||
|
||||
currentMesh->x = ph.X();
|
||||
currentMesh->y = ph.Y();
|
||||
currentMesh->width = ph.TexWidth();
|
||||
currentMesh->height = ph.TexHeight();
|
||||
currentMesh->mirrorU = ph.TexUMirror();
|
||||
currentMesh->mirrorV = ph.TexVMirror();
|
||||
currentMesh->microTexture = ph.MicroTexture();
|
||||
currentMesh->microTextureID = ph.MicroTextureID();
|
||||
}
|
||||
//set mesh values
|
||||
SetMeshValues(currentMesh, ph);
|
||||
}
|
||||
|
||||
currentMesh = &sMap[hash];
|
||||
|
|
|
@ -170,6 +170,7 @@ private:
|
|||
void RenderViewport(UINT32 addr);
|
||||
|
||||
// building the scene
|
||||
void SetMeshValues(SortingMesh *currentMesh, PolyHeader &ph);
|
||||
void CacheModel(Model *m, const UINT32 *data);
|
||||
void CopyVertexData(const R3DPoly& r3dPoly, std::vector<Poly>& polyArray);
|
||||
void OffsetTexCoords(R3DPoly& r3dPoly, float offset[2]);
|
||||
|
|
Loading…
Reference in a new issue