mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Updating BaseGame to work with PBR, and a PBR example module
This commit is contained in:
parent
e83ec69292
commit
cedbd387d9
98 changed files with 6762 additions and 2889 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -121,6 +121,8 @@ function MaterialEditorPlugin::onActivated( %this )
|
|||
$wasInWireFrameMode = false;
|
||||
}
|
||||
advancedTextureMapsRollout.Expanded = false;
|
||||
accumulationPropertiesRollout.Expanded = false;
|
||||
lightingPropertiesRollout.Expanded = false;
|
||||
materialAnimationPropertiesRollout.Expanded = false;
|
||||
materialAdvancedPropertiesRollout.Expanded = false;
|
||||
WorldEditorPlugin.onActivated();
|
||||
|
|
|
|||
|
|
@ -137,8 +137,6 @@ function MaterialEditorGui::open(%this)
|
|||
|
||||
if( MaterialEditorGui.currentMode $= "Mesh" )
|
||||
MaterialEditorGui.prepareActiveObject( true );
|
||||
else if( MaterialEditorGui.currentMode $= "asset" )
|
||||
MaterialEditorGui.prepareActiveMaterial( MaterialEditorGui.currentMaterial, true );
|
||||
else
|
||||
MaterialEditorGui.prepareActiveMaterial( "", true );
|
||||
|
||||
|
|
@ -290,9 +288,7 @@ function MaterialEditorGui::setMode( %this )
|
|||
}
|
||||
else
|
||||
{
|
||||
if(MaterialEditorGui.currentMode !$= "asset")
|
||||
MaterialEditorGui.currentMode = "Material";
|
||||
|
||||
MaterialEditorGui.currentMode = "Material";
|
||||
MatEdMaterialMode.setVisible(1);
|
||||
EWorldEditor.clearSelection();
|
||||
}
|
||||
|
|
@ -597,6 +593,27 @@ function MaterialEditorGui::convertTextureFields(%this)
|
|||
%specMap = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %specMap);
|
||||
MaterialEditorGui.currentMaterial.specularMap[%specI] = %specMap;
|
||||
}
|
||||
|
||||
for(%roughI = 0; %roughI < 4; %roughI++)
|
||||
{
|
||||
%roughMap = MaterialEditorGui.currentMaterial.roughMap[%roughI];
|
||||
%roughMap = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %roughMap);
|
||||
MaterialEditorGui.currentMaterial.roughMap[%specI] = %roughMap;
|
||||
}
|
||||
|
||||
for(%aoI = 0; %aoI < 4; %aoI++)
|
||||
{
|
||||
%aoMap = MaterialEditorGui.currentMaterial.aoMap[%aoI];
|
||||
%aoMap = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %aoMap);
|
||||
MaterialEditorGui.currentMaterial.aoMap[%specI] = %aoMap;
|
||||
}
|
||||
|
||||
for(%metalI = 0; %metalI < 4; %metalI++)
|
||||
{
|
||||
%metalMap = MaterialEditorGui.currentMaterial.metalMap[%metalI];
|
||||
%metalMap = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %metalMap);
|
||||
MaterialEditorGui.currentMaterial.metalMap[%metalI] = %metalMap;
|
||||
}
|
||||
}
|
||||
|
||||
// still needs to be optimized further
|
||||
|
|
@ -879,7 +896,9 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
MaterialEditorPropertiesWindow-->toneMapNameText.setText( (%material).toneMap[%layer] );
|
||||
MaterialEditorPropertiesWindow-->toneMapDisplayBitmap.setBitmap( (%material).toneMap[%layer] );
|
||||
}
|
||||
|
||||
MaterialEditorPropertiesWindow-->isSRGBCheckbox.setValue((%material).isSRGB[%layer]);
|
||||
MaterialEditorPropertiesWindow-->invertSmoothnessCheckbox.setValue((%material).invertSmoothness[%layer]);
|
||||
|
||||
if((%material).specularMap[%layer] $= "")
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->specMapNameText.setText( "None" );
|
||||
|
|
@ -891,6 +910,39 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
MaterialEditorPropertiesWindow-->specMapDisplayBitmap.setBitmap( (%material).specularMap[%layer] );
|
||||
}
|
||||
|
||||
if((%material).roughMap[%layer] $= "")
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->roughMapNameText.setText( "None" );
|
||||
MaterialEditorPropertiesWindow-->roughMapDisplayBitmap.setBitmap( "tools/materialeditor/gui/unknownImage" );
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->roughMapNameText.setText( (%material).roughMap[%layer] );
|
||||
MaterialEditorPropertiesWindow-->roughMapDisplayBitmap.setBitmap( (%material).roughMap[%layer] );
|
||||
}
|
||||
|
||||
if((%material).aoMap[%layer] $= "")
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->aoMapNameText.setText( "None" );
|
||||
MaterialEditorPropertiesWindow-->aoMapDisplayBitmap.setBitmap( "tools/materialeditor/gui/unknownImage" );
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->aoMapNameText.setText( (%material).aoMap[%layer] );
|
||||
MaterialEditorPropertiesWindow-->aoMapDisplayBitmap.setBitmap( (%material).aoMap[%layer] );
|
||||
}
|
||||
|
||||
if((%material).metalMap[%layer] $= "")
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->metalMapNameText.setText( "None" );
|
||||
MaterialEditorPropertiesWindow-->metalMapDisplayBitmap.setBitmap( "tools/materialeditor/gui/unknownImage" );
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->metalMapNameText.setText( (%material).metalMap[%layer] );
|
||||
MaterialEditorPropertiesWindow-->metalMapDisplayBitmap.setBitmap( (%material).metalMap[%layer] );
|
||||
}
|
||||
|
||||
MaterialEditorPropertiesWindow-->accuScaleTextEdit.setText((%material).accuScale[%layer]);
|
||||
MaterialEditorPropertiesWindow-->accuScaleTextEdit.setText((%material).accuScale[%layer]);
|
||||
MaterialEditorPropertiesWindow-->accuDirectionTextEdit.setText((%material).accuDirection[%layer]);
|
||||
|
|
@ -908,11 +960,10 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
MaterialEditorPropertiesWindow-->colorTintSwatch.color = (%material).diffuseColor[%layer];
|
||||
MaterialEditorPropertiesWindow-->specularColorSwatch.color = (%material).specular[%layer];
|
||||
|
||||
MaterialEditorPropertiesWindow-->specularPowerTextEdit.setText((%material).specularPower[%layer]);
|
||||
MaterialEditorPropertiesWindow-->specularPowerSlider.setValue((%material).specularPower[%layer]);
|
||||
MaterialEditorPropertiesWindow-->specularStrengthTextEdit.setText((%material).specularStrength[%layer]);
|
||||
MaterialEditorPropertiesWindow-->specularStrengthSlider.setValue((%material).specularStrength[%layer]);
|
||||
MaterialEditorPropertiesWindow-->pixelSpecularCheckbox.setValue((%material).pixelSpecular[%layer]);
|
||||
MaterialEditorPropertiesWindow-->SmoothnessTextEdit.setText((%material).Smoothness[%layer]);
|
||||
MaterialEditorPropertiesWindow-->SmoothnessSlider.setValue((%material).Smoothness[%layer]);
|
||||
MaterialEditorPropertiesWindow-->MetalnessTextEdit.setText((%material).Metalness[%layer]);
|
||||
MaterialEditorPropertiesWindow-->MetalnessSlider.setValue((%material).Metalness[%layer]);
|
||||
MaterialEditorPropertiesWindow-->glowCheckbox.setValue((%material).glow[%layer]);
|
||||
MaterialEditorPropertiesWindow-->emissiveCheckbox.setValue((%material).emissive[%layer]);
|
||||
MaterialEditorPropertiesWindow-->parallaxTextEdit.setText((%material).parallaxScale[%layer]);
|
||||
|
|
@ -980,11 +1031,34 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
MaterialEditorPropertiesWindow-->SequenceSliderSSS.setValue( %numFrames );
|
||||
|
||||
// Accumulation
|
||||
MaterialEditorPropertiesWindow-->accuCheckbox.setValue((%material).accuEnabled[%layer]);
|
||||
MaterialEditorPropertiesWindow-->accuCheckbox.setValue((%material).accuEnabled[%layer]);
|
||||
|
||||
MaterialEditorPropertiesWindow-->accuCheckbox.setValue((%material).accuEnabled[%layer]);
|
||||
|
||||
%this.getRoughChan((%material).SmoothnessChan[%layer]);
|
||||
%this.getAOChan((%material).AOChan[%layer]);
|
||||
%this.getMetalChan((%material).metalChan[%layer]);
|
||||
%this.preventUndo = false;
|
||||
}
|
||||
|
||||
//=======================================
|
||||
function MaterialEditorGui::getRoughChan(%this, %channel)
|
||||
{
|
||||
%guiElement = roughChanBtn @ %channel;
|
||||
%guiElement.setStateOn(true);
|
||||
}
|
||||
|
||||
function MaterialEditorGui::getAOChan(%this, %channel)
|
||||
{
|
||||
%guiElement = AOChanBtn @ %channel;
|
||||
%guiElement.setStateOn(true);
|
||||
}
|
||||
|
||||
function MaterialEditorGui::getMetalChan(%this, %channel)
|
||||
{
|
||||
%guiElement = metalChanBtn @ %channel;
|
||||
%guiElement.setStateOn(true);
|
||||
}
|
||||
//=======================================
|
||||
// Material Update Functionality
|
||||
|
||||
|
|
@ -1055,7 +1129,7 @@ function MaterialEditorGui::updateActiveMaterialName(%this, %name)
|
|||
// Some objects (ConvexShape, DecalRoad etc) reference Materials by name => need
|
||||
// to find and update all these references so they don't break when we rename the
|
||||
// Material.
|
||||
MaterialEditorGui.updateMaterialReferences( getScene(0), %action.oldName, %action.newName );
|
||||
MaterialEditorGui.updateMaterialReferences( getRootScene(), %action.oldName, %action.newName );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::updateMaterialReferences( %this, %obj, %oldName, %newName )
|
||||
|
|
@ -1196,6 +1270,90 @@ function MaterialEditorGui::updateSpecMap(%this,%action)
|
|||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::updateRoughMap(%this,%action)
|
||||
{
|
||||
%layer = MaterialEditorGui.currentLayer;
|
||||
|
||||
if( %action )
|
||||
{
|
||||
%texture = MaterialEditorGui.openFile("texture");
|
||||
if( %texture !$= "" )
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->roughMapDisplayBitmap.setBitmap(%texture);
|
||||
|
||||
%bitmap = MaterialEditorPropertiesWindow-->roughMapDisplayBitmap.bitmap;
|
||||
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
|
||||
MaterialEditorPropertiesWindow-->roughMapDisplayBitmap.setBitmap(%bitmap);
|
||||
MaterialEditorPropertiesWindow-->roughMapNameText.setText(%bitmap);
|
||||
MaterialEditorGui.updateActiveMaterial("roughMap[" @ %layer @ "]","\"" @ %bitmap @ "\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->roughMapNameText.setText("None");
|
||||
MaterialEditorPropertiesWindow-->roughMapDisplayBitmap.setBitmap("tools/materialeditor/gui/unknownImage");
|
||||
MaterialEditorGui.updateActiveMaterial("roughMap[" @ %layer @ "]","");
|
||||
}
|
||||
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::updateaoMap(%this,%action)
|
||||
{
|
||||
%layer = MaterialEditorGui.currentLayer;
|
||||
|
||||
if( %action )
|
||||
{
|
||||
%texture = MaterialEditorGui.openFile("texture");
|
||||
if( %texture !$= "" )
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->aoMapDisplayBitmap.setBitmap(%texture);
|
||||
|
||||
%bitmap = MaterialEditorPropertiesWindow-->aoMapDisplayBitmap.bitmap;
|
||||
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
|
||||
MaterialEditorPropertiesWindow-->aoMapDisplayBitmap.setBitmap(%bitmap);
|
||||
MaterialEditorPropertiesWindow-->aoMapNameText.setText(%bitmap);
|
||||
MaterialEditorGui.updateActiveMaterial("aoMap[" @ %layer @ "]","\"" @ %bitmap @ "\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->aoMapNameText.setText("None");
|
||||
MaterialEditorPropertiesWindow-->aoMapDisplayBitmap.setBitmap("tools/materialeditor/gui/unknownImage");
|
||||
MaterialEditorGui.updateActiveMaterial("aoMap[" @ %layer @ "]","");
|
||||
}
|
||||
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::updatemetalMap(%this,%action)
|
||||
{
|
||||
%layer = MaterialEditorGui.currentLayer;
|
||||
|
||||
if( %action )
|
||||
{
|
||||
%texture = MaterialEditorGui.openFile("texture");
|
||||
if( %texture !$= "" )
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->metalMapDisplayBitmap.setBitmap(%texture);
|
||||
|
||||
%bitmap = MaterialEditorPropertiesWindow-->metalMapDisplayBitmap.bitmap;
|
||||
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
|
||||
MaterialEditorPropertiesWindow-->metalMapDisplayBitmap.setBitmap(%bitmap);
|
||||
MaterialEditorPropertiesWindow-->metalMapNameText.setText(%bitmap);
|
||||
MaterialEditorGui.updateActiveMaterial("metalMap[" @ %layer @ "]","\"" @ %bitmap @ "\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MaterialEditorPropertiesWindow-->metalMapNameText.setText("None");
|
||||
MaterialEditorPropertiesWindow-->metalMapDisplayBitmap.setBitmap("tools/materialeditor/gui/unknownImage");
|
||||
MaterialEditorGui.updateActiveMaterial("metalMap[" @ %layer @ "]","");
|
||||
}
|
||||
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::updateRotationOffset(%this, %isSlider, %onMouseUp)
|
||||
{
|
||||
%layer = MaterialEditorGui.currentLayer;
|
||||
|
|
@ -1948,7 +2106,7 @@ function MaterialEditorGui::createNewMaterial( %this )
|
|||
%material = getUniqueName( "newMaterial" );
|
||||
new Material(%material)
|
||||
{
|
||||
diffuseMap[0] = "core/images/warnmat";
|
||||
diffuseMap[0] = "core/art/warnmat";
|
||||
mapTo = "unmapped_mat";
|
||||
parentGroup = RootGroup;
|
||||
};
|
||||
|
|
@ -1979,7 +2137,7 @@ function MaterialEditorGui::deleteMaterial( %this )
|
|||
%toMaterial = getUniqueName( "newMaterial" );
|
||||
new Material(%toMaterial)
|
||||
{
|
||||
diffuseMap[0] = "core/images/warnmat";
|
||||
diffuseMap[0] = "core/art/warnmat";
|
||||
mapTo = "unmapped_mat";
|
||||
parentGroup = RootGroup;
|
||||
};
|
||||
|
|
@ -1997,7 +2155,7 @@ function MaterialEditorGui::deleteMaterial( %this )
|
|||
%toMaterial = getUniqueName( "newMaterial" );
|
||||
new Material(%toMaterial)
|
||||
{
|
||||
diffuseMap[0] = "core/images/warnmat";
|
||||
diffuseMap[0] = "core/art/warnmat";
|
||||
mapTo = "unmapped_mat";
|
||||
parentGroup = RootGroup;
|
||||
};
|
||||
|
|
@ -2012,7 +2170,7 @@ function MaterialEditorGui::deleteMaterial( %this )
|
|||
%newMaterial = getUniqueName( "newMaterial" );
|
||||
new Material(%newMaterial)
|
||||
{
|
||||
diffuseMap[0] = "core/images/warnmat";
|
||||
diffuseMap[0] = "core/art/warnmat";
|
||||
mapTo = "unmapped_mat";
|
||||
parentGroup = RootGroup;
|
||||
};
|
||||
|
|
@ -2272,3 +2430,58 @@ function MaterialEditorGui::updateAccuCheckbox(%this, %value)
|
|||
MaterialEditorGui.updateActiveMaterial("accuEnabled[" @ MaterialEditorGui.currentLayer @ "]", %value);
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
// channel in selectors
|
||||
function MaterialEditorGui::setRoughChan(%this, %value)
|
||||
{
|
||||
MaterialEditorGui.updateActiveMaterial("SmoothnessChan[" @ MaterialEditorGui.currentLayer @ "]", %value);
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::setAOChan(%this, %value)
|
||||
{
|
||||
MaterialEditorGui.updateActiveMaterial("aoChan[" @ MaterialEditorGui.currentLayer @ "]", %value);
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::setMetalChan(%this, %value)
|
||||
{
|
||||
MaterialEditorGui.updateActiveMaterial("metalChan[" @ MaterialEditorGui.currentLayer @ "]", %value);
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
}
|
||||
|
||||
function MaterialEditorGui::saveCompositeMap(%this)
|
||||
{
|
||||
%saveAs = "";
|
||||
%dlg = new SaveFileDialog()
|
||||
{
|
||||
Filters = "png";
|
||||
DefaultPath = EditorSettings.value("art/shapes/textures");
|
||||
ChangePath = false;
|
||||
OverwritePrompt = true;
|
||||
};
|
||||
|
||||
%ret = %dlg.Execute();
|
||||
if(%ret)
|
||||
{
|
||||
// Immediately override/set the levelsDirectory
|
||||
EditorSettings.setValue( "art/shapes/textures", collapseFilename(filePath( %dlg.FileName )) );
|
||||
%saveAs = %dlg.FileName;
|
||||
}
|
||||
|
||||
%material = %this.currentMaterial;
|
||||
%layer = %this.currentLayer;
|
||||
|
||||
%roughMap = %material.roughMap[%layer];
|
||||
%aoMap = %material.aoMap[%layer];
|
||||
%metalMap = %material.metalMap[%layer];
|
||||
|
||||
%smooth = %material.SmoothnessChan[%layer];
|
||||
%ao = %material.AOChan[%layer];
|
||||
%metal = %material.metalChan[%layer];
|
||||
|
||||
%channelKey = %smooth SPC %ao SPC %metal SPC 3;
|
||||
error("Storing: \"" @ %roughMap @"\" \""@ %aoMap @"\" \""@ %metalMap @"\" \""@ %channelKey @"\" \""@ %saveAs @"\"");
|
||||
saveCompositeTexture(%roughMap,%aoMap,%metalMap,"",%channelKey, %saveAs);
|
||||
%dlg.delete();
|
||||
}
|
||||
|
|
|
|||
115
Templates/BaseGame/game/tools/resources/ReflectProbeSphere.dae
Normal file
115
Templates/BaseGame/game/tools/resources/ReflectProbeSphere.dae
Normal file
File diff suppressed because one or more lines are too long
8
Templates/BaseGame/game/tools/resources/materials.cs
Normal file
8
Templates/BaseGame/game/tools/resources/materials.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
singleton Material(ReflectProbePreviewMat)
|
||||
{
|
||||
mapTo = "ReflectProbePreviewMat";
|
||||
diffuseColor[0] = "1 1 1 1";
|
||||
smoothness[0] = "1";
|
||||
metalness[0] = "1";
|
||||
translucentBlendOp = "None";
|
||||
};
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#include "shaders/common/shaderModelAutoGen.hlsl"
|
||||
|
||||
#include "shaders/common/lighting/advanced/farFrustumQuad.hlsl"
|
||||
#include "shaders/common/lighting/advanced/lightingUtils.hlsl"
|
||||
#include "shaders/common/lighting.hlsl"
|
||||
#include "shaders/common/torque.hlsl"
|
||||
|
||||
struct ConvexConnectP
|
||||
{
|
||||
float4 pos : TORQUE_POSITION;
|
||||
float4 wsEyeDir : TEXCOORD0;
|
||||
float4 ssPos : TEXCOORD1;
|
||||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 1);
|
||||
|
||||
uniform float4 rtParams0;
|
||||
|
||||
uniform float4x4 invViewMat;
|
||||
|
||||
float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
||||
{
|
||||
// Compute scene UV
|
||||
float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
|
||||
float2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
//float3 eyeRay = IN.vsEyeDir.xyz;
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
if (depth>0.9999)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
// Need world-space normal.
|
||||
float3 wsNormal = mul(float4(normal, 1), invViewMat).rgb;
|
||||
|
||||
float3 reflectionVec = reflect(IN.wsEyeDir, float4(normalize(wsNormal),1)).rgb;
|
||||
|
||||
float4 color = TORQUE_TEXCUBE(cubeMap, reflectionVec);
|
||||
|
||||
//simple visibility testing
|
||||
//float4 color = float4(1,0,0,1);
|
||||
|
||||
return float4(color.rgb, 1);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "shaders/common/hlslStructs.hlsl"
|
||||
#include "shaders/common/shaderModel.hlsl"
|
||||
|
||||
struct VertData
|
||||
{
|
||||
float3 pos : POSITION;
|
||||
float tangentW : TEXCOORD3;
|
||||
float3 normal : NORMAL;
|
||||
float3 T : TANGENT;
|
||||
float2 texCoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ConvexConnectV
|
||||
{
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 wsEyeDir : TEXCOORD0;
|
||||
float4 ssPos : TEXCOORD1;
|
||||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
uniform float4x4 modelview;
|
||||
uniform float4x4 objTrans;
|
||||
uniform float4x4 worldViewOnly;
|
||||
uniform float3 eyePosWorld;
|
||||
|
||||
ConvexConnectV main( VertData IN )
|
||||
{
|
||||
ConvexConnectV OUT;
|
||||
|
||||
OUT.hpos = mul( modelview, float4(IN.pos,1.0) );
|
||||
OUT.wsEyeDir = mul(objTrans, float4(IN.pos, 1.0)) - float4(eyePosWorld, 0.0);
|
||||
OUT.vsEyeDir = mul(worldViewOnly, float4(IN.pos, 1.0));
|
||||
OUT.ssPos = OUT.hpos;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -1,84 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<EditorSettings>
|
||||
<Group name="NavEditor">
|
||||
<Setting name="SpawnClass">AIPlayer</Setting>
|
||||
</Group>
|
||||
<Group name="WorldEditor">
|
||||
<Setting name="orthoShowGrid">1</Setting>
|
||||
<Setting name="forceLoadDAE">0</Setting>
|
||||
<Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
|
||||
<Setting name="displayType">6</Setting>
|
||||
<Setting name="dropType">screenCenter</Setting>
|
||||
<Setting name="orthoFOV">50</Setting>
|
||||
<Setting name="undoLimit">40</Setting>
|
||||
<Group name="Color">
|
||||
<Setting name="selectionBoxColor">255 255 0 255</Setting>
|
||||
<Setting name="objMouseOverColor">0 255 0 255</Setting>
|
||||
<Setting name="objSelectColor">255 0 0 255</Setting>
|
||||
<Setting name="dragRectColor">255 255 0 255</Setting>
|
||||
<Setting name="objectTextColor">255 255 255 255</Setting>
|
||||
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
|
||||
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
|
||||
</Group>
|
||||
<Group name="ObjectIcons">
|
||||
<Setting name="fadeIconsStartDist">8</Setting>
|
||||
<Setting name="fadeIconsEndDist">20</Setting>
|
||||
<Setting name="fadeIconsStartAlpha">255</Setting>
|
||||
<Setting name="fadeIconsEndAlpha">0</Setting>
|
||||
<Setting name="fadeIcons">1</Setting>
|
||||
</Group>
|
||||
<Setting name="forceLoadDAE">0</Setting>
|
||||
<Setting name="displayType">6</Setting>
|
||||
<Setting name="orthoFOV">50</Setting>
|
||||
<Setting name="orthoShowGrid">1</Setting>
|
||||
<Group name="Render">
|
||||
<Setting name="showMousePopupInfo">1</Setting>
|
||||
<Setting name="renderObjText">1</Setting>
|
||||
<Setting name="renderSelectionBox">1</Setting>
|
||||
<Setting name="renderPopupBackground">1</Setting>
|
||||
<Setting name="renderSelectionBox">1</Setting>
|
||||
<Setting name="renderObjHandle">1</Setting>
|
||||
</Group>
|
||||
<Group name="Grid">
|
||||
<Setting name="gridOriginColor">255 255 255 100</Setting>
|
||||
<Setting name="gridColor">102 102 102 100</Setting>
|
||||
<Setting name="gridSnap">0</Setting>
|
||||
<Setting name="gridSize">1</Setting>
|
||||
<Setting name="gridMinorColor">51 51 51 100</Setting>
|
||||
</Group>
|
||||
<Group name="Docs">
|
||||
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
|
||||
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
|
||||
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
|
||||
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
|
||||
<Setting name="renderObjText">1</Setting>
|
||||
<Setting name="showMousePopupInfo">1</Setting>
|
||||
</Group>
|
||||
<Group name="Images">
|
||||
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
|
||||
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
|
||||
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
|
||||
</Group>
|
||||
<Group name="Color">
|
||||
<Setting name="dragRectColor">255 255 0 255</Setting>
|
||||
<Setting name="objectTextColor">255 255 255 255</Setting>
|
||||
<Setting name="objMouseOverColor">0 255 0 255</Setting>
|
||||
<Setting name="selectionBoxColor">255 255 0 255</Setting>
|
||||
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
|
||||
<Setting name="objSelectColor">255 0 0 255</Setting>
|
||||
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
|
||||
</Group>
|
||||
<Group name="Grid">
|
||||
<Setting name="gridColor">102 102 102 100</Setting>
|
||||
<Setting name="gridSnap">0</Setting>
|
||||
<Setting name="gridSize">1</Setting>
|
||||
<Setting name="gridMinorColor">51 51 51 100</Setting>
|
||||
<Setting name="gridOriginColor">255 255 255 100</Setting>
|
||||
</Group>
|
||||
<Group name="Tools">
|
||||
<Setting name="boundingBoxCollision">0</Setting>
|
||||
<Setting name="snapSoftSize">2</Setting>
|
||||
<Setting name="dropAtScreenCenterMax">100</Setting>
|
||||
<Setting name="snapSoft">0</Setting>
|
||||
<Setting name="objectsUseBoxCenter">1</Setting>
|
||||
<Setting name="snapSoftSize">2</Setting>
|
||||
<Setting name="dropAtScreenCenterScalar">1</Setting>
|
||||
<Setting name="snapGround">0</Setting>
|
||||
<Setting name="dropAtScreenCenterMax">100</Setting>
|
||||
<Setting name="boundingBoxCollision">0</Setting>
|
||||
<Setting name="snapSoft">0</Setting>
|
||||
</Group>
|
||||
<Group name="ObjectIcons">
|
||||
<Setting name="fadeIconsEndDist">20</Setting>
|
||||
<Setting name="fadeIconsStartAlpha">255</Setting>
|
||||
<Setting name="fadeIconsEndAlpha">0</Setting>
|
||||
<Setting name="fadeIcons">1</Setting>
|
||||
<Setting name="fadeIconsStartDist">8</Setting>
|
||||
</Group>
|
||||
<Group name="Docs">
|
||||
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
|
||||
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
|
||||
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
|
||||
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group name="AxisGizmo">
|
||||
<Setting name="renderInfoText">1</Setting>
|
||||
<Setting name="mouseRotateScalar">0.8</Setting>
|
||||
<Setting name="axisGizmoMaxScreenLen">100</Setting>
|
||||
<Setting name="mouseScaleScalar">0.8</Setting>
|
||||
<Setting name="rotationSnap">15</Setting>
|
||||
<Setting name="renderWhenUsed">0</Setting>
|
||||
<Setting name="snapRotations">0</Setting>
|
||||
<Setting name="mouseRotateScalar">0.8</Setting>
|
||||
<Setting name="mouseScaleScalar">0.8</Setting>
|
||||
<Setting name="renderWhenUsed">0</Setting>
|
||||
<Setting name="renderInfoText">1</Setting>
|
||||
<Group name="Grid">
|
||||
<Setting name="renderPlane">0</Setting>
|
||||
<Setting name="planeDim">500</Setting>
|
||||
<Setting name="snapToGrid">0</Setting>
|
||||
<Setting name="gridSize">10 10 10</Setting>
|
||||
<Setting name="gridColor">255 255 255 20</Setting>
|
||||
<Setting name="renderPlaneHashes">0</Setting>
|
||||
<Setting name="planeDim">500</Setting>
|
||||
<Setting name="renderPlane">0</Setting>
|
||||
<Setting name="snapToGrid">0</Setting>
|
||||
<Setting name="gridSize">10 10 10</Setting>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group name="NavEditor">
|
||||
<Setting name="SpawnClass">AIPlayer</Setting>
|
||||
</Group>
|
||||
<Group name="LevelInformation">
|
||||
<Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
|
||||
<Group name="levels">
|
||||
|
|
|
|||
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/BaseGame/game/tools/worldEditor/gui/probeBakeDlg.gui
Normal file
192
Templates/BaseGame/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 ---
|
||||
|
|
@ -44,6 +44,7 @@ function initializeWorldEditor()
|
|||
exec("./gui/SelectObjectsWindow.ed.gui");
|
||||
exec("./gui/ProceduralTerrainPainterGui.gui" );
|
||||
exec("./gui/shadowViz.gui" );
|
||||
exec("./gui/probeBakeDlg.gui" );
|
||||
|
||||
// Load Scripts.
|
||||
exec("./scripts/menus.ed.cs");
|
||||
|
|
@ -66,6 +67,7 @@ function initializeWorldEditor()
|
|||
exec("./scripts/cameraCommands.ed.cs");
|
||||
exec("./scripts/lightViz.cs");
|
||||
exec("./scripts/shadowViz.cs");
|
||||
exec("./scripts/probeBake.ed.cs");
|
||||
|
||||
// Load Custom Editors
|
||||
loadDirectory(expandFilename("./scripts/editors"));
|
||||
|
|
@ -120,16 +122,24 @@ 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: 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" );
|
||||
EVisibility.addOption( "AL: Spec Map", "$AL_SpecMapShaderVar", "toggleSpecMapViz");
|
||||
EVisibility.addOption( "AL: Spec Map(Rough)", "$AL_RoughMapShaderVar", "toggleRoughMapViz");
|
||||
EVisibility.addOption( "AL: Spec Map(Metal)", "$AL_MetalMapShaderVar", "toggleMetalMapViz");
|
||||
EVisibility.addOption( "AL: Backbuffer", "$AL_BackbufferVisualizeVar", "toggleBackbufferViz" );
|
||||
EVisibility.addOption( "AL: Glow Buffer", "$AL_GlowVisualizeVar", "toggleGlowViz" );
|
||||
EVisibility.addOption( "AL: PSSM Cascade Viz", "$AL::PSSMDebugRender", "" );
|
||||
EVisibility.addOption( "Probes: Attenuation", "$Probes::showAttenuation", "" );
|
||||
EVisibility.addOption( "Probes: Specular Cubemaps", "$Probes::showSpecularCubemaps", "" );
|
||||
EVisibility.addOption( "Probes: Diffuse Cubemaps", "$Probes::showDiffuseCubemaps", "" );
|
||||
EVisibility.addOption( "Probes: Contribution", "$Probes::showProbeContrib", "" );
|
||||
|
||||
EVisibility.addOption( "Frustum Lock", "$Scene::lockCull", "" );
|
||||
EVisibility.addOption( "Disable Zone Culling", "$Scene::disableZoneCulling", "" );
|
||||
EVisibility.addOption( "Disable Terrain Occlusion", "$Scene::disableTerrainOcclusion", "" );
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ function EWCreatorWindow::init( %this )
|
|||
|
||||
%this.registerMissionObject( "PointLight", "Point Light" );
|
||||
%this.registerMissionObject( "SpotLight", "Spot Light" );
|
||||
|
||||
%this.registerMissionObject( "BoxEnvironmentProbe", "Box Environment Probe" );
|
||||
%this.registerMissionObject( "SphereEnvironmentProbe", "Sphere Environment 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,39 +61,109 @@ function toggleColorBufferViz( %enable )
|
|||
}
|
||||
}
|
||||
|
||||
new ShaderData( AL_SpecMapShader )
|
||||
//roughness map display (matinfo.b)
|
||||
new ShaderData( AL_RoughMapShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = "./shaders/dbgSpecMapVisualizeP.hlsl";
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgRoughMapVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "./shaders/dbgSpecMapVisualizeP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgRoughMapVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "matinfoTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_SpecMapVisualize )
|
||||
singleton PostEffect( AL_RoughMapVisualize )
|
||||
{
|
||||
shader = AL_SpecMapShader;
|
||||
shader = AL_RoughMapShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#matinfo";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
/// Toggles the visualization of the AL lighting specular power buffer.
|
||||
function toggleSpecMapViz( %enable )
|
||||
function toggleRoughMapViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_SpecMapShaderVar = AL_SpecMapVisualize.isEnabled() ? false : true;
|
||||
AL_SpecMapVisualize.toggle();
|
||||
$AL_RoughMapShaderVar = AL_RoughMapVisualize.isEnabled() ? false : true;
|
||||
AL_RoughMapVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_SpecMapVisualize.enable();
|
||||
AL_RoughMapVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_SpecMapVisualize.disable();
|
||||
AL_RoughMapVisualize.disable();
|
||||
}
|
||||
|
||||
//metalness map display (matinfo.a)
|
||||
new ShaderData( AL_MetalMapShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgMetalMapVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgMetalMapVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "matinfoTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_MetalMapVisualize )
|
||||
{
|
||||
shader = AL_MetalMapShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#matinfo";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
function toggleMetalMapViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_MetalMapShaderVar = AL_MetalMapVisualize.isEnabled() ? false : true;
|
||||
AL_MetalMapVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_MetalMapVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_MetalMapVisualize.disable();
|
||||
}
|
||||
|
||||
//Light map display (indirectLighting)
|
||||
new ShaderData( AL_LightMapShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgLightMapVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightMapVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "specularLightingBuffer";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_LightMapVisualize )
|
||||
{
|
||||
shader = AL_LightMapShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#specularLighting";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
||||
function toggleLightMapViz( %enable )
|
||||
{
|
||||
if ( %enable $= "" )
|
||||
{
|
||||
$AL_LightMapShaderVar = AL_LightMapVisualize.isEnabled() ? false : true;
|
||||
AL_LightMapVisualize.toggle();
|
||||
}
|
||||
else if ( %enable )
|
||||
AL_LightMapVisualize.enable();
|
||||
else if ( !%enable )
|
||||
AL_LightMapVisualize.disable();
|
||||
}
|
||||
|
||||
new GFXStateBlockData( AL_DepthVisualizeState )
|
||||
|
|
|
|||
|
|
@ -61,3 +61,8 @@ function EditorLightingMenu::onMenuSelect( %this )
|
|||
//%selSize = EWorldEditor.getSelectionSize();
|
||||
%this.enableItem( 1, true /*%selSize == 1*/ );
|
||||
}
|
||||
|
||||
function updateReflectionProbes()
|
||||
{
|
||||
Canvas.pushDialog(ProbeBakeDlg);
|
||||
}
|
||||
|
|
@ -322,6 +322,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,56 @@
|
|||
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)
|
||||
{
|
||||
%boxProbeIds = parseMissionGroupForIds("BoxEnvironmentProbe", "");
|
||||
%sphereProbeIds = parseMissionGroupForIds("SphereEnvironmentProbe", "");
|
||||
%skylightIds = parseMissionGroupForIds("Skylight", "");
|
||||
|
||||
%probeIds = rtrim(ltrim(%boxProbeIds SPC %sphereProbeIds));
|
||||
%probeIds = rtrim(ltrim(%probeIds SPC %skylightIds));
|
||||
%probeCount = getWordCount(%probeIds);
|
||||
|
||||
%numIter = ProbeBakeDlg_NumIterTxt.getText();
|
||||
$pref::ReflectionProbes::BakeResolution = ProbeBakeDlg_ProbeResList.getText();
|
||||
%progressStep = 100 / (%numIter * %probeCount);
|
||||
%currentProgressValue = 0;
|
||||
|
||||
ProbeBakeDlg_Progress.setValue(%currentProgressValue);
|
||||
Canvas.repaint();
|
||||
|
||||
for(%iter=0; %iter < %numIter; %iter++)
|
||||
{
|
||||
$pref::ReflectionProbes::RenderWithProbes = false;
|
||||
|
||||
if(%iter != 0)
|
||||
$pref::ReflectionProbes::RenderWithProbes = true;
|
||||
|
||||
for(%i=0; %i < %probeCount; %i++)
|
||||
{
|
||||
%probe = getWord(%probeIds, %i);
|
||||
|
||||
$pref::ReflectionProbes::CurrentLevelPath = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
ProbeBin.bakeProbe(%probe);
|
||||
|
||||
%currentProgressValue += %progressStep;
|
||||
ProbeBakeDlg_Progress.setValue(%currentProgressValue);
|
||||
Canvas.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue