Skip to content

Commit

Permalink
GI tweak buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Nov 8, 2024
1 parent 5186e89 commit 55d8cd6
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 25 deletions.
56 changes: 48 additions & 8 deletions data/gui/Editor_Options.layout
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,30 @@


<!-- 🕳️ SSAO -->
<Widget type="Button" skin="CheckBox" position="28 120 356 24" name="SSAO">
<Widget type="Button" skin="CheckBox" position="28 70 356 24" name="SSAO">
<Property key="Caption" value="#{SSAO} #704040 = #{NotDone}"/>
<Property key="TextColour" value="0.3 0.7 1"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 150 248 24">
<Widget type="TextBox" skin="TextBox" position="32 100 248 24">
<Property key="Caption" value="#{Brush_Size}"/>
<Property key="TextColour" value="0.5 0.7 0.9"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="296 150 48 24" name="SsaoRadiusVal">
<Widget type="TextBox" skin="TextBox" position="296 100 48 24" name="SsaoRadiusVal">
<Property key="TextColour" value="0.5 0.7 0.9"/>
</Widget>
<Widget type="Slider" skin="Slider" position="344 150 216 16" name="SsaoRadius">
<Widget type="Slider" skin="Slider" position="344 100 216 16" name="SsaoRadius">
<Property key="Colour" value="0.5 0.7 0.9"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 180 248 24">
<Widget type="TextBox" skin="TextBox" position="32 130 248 24">
<Property key="Caption" value="#{Brush_Power}"/>
<Property key="TextColour" value="0.5 0.9 0.9"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="296 180 48 24" name="SsaoScaleVal">
<Widget type="TextBox" skin="TextBox" position="296 130 48 24" name="SsaoScaleVal">
<Property key="TextColour" value="0.5 0.9 0.9"/>
</Widget>
<Widget type="Slider" skin="Slider" position="344 180 216 16" name="SsaoScale">
<Widget type="Slider" skin="Slider" position="344 130 216 16" name="SsaoScale">
<Property key="Colour" value="0.5 0.9 0.9"/>
</Widget>

Expand All @@ -221,7 +221,47 @@
<Property key="Caption" value="#{GI} #603030 = #{NotDone}"/>
<Property key="TextColour" value="1 0.5 0.7"/>
</Widget>


<Widget type="Button" skin="Button" position="28 260 80 24" name="GInext">
<Property key="Caption" value="Next"/>
<Property key="Colour" value="0.5 0.97 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="128 260 80 24" name="GIhq">
<Property key="Caption" value="HQ"/>
<Property key="Colour" value="0.9 0.97 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="228 260 80 24" name="GIvis">
<Property key="Caption" value="Vis Next"/>
<Property key="Colour" value="0.9 0.57 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="328 260 90 24" name="GIvis2">
<Property key="Caption" value="Vis Ifd Probe"/>
<Property key="Colour" value="0.9 0.67 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="428 260 90 24" name="GIbncInc">
<Property key="Caption" value="Bounces+"/>
<Property key="Colour" value="0.9 1.0 0.9"/>
<Property key="TextColour" value="0.9 1.0 0.9"/>
</Widget>
<Widget type="Button" skin="Button" position="528 260 90 24" name="GIbncDec">
<Property key="Caption" value="Bounces-"/>
<Property key="Colour" value="0.8 0.9 1.0"/>
<Property key="TextColour" value="0.8 0.9 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="628 260 90 24" name="GIiso">
<Property key="Caption" value="Isotropic"/>
<Property key="Colour" value="0.9 1 1.0"/>
<Property key="TextColour" value="0.9 1 1.0"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="28 290 648 454" name="GItext">
<Property key="TextColour" value="0.8 0.9 1.0"/>
</Widget>


<!-- <Widget type="Button" skin="CheckBox" position="28 150 256 24" name="SoftParticles">
<Property key="Caption" value="#{SoftParticles}"/>
Expand Down
56 changes: 48 additions & 8 deletions data/gui/Game_Options.layout
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,30 @@


<!-- 🕳️ SSAO -->
<Widget type="Button" skin="CheckBox" position="28 120 356 24" name="SSAO">
<Widget type="Button" skin="CheckBox" position="28 70 356 24" name="SSAO">
<Property key="Caption" value="#{SSAO} #704040 = #{NotDone}"/>
<Property key="TextColour" value="0.3 0.7 1"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 150 248 24">
<Widget type="TextBox" skin="TextBox" position="32 100 248 24">
<Property key="Caption" value="#{Brush_Size}"/>
<Property key="TextColour" value="0.5 0.7 0.9"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="296 150 48 24" name="SsaoRadiusVal">
<Widget type="TextBox" skin="TextBox" position="296 100 48 24" name="SsaoRadiusVal">
<Property key="TextColour" value="0.5 0.7 0.9"/>
</Widget>
<Widget type="Slider" skin="Slider" position="344 150 216 16" name="SsaoRadius">
<Widget type="Slider" skin="Slider" position="344 100 216 16" name="SsaoRadius">
<Property key="Colour" value="0.5 0.7 0.9"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="32 180 248 24">
<Widget type="TextBox" skin="TextBox" position="32 130 248 24">
<Property key="Caption" value="#{Brush_Power}"/>
<Property key="TextColour" value="0.5 0.9 0.9"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position="296 180 48 24" name="SsaoScaleVal">
<Widget type="TextBox" skin="TextBox" position="296 130 48 24" name="SsaoScaleVal">
<Property key="TextColour" value="0.5 0.9 0.9"/>
</Widget>
<Widget type="Slider" skin="Slider" position="344 180 216 16" name="SsaoScale">
<Widget type="Slider" skin="Slider" position="344 130 216 16" name="SsaoScale">
<Property key="Colour" value="0.5 0.9 0.9"/>
</Widget>

Expand All @@ -221,7 +221,47 @@
<Property key="Caption" value="#{GI} #603030 = #{NotDone}"/>
<Property key="TextColour" value="1 0.5 0.7"/>
</Widget>


<Widget type="Button" skin="Button" position="28 260 80 24" name="GInext">
<Property key="Caption" value="Next"/>
<Property key="Colour" value="0.5 0.97 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="128 260 80 24" name="GIhq">
<Property key="Caption" value="HQ"/>
<Property key="Colour" value="0.9 0.97 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="228 260 80 24" name="GIvis">
<Property key="Caption" value="Vis Next"/>
<Property key="Colour" value="0.9 0.57 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="328 260 90 24" name="GIvis2">
<Property key="Caption" value="Vis Ifd Probe"/>
<Property key="Colour" value="0.9 0.67 1.0"/>
<Property key="TextColour" value="0.9 0.97 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="428 260 90 24" name="GIbncInc">
<Property key="Caption" value="Bounces+"/>
<Property key="Colour" value="0.9 1.0 0.9"/>
<Property key="TextColour" value="0.9 1.0 0.9"/>
</Widget>
<Widget type="Button" skin="Button" position="528 260 90 24" name="GIbncDec">
<Property key="Caption" value="Bounces-"/>
<Property key="Colour" value="0.8 0.9 1.0"/>
<Property key="TextColour" value="0.8 0.9 1.0"/>
</Widget>
<Widget type="Button" skin="Button" position="628 260 90 24" name="GIiso">
<Property key="Caption" value="Isotropic"/>
<Property key="Colour" value="0.9 1 1.0"/>
<Property key="TextColour" value="0.9 1 1.0"/>
</Widget>

<Widget type="TextBox" skin="TextBox" position="28 290 648 454" name="GItext">
<Property key="TextColour" value="0.8 0.9 1.0"/>
</Widget>


<!-- <Widget type="Button" skin="CheckBox" position="28 150 256 24" name="SoftParticles">
<Property key="Caption" value="#{SoftParticles}"/>
Expand Down
2 changes: 1 addition & 1 deletion src/common/AppGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,5 @@ class AppGui : public BGui
void GItoggletVctQuality(), GInextIrradianceField(int add);
void GInextVisMode(int add), GInextIfdProbeVisMode(int add); // visualize

// void generateDebugText( float timeSinceLast, Ogre::String &outText ) override;
void GIText();
};
46 changes: 45 additions & 1 deletion src/common/AppGui_GI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "SceneXml.h"
#include "CScene.h"
// #include "CData.h"
#include "GuiCom.h"
#include "GraphicsSystem.h"

#include <OgreRoot.h>
Expand Down Expand Up @@ -31,7 +32,7 @@ void AppGui::InitGI()
mIfdDebugVisMode = IrradianceField::DebugVisualizationNone;

mVoxelizer = new VctVoxelizer( Id::generateNewId<VctVoxelizer>(),
mRoot->getRenderSystem(), mRoot->getHlmsManager(), true );
mRoot->getRenderSystem(), mRoot->getHlmsManager(), true );

mIrradianceField = new IrradianceField( mRoot, mSceneMgr );

Expand All @@ -41,8 +42,16 @@ void AppGui::InitGI()

hlmsPbs->setIrradianceField( mIrradianceField );

LogO("*()* GI init mode: "+GIstrMode());

GIVoxelizeScene(); // !

GItoggletVctQuality();
// GInextIrradianceField(1);
// GInextVisMode( 1 );
// GInextIfdProbeVisMode( 1 );
GIText();

LogO(String("*()* GI Init end: ") + fToStr(ti.getMilliseconds(),0,3) + " ms");
}

Expand Down Expand Up @@ -161,6 +170,7 @@ String AppGui::GIstrMode() const
return "None";
}


//-----------------------------------------------------------------------------------
void AppGui::GInextIfdProbeVisMode( int add )
{
Expand Down Expand Up @@ -211,6 +221,7 @@ void AppGui::GInextIrradianceField( int add )
}
}


// 🌄🔁 Voxelize scene
//-----------------------------------------------------------------------------------
void AppGui::GIVoxelizeScene()
Expand Down Expand Up @@ -290,3 +301,36 @@ void AppGui::GIVoxelizeScene()

LogO(String("*[]* GI Voxelize end: ") + fToStr(ti.getMilliseconds(),0,3) + " ms");
}

// info
//-----------------------------------------------------------------------------------
void AppGui::GIText()
{
if (!gcom->txGIinfo) return;
HlmsManager *hlmsManager = mRoot->getHlmsManager();
assert( dynamic_cast<HlmsPbs *>( hlmsManager->getHlms( HLMS_PBS ) ) );
HlmsPbs *hlmsPbs = static_cast<HlmsPbs *>( hlmsManager->getHlms( HLMS_PBS ) );

static const String visModes[] =
{ "Albedo", "Normal", "Emissive", "None", "Lighting" };

static const String ifdProbeVisModes[] =
{ "Irradiance", "Depth", "None" };

String s = "GI mode: " + GIstrMode() +
" VCT: " + (hlmsPbs->getVctFullConeCount() ? "HQ" : "LQ");
s += "\n";
if (mVctLighting)
{
s += String("VCT: ") + (mVctLighting->isAnisotropic() ? "Anisotropic" : "Isotropic");
s += " Num bounces: "+toStr(mNumBounces) + " thin wall: "+fToStr(mThinWallCounter);
}
s += "\nVis mode: " + visModes[mDebugVisMode];

auto gi = GIgetMode();
if (gi == IfdVct || gi == Ifd)
{ s += String("\nGenerate IFD via: ") + (mUseRasterIrradianceField ? "Raster" : "Voxels");
s += String(" IFD debug vis: ") + ifdProbeVisModes[mIfdDebugVisMode];
}
gcom->txGIinfo->setCaption(s);
}
3 changes: 3 additions & 0 deletions src/common/GuiCom.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ class CGuiCom : public BGui
SV svSsaoRadius, svSsaoScale;

Ck ckGI;
Txt txGIinfo =0;
void btnGInext(WP), btnGIhq(WP), btnGIvis(WP), btnGIvis2(WP);
void btnGIbncInc(WP), btnGIbncDec(WP), btnGIiso(WP);

// CK(AllEffects);
// Ck ckSoftPar, ckHDR, ckBloom, ckMotBlur, ckGodRays;
Expand Down
77 changes: 72 additions & 5 deletions src/common/GuiCom_Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
#include "settings.h"
#include "App.h"
#include "Cam.h"
#include "Road.h"
// #include "Road.h"
#include "Grass.h"
#ifndef SR_EDITOR
#include "game.h"
#endif
#include "CGui.h"
#include "Slider.h"
#include "Terra.h"
// #include "Slider.h"
// #include "Terra.h"
#include <OgreCamera.h>
#include <Vct/OgreVctLighting.h>
#include <Vct/OgreVctVoxelizer.h>
#include <IrradianceField/OgreIrradianceField.h>
#include <MyGUI.h>
using namespace MyGUI;
using namespace Ogre;
Expand Down Expand Up @@ -228,11 +231,15 @@ void CGuiCom::GuiInitGraphics() // ? not yet: called on preset change with bGI

// 🪄 Effects
//------------------------------------------------------------
ck= &ckSSAO; ck->Init("SSAO", &pSet->ssao);
ck= &ckSSAO; ck->Init("SSAO", &pSet->ssao); // 🕳️ SSAO
sv= &svSsaoRadius; sv->Init("SsaoRadius", &pSet->ssao_radius, 0.1,6.f); sv->DefaultF(1.f);
sv= &svSsaoScale; sv->Init("SsaoScale", &pSet->ssao_scale, 0.1,6.f); sv->DefaultF(1.5f);

ck= &ckGI; ck->Init("GI", &pSet->gi);
ck= &ckGI; ck->Init("GI", &pSet->gi); // 🌄 GI
txGIinfo = fTxt("GItext");
BtnC("GInext", btnGInext); BtnC("GIhq", btnGIhq); BtnC("GIiso", btnGIiso);
BtnC("GIvis", btnGIvis); BtnC("GIvis2", btnGIvis2);
BtnC("GIbncInc", btnGIbncInc); BtnC("GIbncDec", btnGIbncDec);

// ck= &ckAllEffects; ck->Init("AllEffects", &pSet->all_effects); Cev(AllEffects);

Expand Down Expand Up @@ -298,6 +305,64 @@ void CGuiCom::slFps(SV*)

// events
//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
// 🌄 GI
void CGuiCom::btnGInext(WP)
{
app->GInextIrradianceField(1);
app->GIText();
}
void CGuiCom::btnGIhq(WP)
{
app->GItoggletVctQuality();
app->GIText();
}
void CGuiCom::btnGIvis(WP)
{
app->GInextVisMode(1);
app->GIText();
}
void CGuiCom::btnGIvis2(WP)
{
app->GInextIfdProbeVisMode(1);
app->GIText();
}
void CGuiCom::btnGIbncInc(WP)
{
++app->mNumBounces;
if (app->mVctLighting)
app->mVctLighting->update( app->mSceneMgr, app->mNumBounces, app->mThinWallCounter );
if (app->mIrradianceField)
app->mIrradianceField->reset();
app->GIText();
}
void CGuiCom::btnGIbncDec(WP)
{
if (app->mNumBounces > 0)
--app->mNumBounces;
if (app->mVctLighting)
app->mVctLighting->update( app->mSceneMgr, app->mNumBounces, app->mThinWallCounter );
if (app->mIrradianceField)
app->mIrradianceField->reset();
app->GIText();
}
void CGuiCom::btnGIiso(WP)
{
if (app->mVctLighting)
{ app->mVctLighting->setAnisotropic( !app->mVctLighting->isAnisotropic() );
app->mVctLighting->update( app->mSceneMgr, app->mNumBounces, app->mThinWallCounter );
}app->GIText();
}
/* more -
auto giMode = getGiMode();
if (giMode == IfdVct || giMode == IfdOnly)
{
mUseRasterIrradianceField = !mUseRasterIrradianceField;
voxelizeScene();
}*/
//-----------------------------------------------------------------------------------


// Tex
void CGuiCom::cmbTexFilter(CMB)
{
pSet->g.tex_filt = val;
Expand All @@ -309,6 +374,7 @@ void CGuiCom::slAnisotropy(SV*)
app->SetAnisotropy();
}

// Lod
void CGuiCom::slViewDist(SV*)
{
app->scn->UpdSkyScale();
Expand Down Expand Up @@ -422,6 +488,7 @@ void CGuiCom::slCarLightBright(SV*)
}


// mat ed
void CGuiCom::btnMatEditor(WP)
{
#ifdef SR_EDITOR
Expand Down
Loading

0 comments on commit 55d8cd6

Please sign in to comment.