mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Implementation of reflection and skylight probes.
Moves lighting math to the diffuse/specular two-channel logic.
This commit is contained in:
parent
83dd55e851
commit
2be32ad737
102 changed files with 12346 additions and 1911 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -877,6 +877,24 @@ function ObjectBuilderGui::buildParticleSimulation(%this)
|
|||
%this.process();
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildReflectionProbe(%this)
|
||||
{
|
||||
%this.objectClassName = "ReflectionProbe";
|
||||
%this.process();
|
||||
|
||||
%defaultPath = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%this.addField("reflectionPath", "TypeFilepath", "reflectionPath", %defaultPath);
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildSkylight(%this)
|
||||
{
|
||||
%this.objectClassName = "Skylight";
|
||||
%this.process();
|
||||
|
||||
%defaultPath = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%this.addField("reflectionPath", "TypeFilepath", "reflectionPath", %defaultPath);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mission
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
192
Templates/Full/game/tools/worldEditor/gui/probeBakeDlg.gui
Normal file
192
Templates/Full/game/tools/worldEditor/gui/probeBakeDlg.gui
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl(ProbeBakeDlg) {
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiDefaultProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
text = "Update Environment Probes";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
canCollapse = "0";
|
||||
closeCommand = "Canvas.popDialog(ProbeBakeDlg);";
|
||||
edgeSnap = "0";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "392 314";
|
||||
extent = "270 164";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiWindowProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Probe Resolution";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "11 32";
|
||||
extent = "91 13";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(ProbeBakeDlg_ProbeResList) {
|
||||
maxPopupHeight = "200";
|
||||
sbUsesNAColor = "0";
|
||||
reverseTextList = "0";
|
||||
bitmapBounds = "16 16";
|
||||
text = "64";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "103 29";
|
||||
extent = "157 19";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Number of bake iterations";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "11 56";
|
||||
extent = "129 13";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl(ProbeBakeDlg_NumIterTxt) {
|
||||
historySize = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
password = "0";
|
||||
passwordMask = "*";
|
||||
text = "1";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "150 53";
|
||||
extent = "108 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextEditProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiButtonCtrl(ProbeBakeDlg_RunBake) {
|
||||
text = "Update Probes";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
position = "68 120";
|
||||
extent = "140 30";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiButtonProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiProgressCtrl(ProbeBakeDlg_Progress) {
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "8 80";
|
||||
extent = "251 25";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiProgressProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -43,6 +43,7 @@ function initializeWorldEditor()
|
|||
exec("./gui/AddFMODProjectDlg.ed.gui");
|
||||
exec("./gui/SelectObjectsWindow.ed.gui");
|
||||
exec("./gui/ProceduralTerrainPainterGui.gui" );
|
||||
exec("./gui/probeBakeDlg.gui" );
|
||||
|
||||
// Load Scripts.
|
||||
exec("./scripts/menus.ed.cs");
|
||||
|
|
@ -61,6 +62,7 @@ function initializeWorldEditor()
|
|||
exec("./scripts/ManageSFXParametersWindow.ed.cs");
|
||||
exec("./scripts/AddFMODProjectDlg.ed.cs");
|
||||
exec("./scripts/SelectObjectsWindow.ed.cs");
|
||||
exec("./scripts/probeBake.ed.cs");
|
||||
|
||||
// Load Custom Editors
|
||||
loadDirectory(expandFilename("./scripts/editors"));
|
||||
|
|
@ -115,10 +117,11 @@ function initializeWorldEditor()
|
|||
EVisibility.addOption( "Debug Render: Light Frustums", "$Light::renderLightFrustums", "" );
|
||||
EVisibility.addOption( "Debug Render: Bounding Boxes", "$Scene::renderBoundingBoxes", "" );
|
||||
EVisibility.addOption( "Debug Render: Physics World", "$PhysicsWorld::render", "togglePhysicsDebugViz" );
|
||||
EVisibility.addOption( "Debug Render: Reflection Probes", "$Light::renderReflectionProbes", "" );
|
||||
EVisibility.addOption( "Debug Render: Probe Previews", "$Light::renderPreviewProbes", "" );
|
||||
EVisibility.addOption( "AL: Disable Shadows", "$Shadows::disable", "" );
|
||||
EVisibility.addOption( "AL: Light Color Viz", "$AL_LightColorVisualizeVar", "toggleLightColorViz" );
|
||||
EVisibility.addOption( "AL: Environment Light", "$AL_LightMapShaderVar", "toggleLightMapViz" );
|
||||
EVisibility.addOption( "AL: Light Specular Viz", "$AL_LightSpecularVisualizeVar", "toggleLightSpecularViz" );
|
||||
EVisibility.addOption( "AL: Diffuse Lighting Viz", "$AL_LightColorVisualizeVar", "toggleLightColorViz" );
|
||||
EVisibility.addOption( "AL: Specular Lighting Viz", "$AL_LightSpecularVisualizeVar", "toggleLightSpecularViz" );
|
||||
EVisibility.addOption( "AL: Normals Viz", "$AL_NormalsVisualizeVar", "toggleNormalsViz" );
|
||||
EVisibility.addOption( "AL: Depth Viz", "$AL_DepthVisualizeVar", "toggleDepthViz" );
|
||||
EVisibility.addOption( "AL: Color Buffer", "$AL_ColorBufferShaderVar", "toggleColorBufferViz" );
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ function EWCreatorWindow::init( %this )
|
|||
|
||||
%this.registerMissionObject( "PointLight", "Point Light" );
|
||||
%this.registerMissionObject( "SpotLight", "Spot Light" );
|
||||
|
||||
%this.registerMissionObject( "ReflectionProbe", "Reflection Probe" );
|
||||
%this.registerMissionObject( "Skylight", "Skylight" );
|
||||
|
||||
%this.registerMissionObject( "GroundCover", "Ground Cover" );
|
||||
%this.registerMissionObject( "TerrainBlock", "Terrain Block" );
|
||||
%this.registerMissionObject( "GroundPlane", "Ground Plane" );
|
||||
|
|
|
|||
|
|
@ -294,6 +294,28 @@ function TerrainMaterialDlg::changeNormal( %this )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function TerrainMaterialDlg::changecomposite( %this )
|
||||
{
|
||||
%ctrl = %this-->compositeTexCtrl;
|
||||
%file = %ctrl.bitmap;
|
||||
if( getSubStr( %file, 0 , 6 ) $= "tools/" )
|
||||
%file = "";
|
||||
|
||||
%file = TerrainMaterialDlg._selectTextureFileDialog( %file );
|
||||
if( %file $= "" )
|
||||
{
|
||||
if( %ctrl.bitmap !$= "" )
|
||||
%file = %ctrl.bitmap;
|
||||
else
|
||||
%file = "tools/materialEditor/gui/unknownImage";
|
||||
}
|
||||
|
||||
%file = makeRelativePath( %file, getMainDotCsDir() );
|
||||
%ctrl.setBitmap( %file );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function TerrainMaterialDlg::newMat( %this )
|
||||
{
|
||||
// Create a unique material name.
|
||||
|
|
@ -394,7 +416,12 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
|
|||
%this-->normTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
|
||||
}else{
|
||||
%this-->normTexCtrl.setBitmap( %mat.normalMap );
|
||||
}
|
||||
}
|
||||
if (%mat.compositeMap $= ""){
|
||||
%this-->compositeTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
|
||||
}else{
|
||||
%this-->compositeTexCtrl.setBitmap( %mat.compositeMap );
|
||||
}
|
||||
%this-->detSizeCtrl.setText( %mat.detailSize );
|
||||
%this-->baseSizeCtrl.setText( %mat.diffuseSize );
|
||||
%this-->detStrengthCtrl.setText( %mat.detailStrength );
|
||||
|
|
@ -448,6 +475,11 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
}else{
|
||||
%newMacro = %this-->macroTexCtrl.bitmap;
|
||||
}
|
||||
if (%this-->compositeTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
|
||||
%newComposite = "";
|
||||
}else{
|
||||
%newComposite = %this-->compositeTexCtrl.bitmap;
|
||||
}
|
||||
%detailSize = %this-->detSizeCtrl.getText();
|
||||
%diffuseSize = %this-->baseSizeCtrl.getText();
|
||||
%detailStrength = %this-->detStrengthCtrl.getText();
|
||||
|
|
@ -466,6 +498,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
%mat.diffuseMap $= %newDiffuse &&
|
||||
%mat.normalMap $= %newNormal &&
|
||||
%mat.detailMap $= %newDetail &&
|
||||
%mat.compositeMap $= %newComposite &&
|
||||
%mat.macroMap $= %newMacro &&
|
||||
%mat.detailSize == %detailSize &&
|
||||
%mat.diffuseSize == %diffuseSize &&
|
||||
|
|
@ -497,7 +530,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
}
|
||||
|
||||
%mat.diffuseMap = %newDiffuse;
|
||||
%mat.normalMap = %newNormal;
|
||||
%mat.normalMap = %newNormal;
|
||||
%mat.compositeMap = %newComposite;
|
||||
%mat.detailMap = %newDetail;
|
||||
%mat.macroMap = %newMacro;
|
||||
%mat.detailSize = %detailSize;
|
||||
|
|
@ -544,6 +578,7 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
|
|||
diffuseMap = %mat.diffuseMap;
|
||||
normalMap = %mat.normalMap;
|
||||
detailMap = %mat.detailMap;
|
||||
compositeMap = %mat.compositeMap;
|
||||
macroMap = %mat.macroMap;
|
||||
detailSize = %mat.detailSize;
|
||||
diffuseSize = %mat.diffuseSize;
|
||||
|
|
@ -578,6 +613,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
|
|||
%mat.diffuseMap = %obj.diffuseMap;
|
||||
%mat.normalMap = %obj.normalMap;
|
||||
%mat.detailMap = %obj.detailMap;
|
||||
%mat.compositeMap = %obj.compositeMap;
|
||||
%mat.macroMap = %obj.macroMap;
|
||||
%mat.detailSize = %obj.detailSize;
|
||||
%mat.diffuseSize = %obj.diffuseSize;
|
||||
|
|
|
|||
|
|
@ -61,3 +61,21 @@ function EditorLightingMenu::onMenuSelect( %this )
|
|||
//%selSize = EWorldEditor.getSelectionSize();
|
||||
%this.enableItem( 1, true /*%selSize == 1*/ );
|
||||
}
|
||||
|
||||
function updateReflectionProbes()
|
||||
{
|
||||
/*%probeIds = parseMissionGroupForIds("ReflectionProbe", "");
|
||||
%probeCount = getWordCount(%probeIds);
|
||||
|
||||
for(%i=0; %i < %probeCount; %i++)
|
||||
{
|
||||
%probe = getWord(%probeIds, %i);
|
||||
|
||||
%path = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%probe.bake(%path, 64);
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;*/
|
||||
|
||||
Canvas.pushDialog(ProbeBakeDlg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,6 +263,8 @@ function EditorGui::buildMenus(%this)
|
|||
item[0] = "Full Relight" TAB "Alt L" TAB "Editor.lightScene(\"\", forceAlways);";
|
||||
item[1] = "Toggle ShadowViz" TAB "" TAB "toggleShadowViz();";
|
||||
item[2] = "-";
|
||||
item[3] = "Update Reflection Probes" TAB "" TAB "updateReflectionProbes();";
|
||||
item[4] = "-";
|
||||
|
||||
// NOTE: The light managers will be inserted as the
|
||||
// last menu items in EditorLightingMenu::onAdd().
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
function ProbeBakeDlg::onWake(%this)
|
||||
{
|
||||
//set up
|
||||
ProbeBakeDlg_ProbeResList.add( "32" );
|
||||
ProbeBakeDlg_ProbeResList.add( "64" );
|
||||
ProbeBakeDlg_ProbeResList.add( "128" );
|
||||
ProbeBakeDlg_ProbeResList.add( "256" );
|
||||
ProbeBakeDlg_ProbeResList.add( "512" );
|
||||
ProbeBakeDlg_ProbeResList.add( "1024" );
|
||||
ProbeBakeDlg_ProbeResList.add( "2048" );
|
||||
|
||||
ProbeBakeDlg_ProbeResList.setSelected( 1, false );
|
||||
|
||||
ProbeBakeDlg_NumIterTxt.setText("1");
|
||||
}
|
||||
|
||||
function ProbeBakeDlg_RunBake::onClick(%this)
|
||||
{
|
||||
%probeIds = parseMissionGroupForIds("ReflectionProbe", "");
|
||||
%skylightIds = parseMissionGroupForIds("Skylight", "");
|
||||
|
||||
%probeIds = rtrim(ltrim(%probeIds SPC %skylightIds));
|
||||
%probeCount = getWordCount(%probeIds);
|
||||
|
||||
%numIter = ProbeBakeDlg_NumIterTxt.getText();
|
||||
%resolution = ProbeBakeDlg_ProbeResList.getText();
|
||||
%progressStep = 100 / (%numIter * %probeCount);
|
||||
%currentProgressValue = 0;
|
||||
|
||||
ProbeBakeDlg_Progress.setValue(%currentProgressValue);
|
||||
|
||||
for(%iter=0; %iter < %numIter; %iter++)
|
||||
{
|
||||
for(%i=0; %i < %probeCount; %i++)
|
||||
{
|
||||
%probe = getWord(%probeIds, %i);
|
||||
|
||||
%path = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%probe.bake(%path, %resolution);
|
||||
|
||||
%currentProgressValue += %progressStep;
|
||||
ProbeBakeDlg_Progress.setValue(%currentProgressValue);
|
||||
Canvas.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue