Update dew, fix no lighting mode

pull/18/head
Jack Andersen 4 years ago
parent 875c0fb9fd
commit 30c1646f02
  1. 3
      CMakeLists.txt
  2. 7
      dew.cmake
  3. 2
      dewfile.json
  4. 2
      src/Core/CMakeLists.txt
  5. 1
      src/Core/GameProject/CGameExporter.cpp
  6. 2
      src/Core/GameProject/CGameExporter.h
  7. 3
      src/Core/GameProject/CGameProject.cpp
  8. 69
      src/Core/Resource/Model/CStaticModel.cpp
  9. 4
      src/Core/Scene/CStaticNode.cpp
  10. 3
      src/Editor/CollisionEditor/CCollisionEditorViewport.cpp
  11. 16
      src/Editor/ModelEditor/CModelEditorViewport.cpp

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

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

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

@ -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]()
{
// 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
{
CIndexBuffer *pIBO = &mIBOs[iIBO];
pIBO->Bind();
glDrawElements(pIBO->GetPrimitiveType(), pIBO->GetSize(), GL_UNSIGNED_SHORT, (void*) 0);
pIBO->Unbind();
gDrawCount++;
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);

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

@ -81,9 +81,12 @@ 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);
CDrawUtil::DrawSphere(true);
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,9 +103,12 @@ void CModelEditorViewport::Paint()
CGraphics::sMVPBlock.ProjectionMatrix = CMatrix4f::skIdentity;
CGraphics::UpdateMVPBlock();
mpActiveMaterial->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));
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();

Loading…
Cancel
Save