mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 09:25:31 +00:00
Update dew, fix no lighting mode
This commit is contained in:
@@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.12)
|
||||
project(pwe_core CXX C)
|
||||
|
||||
find_package(tinyxml2 CONFIG REQUIRED)
|
||||
find_package(nod CONFIG REQUIRED)
|
||||
find_package(logvisor CONFIG REQUIRED)
|
||||
find_package(nod CONFIG REQUIRED)
|
||||
find_package(lzokay CONFIG REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(assimp CONFIG REQUIRED)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <Common/Serialization/CXMLWriter.h>
|
||||
|
||||
#include <nod/nod.hpp>
|
||||
#include <nod/DiscBase.hpp>
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#define LOAD_PAKS 1
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <Common/Flags.h>
|
||||
#include <Common/TString.h>
|
||||
#include <map>
|
||||
#include <nod/nod.hpp>
|
||||
#include <nod/DiscBase.hpp>
|
||||
|
||||
enum class EDiscType
|
||||
{
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include "IUIRelay.h"
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
#include <Common/Serialization/XML.h>
|
||||
#include <nod/nod.hpp>
|
||||
#include <nod/DiscGCN.hpp>
|
||||
#include <nod/DiscWii.hpp>
|
||||
|
||||
#if NOD_UCS2
|
||||
#define TStringToNodString(string) ToWChar(string)
|
||||
|
||||
@@ -109,19 +109,34 @@ void CStaticModel::Draw(FRenderOptions Options)
|
||||
{
|
||||
if (!mBuffered) BufferGL();
|
||||
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
|
||||
|
||||
// Draw IBOs
|
||||
mVBO.Bind();
|
||||
glLineWidth(1.f);
|
||||
|
||||
for (uint32 iIBO = 0; iIBO < mIBOs.size(); iIBO++)
|
||||
auto DoDraw = [this]()
|
||||
{
|
||||
CIndexBuffer *pIBO = &mIBOs[iIBO];
|
||||
pIBO->Bind();
|
||||
glDrawElements(pIBO->GetPrimitiveType(), pIBO->GetSize(), GL_UNSIGNED_SHORT, (void*) 0);
|
||||
pIBO->Unbind();
|
||||
gDrawCount++;
|
||||
// Draw IBOs
|
||||
for (uint32 iIBO = 0; iIBO < mIBOs.size(); iIBO++)
|
||||
{
|
||||
CIndexBuffer *pIBO = &mIBOs[iIBO];
|
||||
pIBO->Bind();
|
||||
glDrawElements(pIBO->GetPrimitiveType(), pIBO->GetSize(), GL_UNSIGNED_SHORT, (void*) 0);
|
||||
pIBO->Unbind();
|
||||
gDrawCount++;
|
||||
}
|
||||
};
|
||||
|
||||
// Bind material
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0)
|
||||
{
|
||||
for (CMaterial* passMat = mpMaterial; passMat; passMat = passMat->GetNextDrawPass())
|
||||
{
|
||||
passMat->SetCurrent(Options);
|
||||
DoDraw();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DoDraw();
|
||||
}
|
||||
|
||||
mVBO.Unbind();
|
||||
@@ -133,20 +148,36 @@ void CStaticModel::DrawSurface(FRenderOptions Options, uint32 Surface)
|
||||
|
||||
mVBO.Bind();
|
||||
glLineWidth(1.f);
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
|
||||
|
||||
for (uint32 iIBO = 0; iIBO < mIBOs.size(); iIBO++)
|
||||
auto DoDraw = [this, Surface]()
|
||||
{
|
||||
// Since there is a shared IBO for every mesh, we need two things to draw a single one: an offset and a size
|
||||
uint32 Offset = 0;
|
||||
if (Surface > 0) Offset = mSurfaceEndOffsets[iIBO][Surface - 1];
|
||||
uint32 Size = mSurfaceEndOffsets[iIBO][Surface] - Offset;
|
||||
for (uint32 iIBO = 0; iIBO < mIBOs.size(); iIBO++)
|
||||
{
|
||||
// Since there is a shared IBO for every mesh, we need two things to draw a single one: an offset and a size
|
||||
uint32 Offset = 0;
|
||||
if (Surface > 0) Offset = mSurfaceEndOffsets[iIBO][Surface - 1];
|
||||
uint32 Size = mSurfaceEndOffsets[iIBO][Surface] - Offset;
|
||||
|
||||
if (!Size) continue; // The chosen submesh doesn't use this IBO
|
||||
if (!Size) continue; // The chosen submesh doesn't use this IBO
|
||||
|
||||
// Now we have both, so we can draw
|
||||
mIBOs[iIBO].DrawElements(Offset, Size);
|
||||
gDrawCount++;
|
||||
// Now we have both, so we can draw
|
||||
mIBOs[iIBO].DrawElements(Offset, Size);
|
||||
gDrawCount++;
|
||||
}
|
||||
};
|
||||
|
||||
// Bind material
|
||||
if ((Options & ERenderOption::NoMaterialSetup) == 0)
|
||||
{
|
||||
for (CMaterial* passMat = mpMaterial; passMat; passMat = passMat->GetNextDrawPass())
|
||||
{
|
||||
passMat->SetCurrent(Options);
|
||||
DoDraw();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DoDraw();
|
||||
}
|
||||
|
||||
mVBO.Unbind();
|
||||
|
||||
@@ -63,6 +63,7 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderComman
|
||||
{
|
||||
CGraphics::sNumLights = 0;
|
||||
CGraphics::sVertexBlock.COLOR0_Amb = UseWhiteAmbient ? CColor::skTransparentWhite : CColor::skTransparentBlack;
|
||||
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skBlack;
|
||||
CGraphics::sPixelBlock.LightmapMultiplier = 1.0f;
|
||||
CGraphics::UpdateLightBlock();
|
||||
}
|
||||
@@ -72,10 +73,9 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, ERenderComman
|
||||
LoadLights(rkViewInfo);
|
||||
if (CGraphics::sLightMode == CGraphics::ELightingMode::None || UseWhiteAmbient)
|
||||
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skTransparentWhite;
|
||||
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skWhite;
|
||||
}
|
||||
|
||||
CGraphics::sVertexBlock.COLOR0_Mat = CColor::skBlack;
|
||||
|
||||
float Mul = CGraphics::sWorldLightMultiplier;
|
||||
CGraphics::sPixelBlock.SetAllTevColors(CColor(Mul,Mul,Mul));
|
||||
CGraphics::sPixelBlock.TintColor = TintColor(rkViewInfo);
|
||||
|
||||
Reference in New Issue
Block a user