Update dew, fix no lighting mode

This commit is contained in:
Jack Andersen 2019-11-24 16:46:57 -10:00
parent 875c0fb9fd
commit 30c1646f02
11 changed files with 80 additions and 32 deletions

View File

@ -5,10 +5,11 @@ set(MACOSX_DEPLOYMENT_TARGET 10.10)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
project(PrimeWorldEditor CXX)
option(PWE_PUBLIC_RELEASE "Enable end-user deployment configuration for PWE" OFF)
option(PWE_PUBLIC_RELEASE "Enable end-user deployment configuration for PWE" ON)
if (PWE_PUBLIC_RELEASE)
add_compile_definitions(PUBLIC_RELEASE=1)
message(STATUS "Enabled public release mode")

View File

@ -17,6 +17,13 @@ function(integrate_dew)
return()
endif()
#
# Advise the user that setting the build type is necessary for debug dependencies.
#
if (NOT CMAKE_BUILD_TYPE)
message(WARNING "CMAKE_BUILD_TYPE is not set. Dew will build release dependencies by default.")
endif()
#
# Acquaint CMake with dew prefix
#

View File

@ -28,7 +28,7 @@
"url": "https://github.com/AxioDL/nod",
"type": "git",
"head": "master",
"ref": "a1284ae06586b958f36b8ecaba29390835ed2820"
"ref": "f147e1235646b849f78a8574a6d554214b70792d"
},
{
"name": "lzokay",

View File

@ -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)

View File

@ -12,6 +12,7 @@
#include <Common/Serialization/CXMLWriter.h>
#include <nod/nod.hpp>
#include <nod/DiscBase.hpp>
#include <tinyxml2.h>
#define LOAD_PAKS 1

View File

@ -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
{

View File

@ -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)

View File

@ -109,12 +109,12 @@ void CStaticModel::Draw(FRenderOptions Options)
{
if (!mBuffered) BufferGL();
if ((Options & ERenderOption::NoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
// Draw IBOs
mVBO.Bind();
glLineWidth(1.f);
auto DoDraw = [this]()
{
// Draw IBOs
for (uint32 iIBO = 0; iIBO < mIBOs.size(); iIBO++)
{
CIndexBuffer *pIBO = &mIBOs[iIBO];
@ -123,6 +123,21 @@ void CStaticModel::Draw(FRenderOptions Options)
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,8 +148,9 @@ void CStaticModel::DrawSurface(FRenderOptions Options, uint32 Surface)
mVBO.Bind();
glLineWidth(1.f);
if ((Options & ERenderOption::NoMaterialSetup) == 0) mpMaterial->SetCurrent(Options);
auto DoDraw = [this, Surface]()
{
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
@ -148,6 +164,21 @@ void CStaticModel::DrawSurface(FRenderOptions Options, uint32 Surface)
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();
}

View File

@ -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);

View File

@ -37,5 +37,6 @@ void CCollisionEditorViewport::Paint()
void CCollisionEditorViewport::OnResize()
{
mpRenderer->SetViewportSize(width(), height());
qreal pixelRatio = devicePixelRatioF();
mpRenderer->SetViewportSize(width() * pixelRatio, height() * pixelRatio);
}

View File

@ -81,10 +81,13 @@ void CModelEditorViewport::Paint()
CGraphics::UpdateMVPBlock();
CGraphics::SetDefaultLighting();
CGraphics::UpdateLightBlock(); // Note: vertex block is updated by the material
mpActiveMaterial->SetCurrent(ERenderOption::EnableUVScroll | ERenderOption::EnableBackfaceCull | ERenderOption::EnableOccluders);
for (CMaterial* passMat = mpActiveMaterial; passMat; passMat = passMat->GetNextDrawPass())
{
passMat->SetCurrent(ERenderOption::EnableUVScroll | ERenderOption::EnableBackfaceCull | ERenderOption::EnableOccluders);
CDrawUtil::DrawSphere(true);
}
}
else if (mMode == EDrawMode::DrawSquare)
{
@ -100,10 +103,13 @@ void CModelEditorViewport::Paint()
CGraphics::sMVPBlock.ProjectionMatrix = CMatrix4f::skIdentity;
CGraphics::UpdateMVPBlock();
mpActiveMaterial->SetCurrent(ERenderOption::EnableUVScroll | ERenderOption::EnableOccluders);
for (CMaterial* passMat = mpActiveMaterial; passMat; passMat = passMat->GetNextDrawPass())
{
passMat->SetCurrent(ERenderOption::EnableUVScroll | ERenderOption::EnableOccluders);
float Aspect = (float) width() / (float) height();
CDrawUtil::DrawSquare(CVector2f(0,1), CVector2f(1 * Aspect, 1), CVector2f(1 * Aspect, 0), CVector2f(0,0));
}
}
mpRenderer->EndFrame();
}