Merge branch 'development' into SnapToMenu

This commit is contained in:
Areloch 2019-03-31 14:32:17 -05:00 committed by GitHub
commit 03f6c8c57f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3172 changed files with 419357 additions and 229857 deletions

View file

@ -184,11 +184,11 @@ function TimeAdjustSliderCtrl::onAction(%this)
if ( !isObject( %this.tod ) )
{
if ( isObject( MissionGroup ) )
if ( isObject( getScene(0) ) )
{
for ( %i = 0; %i < MissionGroup.getCount(); %i++ )
for ( %i = 0; %i < getScene(0).getCount(); %i++ )
{
%obj = MissionGroup.getObject( %i );
%obj = getScene(0).getObject( %i );
if ( %obj.getClassName() $= "TimeOfDay" )
{

View file

@ -947,10 +947,10 @@ function ObjectBuilderGui::buildPlayerDropPoint(%this)
%this.addField("spawnClass", "TypeString", "Spawn Class", "Player");
%this.addField("spawnDatablock", "TypeDataBlock", "Spawn Data", "PlayerData DefaultPlayerData");
if( EWCreatorWindow.objectGroup.getID() == MissionGroup.getID() )
if( EWCreatorWindow.objectGroup.getID() == getScene(0).getID() )
{
if( !isObject("PlayerDropPoints") )
MissionGroup.add( new SimGroup("PlayerDropPoints") );
getScene(0).add( new SimGroup("PlayerDropPoints") );
%this.objectGroup = "PlayerDropPoints";
}
@ -967,10 +967,10 @@ function ObjectBuilderGui::buildObserverDropPoint(%this)
%this.addField("spawnClass", "TypeString", "Spawn Class", "Camera");
%this.addField("spawnDatablock", "TypeDataBlock", "Spawn Data", "CameraData Observer");
if( EWCreatorWindow.objectGroup.getID() == MissionGroup.getID() )
if( EWCreatorWindow.objectGroup.getID() == getScene(0).getID() )
{
if( !isObject("ObserverDropPoints") )
MissionGroup.add( new SimGroup("ObserverDropPoints") );
getScene(0).add( new SimGroup("ObserverDropPoints") );
%this.objectGroup = "ObserverDropPoints";
}

View file

@ -133,6 +133,15 @@ function initializeWorldEditor()
EVisibility.addOption( "Frustum Lock", "$Scene::lockCull", "" );
EVisibility.addOption( "Disable Zone Culling", "$Scene::disableZoneCulling", "" );
EVisibility.addOption( "Disable Terrain Occlusion", "$Scene::disableTerrainOcclusion", "" );
EVisibility.addOption( "Colorblindness: Protanopia", "$CBV_Protanopia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Protanomaly", "$CBV_Protanomaly", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Deuteranopia", "$CBV_Deuteranopia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Deuteranomaly", "$CBV_Deuteranomaly", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Tritanopia", "$CBV_Tritanopia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Tritanomaly", "$CBV_Tritanomaly", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Achromatopsia", "$CBV_Achromatopsia", "toggleColorBlindnessViz" );
EVisibility.addOption( "Colorblindness: Achromatomaly", "$CBV_Achromatomaly", "toggleColorBlindnessViz" );
}
function destroyWorldEditor()

View file

@ -317,10 +317,15 @@ function EditorGui::shutdown( %this )
/// will take over the default world editor window.
function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
{
//We need to cache the editors list. So first see if we have our list we cache the entries into
if(!isObject(EditorsMenuList))
{
new ArrayObject(EditorsMenuList);
}
%windowMenu = %this.findMenu( "Editors" );
%count = %windowMenu.getItemCount();
%alreadyExists = false;
for ( %i = 0; %i < %count; %i++ )
{
@ -336,7 +341,10 @@ function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
%accel = "";
if(!%alreadyExists)
{
EditorsMenuList.add(%displayName TAB %accel TAB %newPlugin);
%windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin );
}
return %accel;
}
@ -637,7 +645,7 @@ function EditorGui::addCameraBookmark( %this, %name )
if( !isObject(CameraBookmarks) )
{
%grp = new SimGroup(CameraBookmarks);
MissionGroup.add(%grp);
getScene(0).add(%grp);
}
CameraBookmarks.add( %obj );
@ -835,12 +843,17 @@ function EditorGui::syncCameraGui( %this )
function WorldEditorPlugin::onActivated( %this )
{
if(!isObject(Scenes))
$scenesRootGroup = new SimGroup(Scenes);
$scenesRootGroup.add(getScene(0));
EditorGui.bringToFront( EWorldEditor );
EWorldEditor.setVisible(true);
EditorGui.menuBar.insert( EditorGui.worldMenu, EditorGui.menuBar.dynamicItemInsertPos );
EWorldEditor.makeFirstResponder(true);
EditorTree.open(MissionGroup,true);
EWCreatorWindow.setNewObjectGroup(MissionGroup);
EditorTree.open($scenesRootGroup,true);
EWCreatorWindow.setNewObjectGroup(getScene(0));
EWorldEditor.syncGui();
@ -1302,6 +1315,7 @@ function VisibilityDropdownToggle()
{
EVisibility.setVisible(true);
visibilityToggleBtn.setStateOn(1);
EVisibility.setExtent("200 540");
}
}
@ -1463,7 +1477,7 @@ function EditorTree::onDeleteObject( %this, %object )
return true;
if( %object == EWCreatorWindow.objectGroup )
EWCreatorWindow.setNewObjectGroup( MissionGroup );
EWCreatorWindow.setNewObjectGroup( getScene(0) );
// Append it to our list.
%this.undoDeleteList = %this.undoDeleteList TAB %object;
@ -1569,169 +1583,119 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
%haveObjectEntries = false;
%haveLockAndHideEntries = true;
// Handle multi-selection.
//Set up the generic pop-up pre-emptively if we haven't already
%popup = new PopupMenu()
{
superClass = "MenuBuilder";
isPopup = "1";
object = -1;
bookmark = -1;
};
if( %this.getSelectedItemsCount() > 1 )
{
%popup = ETMultiSelectionContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETMultiSelectionContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();";
item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
};
%popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();";
%popup.item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
}
// Open context menu if this is a CameraBookmark
else if( %obj.isMemberOfClass( "CameraBookmark" ) )
{
%popup = ETCameraBookmarkContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETCameraBookmarkContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );";
bookmark = -1;
};
ETCameraBookmarkContextPopup.bookmark = %obj;
}
// Open context menu if this is set CameraBookmarks group.
else if( %obj.name $= "CameraBookmarks" )
{
%popup = ETCameraBookmarksGroupContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETCameraBookmarksGroupContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();";
};
}
// Open context menu if this is a SimGroup
else if( !%obj.isMemberOfClass( "SceneObject" ) )
{
%popup = ETSimGroupContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETSimGroupContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );";
item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );";
item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );";
item[ 3 ] = "-";
item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );";
item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );";
item[ 6 ] = "-";
item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
item[ 8 ] = "-";
item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );";
item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );";
item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );";
object = -1;
};
%popup.object = %obj;
%hasChildren = %obj.getCount() > 0;
%popup.enableItem( 10, %hasChildren );
%popup.enableItem( 11, %hasChildren );
%haveObjectEntries = true;
%haveLockAndHideEntries = false;
}
// Open generic context menu.
else
{
%popup = ETContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );";
item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );";
item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );";
item[ 3 ] = "-";
item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();";
item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();";
item[ 6 ] = "-";
item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
object = -1;
};
if( %obj.isMemberOfClass( "CameraBookmark" ) )
{
%popup.bookmark = %obj;
if(%obj.isMemberOfClass("Entity"))
{
%popup = ETEntityContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 12 ] = "-";
item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );";
};
%popup.item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( " @ %popup.bookmark.getInternalName() @ " );";
}
// Specialized version for ConvexShapes.
else if( %obj.isMemberOfClass( "ConvexShape" ) )
else if( %obj.name $= "CameraBookmarks" )
{
%popup = ETConvexShapeContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup )
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 8 ] = "-";
item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );";
item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );";
item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );";
item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );";
};
%popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();";
}
// Specialized version for polyhedral objects.
else if( %obj.isMemberOfClass( "Zone" ) ||
else if( %obj.isMemberOfClass( "Scene" ))
{
%popup.item[ 0 ] = "Set as Active Scene" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );";
%popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");";
%popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");";
%popup.item[ 3 ] = "-";
}
else
{
%popup.object = %obj;
%haveObjectEntries = true;
%popup.item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );";
%popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");";
%popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");";
%popup.item[ 3 ] = "-";
%popup.item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked ); EWorldEditor.syncGui();";
%popup.item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( " @ %popup.object @ ", !" @ %popup.object @ ".hidden ); EWorldEditor.syncGui();";
%popup.item[ 6 ] = "-";
%popup.item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
if( %obj.isMemberOfClass( "ConvexShape" ) )
{
%popup.item[ 8 ] = "-";
%popup.item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );";
%popup.item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );";
%popup.item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );";
%popup.item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );";
}
else if( %obj.isMemberOfClass( "Zone" ) ||
%obj.isMemberOfClass( "Portal" ) ||
%obj.isMemberOfClass( "OcclusionVolume" ) ||
%obj.isMemberOfClass( "SFXSpace" ) )
{
%popup = ETPolyObjectContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup )
{
%popup.item[ 8 ] = "-";
%popup.item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();";
}
else if(%obj.getClassName() $= "SimGroup" ||
%obj.isMemberOfClass( "Path" ) ||
%obj.isMemberOfClass("Entity") )
{
//If it's not any special-handle classes above, then it'll be group-based stuff here
%popup.item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( " @ %popup.object @ " );";
%popup.item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( " @ %popup.object @ " );";
%popup.item[ 8 ] = "-";
%popup.item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( " @ %popup.object @ " );";
%popup.item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", false );";
%popup.item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", true );";
%hasChildren = %obj.getCount() > 0;
%popup.enableItem( 10, %hasChildren );
%popup.enableItem( 11, %hasChildren );
%haveObjectEntries = true;
%haveLockAndHideEntries = false;
//Special case for Entities, which is special-case AND does group stuff with chld objects
if(%obj.isMemberOfClass("Entity"))
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 8 ] = "-";
item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();";
};
%popup.item[ 12 ] = "-";
%popup.item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( " @ %popup.object @ " );";
%popup.item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( " @ %popup.object @ " );";
%popup.item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( " @ %popup.object @ " );";
if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset)))
{
%popup.enableItem(13, true);
%popup.enableItem(14, false);
%popup.enableItem(15, false);
}
else
{
%popup.enableItem(13, false);
%popup.enableItem(14, true);
%popup.enableItem(15, true);
}
}
}
}
%popup.object = %obj;
%haveObjectEntries = true;
}
if( %haveObjectEntries )
{
%popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" );
%popup.enableItem( 1, %obj.getName() !$= "MissionGroup" );
%popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj !$= getScene(0) );
%popup.enableItem( 1, %obj !$= getScene(0) );
if( %haveLockAndHideEntries )
{
%popup.checkItem( 4, %obj.locked );
@ -1740,6 +1704,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
%popup.enableItem( 7, %this.isItemSelected( %itemId ) );
}
%popup.reloadItems();
%popup.showPopup( Canvas );
}
@ -2017,7 +1982,7 @@ function EWorldEditor::syncGui( %this )
%this.syncToolPalette();
EditorTree.update();
Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu );
Editor.getUndoManager().updateUndoMenu( EditorGui.findMenu("Edit") );
EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() );
EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 );
@ -2080,21 +2045,21 @@ function EWorldEditor::syncToolPalette( %this )
function EWorldEditor::addSimGroup( %this, %groupCurrentSelection )
{
%activeSelection = %this.getActiveSelection();
if ( %activeSelection.getObjectIndex( MissionGroup ) != -1 )
if ( %activeSelection.getObjectIndex( getScene(0) ) != -1 )
{
MessageBoxOK( "Error", "Cannot add MissionGroup to a new SimGroup" );
MessageBoxOK( "Error", "Cannot add Scene to a new SimGroup" );
return;
}
// Find our parent.
%parent = MissionGroup;
%parent = getScene(0);
if( !%groupCurrentSelection && isObject( %activeSelection ) && %activeSelection.getCount() > 0 )
{
%firstSelectedObject = %activeSelection.getObject( 0 );
if( %firstSelectedObject.isMemberOfClass( "SimGroup" ) )
%parent = %firstSelectedObject;
else if( %firstSelectedObject.getId() != MissionGroup.getId() )
else if( %firstSelectedObject.getId() != getScene(0).getId() )
%parent = %firstSelectedObject.parentGroup;
}
@ -2253,155 +2218,6 @@ function EWorldEditor::deleteMissionObject( %this, %object )
EditorTree.buildVisibleTree( true );
}
function EWorldEditor::createGameObject( %this, %entity )
{
if(!isObject(GameObjectBuilder))
{
new GuiControl(GameObjectBuilder, EditorGuiGroup) {
profile = "ToolsGuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
new GuiWindowCtrl(GameObjectBuilderTargetWindow) {
profile = "ToolsGuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "384 205";
extent = "256 102";
minExtent = "256 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
text = "Create Object";
new GuiTextCtrl() {
profile = "GuiCenterTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "9 26";
extent = "84 16";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
text = "Object Name:";
};
new GuiTextEditCtrl(GameObjectBuilderObjectName) {
class = ObjectBuilderGuiTextEditCtrl;
profile = "ToolsGuiTextEditProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "78 26";
extent = "172 18";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
helpTag = "0";
historySize = "0";
};
new GuiButtonCtrl(GameObjectBuilderOKButton) {
profile = "ToolsGuiButtonProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "7 250";
extent = "156 24";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
command = "EWorldEditor.buildGameObject();";
helpTag = "0";
text = "Create New";
Accelerator = "return";
};
new GuiButtonCtrl(GameObjectBuilderCancelButton) {
profile = "ToolsGuiButtonProfile";
horizSizing = "left";
vertSizing = "bottom";
position = "170 250";
extent = "80 24";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
command = "Canvas.popDialog(GameObjectBuilder);";
helpTag = "0";
text = "Cancel";
Accelerator = "escape";
};
};
};
GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88;
GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57;
GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57;
}
GameObjectBuilderObjectName.text = "";
GameObjectBuilder.selectedEntity = %entity;
Canvas.pushDialog(GameObjectBuilder);
}
function EWorldEditor::buildGameObject(%this)
{
if(GameObjectBuilderObjectName.getText() $= "")
{
error("Attempted to make a new Game Object with no name!");
Canvas.popDialog(GameObjectBuilder);
return;
}
%path = EditorSettings.value( "WorldEditor/newGameObjectDir" );
%className = GameObjectBuilderObjectName.getText();
GameObjectBuilder.selectedEntity.class = %className;
Inspector.inspect(GameObjectBuilder.selectedEntity);
%file = new FileObject();
if(%file.openForWrite(%path @ "\\" @ %className @ ".cs"))
{
%file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n");
%file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n");
//todo, pre-write any event functions of interest
%file.close();
}
//set up the paths
%tamlPath = %path @ "/" @ %className @ ".taml";
%scriptPath = %path @ "/" @ %className @ ".cs";
saveGameObject(%className, %tamlPath, %scriptPath);
//reload it
execGameObjects();
//now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later.
TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath);
GameObjectBuilder.selectedEntity = "";
Canvas.popDialog(GameObjectBuilder);
}
function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect )
{
if( !isObject( %set ) )

View file

@ -40,7 +40,7 @@ function ESelectObjectsWindow::toggleVisibility( %this )
/// to start searching for objects.
function ESelectObjectsWindow::getRootGroup( %this )
{
return MissionGroup;
return getScene(0);
}
//---------------------------------------------------------------------------------------------

View file

@ -34,7 +34,6 @@ EditorSettings.setDefaultValue( "orthoFOV", "50" );
EditorSettings.setDefaultValue( "orthoShowGrid", "1" );
EditorSettings.setDefaultValue( "currentEditor", "WorldEditorInspectorPlugin" );
EditorSettings.setDefaultValue( "newLevelFile", "tools/levels/BlankRoom.mis" );
EditorSettings.setDefaultValue( "newGameObjectDir", "scripts/server/gameObjects" );
if( isFile( "C:/Program Files/Torsion/Torsion.exe" ) )
EditorSettings.setDefaultValue( "torsionPath", "C:/Program Files/Torsion/Torsion.exe" );
@ -128,7 +127,7 @@ EditorSettings.setDefaultValue( "renderInfoText", "1" );
EditorSettings.beginGroup( "Grid" );
EditorSettings.setDefaultValue( "gridColor", "255 255 255 20" );
EditorSettings.setDefaultValue( "gridSize", "10 10 10" );
EditorSettings.setDefaultValue( "gridSize", "1 1 1" );
EditorSettings.setDefaultValue( "snapToGrid", "0" ); //<-- Not currently used
EditorSettings.setDefaultValue( "renderPlane", "0" );
EditorSettings.setDefaultValue( "renderPlaneHashes", "0" );

View file

@ -179,7 +179,7 @@ function EWCreatorWindow::createStatic( %this, %file )
return;
if( !isObject(%this.objectGroup) )
%this.setNewObjectGroup( MissionGroup );
%this.setNewObjectGroup( getScene(0) );
%objId = new TSStatic()
{
@ -197,7 +197,7 @@ function EWCreatorWindow::createPrefab( %this, %file )
return;
if( !isObject(%this.objectGroup) )
%this.setNewObjectGroup( MissionGroup );
%this.setNewObjectGroup( getScene(0) );
%objId = new Prefab()
{
@ -215,7 +215,7 @@ function EWCreatorWindow::createObject( %this, %cmd )
return;
if( !isObject(%this.objectGroup) )
%this.setNewObjectGroup( MissionGroup );
%this.setNewObjectGroup( getScene(0) );
pushInstantGroup();
%objId = eval(%cmd);
@ -304,36 +304,6 @@ function EWCreatorWindow::navigate( %this, %address )
%this.addShapeIcon( %obj );
}
}
//Add a separate folder for Game Objects
if(isClass("Entity"))
{
if(%address $= "")
{
%this.addFolderIcon("GameObjects");
}
else
{
//find all GameObjectAssets
%assetQuery = new AssetQuery();
if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset"))
return 0; //if we didn't find ANY, just exit
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
if(isFile(%gameObjectAsset.TAMLFilePath))
{
%this.addGameObjectIcon( %gameObjectAsset.gameObjectName );
}
}
}
}
}
if ( %this.tab $= "Meshes" )
@ -768,22 +738,6 @@ function EWCreatorWindow::addPrefabIcon( %this, %fullPath )
%this.contentCtrl.addGuiControl( %ctrl );
}
function EWCreatorWindow::addGameObjectIcon( %this, %gameObjectName )
{
%ctrl = %this.createIcon();
%ctrl.altCommand = "spawnGameObject( \"" @ %gameObjectName @ "\", true );";
%ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( "Prefab" );
%ctrl.text = %gameObjectName;
%ctrl.class = "CreatorGameObjectIconBtn";
%ctrl.tooltip = "Spawn the " @ %gameObjectName @ " GameObject";
%ctrl.buttonType = "radioButton";
%ctrl.groupNum = "-1";
%this.contentCtrl.addGuiControl( %ctrl );
}
function CreatorPopupMenu::onSelect( %this, %id, %text )
{
%split = strreplace( %text, "/", " " );

View file

@ -124,6 +124,12 @@ function WorldEditor::onSelectionCentroidChanged( %this )
Inspector.refresh();
}
function WorldEditor::setSceneAsDirty(%this)
{
EWorldEditor.isDirty = true;
}
//////////////////////////////////////////////////////////////////////////
function WorldEditor::init(%this)
@ -198,7 +204,7 @@ function WorldEditor::export(%this)
function WorldEditor::doExport(%this, %file)
{
missionGroup.save("~/editor/" @ %file, true);
getScene(0).save("~/editor/" @ %file, true);
}
function WorldEditor::import(%this)

View file

@ -367,3 +367,81 @@ function toggleBackbufferViz( %enable )
else if ( !%enable )
AL_DeferredShading.enable();
}
function toggleColorBlindnessViz( %enable )
{
if ( %enable $= "" )
{
$CBV_Protanopia = ColorBlindnessVisualize.isEnabled() ? false : true;
ColorBlindnessVisualize.toggle();
}
else if ( %enable )
ColorBlindnessVisualize.enable();
else if ( !%enable )
ColorBlindnessVisualize.disable();
}
new ShaderData( ColorBlindnessVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "tools/worldEditor/scripts/shaders/dbgColorBlindnessVisualizeP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = "tools/worldEditor/scripts/shaders/dbgColorBlindnessVisualizeP.glsl";
samplerNames[0] = "$backBuffer";
pixVersion = 2.0;
};
singleton PostEffect( ColorBlindnessVisualize )
{
isEnabled = false;
allowReflectPass = false;
renderTime = "PFXAfterBin";
renderBin = "GlowBin";
shader = ColorBlindnessVisualizeShader;
stateBlock = PFX_DefaultStateBlock;
texture[0] = "$backBuffer";
target = "$backBuffer";
renderPriority = 10;
};
function ColorBlindnessVisualize::setShaderConsts(%this)
{
%mode = 0;
if($CBV_Protanopia)
%mode = 1;
else if($CBV_Protanomaly)
%mode = 2;
else if($CBV_Deuteranopia)
%mode = 3;
else if($CBV_Deuteranomaly)
%mode = 4;
else if($CBV_Tritanopia)
%mode = 5;
else if($CBV_Tritanomaly)
%mode = 6;
else if($CBV_Achromatopsia)
%mode = 7;
else if($CBV_Achromatomaly)
%mode = 8;
%this.setShaderConst("$mode", %mode);
}
function ColorBlindnessVisualize::onEnabled( %this )
{
AL_NormalsVisualize.disable();
AL_DepthVisualize.disable();
AL_LightSpecularVisualize.disable();
AL_LightColorVisualize.disable();
$AL_NormalsVisualizeVar = false;
$AL_DepthVisualizeVar = false;
$AL_LightSpecularVisualizeVar = false;
$AL_LightColorVisualizeVar = false;
return true;
}

View file

@ -272,7 +272,7 @@ function EditorSaveMission()
// now write the terrain and mission files out:
if(EWorldEditor.isDirty || ETerrainEditor.isMissionDirty)
MissionGroup.save($Server::MissionFile);
getScene(0).save($Server::MissionFile);
if(ETerrainEditor.isDirty)
{
// Find all of the terrain files
@ -483,6 +483,21 @@ function EditorOpenMission(%filename)
}
}
function EditorOpenSceneAppend(%levelAsset)
{
//Load the asset's level file
exec(%levelAsset.levelFile);
//We'll assume the scene name and assetname are the same for now
%sceneName = %levelAsset.AssetName;
%scene = nameToID(%sceneName);
if(isObject(%scene))
{
//Append it to our scene heirarchy
$scenesRootGroup.add(%scene);
}
}
function EditorExportToCollada()
{
@ -587,6 +602,13 @@ function makeSelectedAMesh()
EditorTree.buildVisibleTree( true );
}
function EditorTakeControlOfEntity()
{
%object = EWorldEditor.getSelectedObject(0);
switchCamera(localClientConnection, %object);
switchControlObject(localClientConnection, %object);
}
function EditorMount()
{
echo( "EditorMount" );

View file

@ -110,9 +110,13 @@ function EditorGui::buildMenus(%this)
};
// Menu bar
%this.menuBar = new MenuBar(WorldEditorMenubar)
%this.menuBar = new GuiMenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
extent = Canvas.extent.x SPC "20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
};
// File Menu
@ -158,7 +162,7 @@ function EditorGui::buildMenus(%this)
%fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
%fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
%this.menuBar.insert(%fileMenu, %this.menuBar.getCount());
%this.menuBar.insert(%fileMenu);
// Edit Menu
%editMenu = new PopupMenu()
@ -187,7 +191,7 @@ function EditorGui::buildMenus(%this)
item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);";
item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);";
};
%this.menuBar.insert(%editMenu, %this.menuBar.getCount());
%this.menuBar.insert(%editMenu);
// View Menu
%viewMenu = new PopupMenu()
@ -201,7 +205,7 @@ function EditorGui::buildMenus(%this)
item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();";
item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();";
};
%this.menuBar.insert(%viewMenu, %this.menuBar.getCount());
%this.menuBar.insert(%viewMenu);
// Camera Menu
%cameraMenu = new PopupMenu()
@ -229,7 +233,8 @@ function EditorGui::buildMenus(%this)
Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();";
item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu;
};
%this.menuBar.insert(%cameraMenu, %this.menuBar.getCount());
%this.menuBar.insert(%cameraMenu);
// Snap Menu
%snapToMenu = new PopupMenu()
@ -252,8 +257,8 @@ function EditorGui::buildMenus(%this)
item[8] = "Snap 2nd Object to 1st Z-" TAB "" TAB "Z-";
};
%this.menuBar.insert(%snapToMenu, %this.menuBar.getCount());
%this.menuBar.insert(%snapToMenu);
// Editors Menu
%editorsMenu = new PopupMenu()
{
@ -269,7 +274,42 @@ function EditorGui::buildMenus(%this)
//item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin;
//item[5] = "-";
};
%this.menuBar.insert(%editorsMenu, %this.menuBar.getCount());
%this.menuBar.insert(%editorsMenu);
//if we're just refreshing the menus, we probably have a list of editors we want added to the Editors menu there, so check and if so, add them now
if(isObject(EditorsMenuList))
{
%editorsListCount = EditorsMenuList.count();
for(%e = 0; %e < %editorsListCount; %e++)
{
%menuEntry = EditorsMenuList.getKey(%e);
%editorsMenu.addItem(%e, %menuEntry);
}
}
if(isObject(PhysicsEditorPlugin))
{
%physicsToolsMenu = new PopupMenu()
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
%this.menuBar.insert( %physicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
}
// Lighting Menu
%lightingMenu = new PopupMenu()
@ -286,7 +326,7 @@ function EditorGui::buildMenus(%this)
// NOTE: The light managers will be inserted as the
// last menu items in EditorLightingMenu::onAdd().
};
%this.menuBar.insert(%lightingMenu, %this.menuBar.getCount());
%this.menuBar.insert(%lightingMenu);
// Tools Menu
%toolsMenu = new PopupMenu()
@ -301,7 +341,7 @@ function EditorGui::buildMenus(%this)
item[2] = "Torque SimView" TAB "" TAB "tree();";
item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();";
};
%this.menuBar.insert(%toolsMenu, %this.menuBar.getCount());
%this.menuBar.insert(%toolsMenu);
// Help Menu
%helpMenu = new PopupMenu()
@ -316,7 +356,7 @@ function EditorGui::buildMenus(%this)
item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);";
item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);";
};
%this.menuBar.insert(%helpMenu, %this.menuBar.getCount());
%this.menuBar.insert(%helpMenu);
// Menus that are added/removed dynamically (temporary)
@ -398,14 +438,21 @@ function EditorGui::buildMenus(%this)
Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();";
Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();";
Item[19] = "-";
Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();";
Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();";
Item[20] = "Take control of entity" TAB "" TAB "EditorTakeControlOfEntity();";
Item[21] = "-";
Item[22] = "Mount Selection A to B" TAB "" TAB "EditorMount();";
Item[23] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();";
};
}
}
//////////////////////////////////////////////////////////////////////////
function WorldEditorMenubar::onResize(%this)
{
%this.extent.x = Canvas.extent.x;
}
function EditorGui::attachMenus(%this)
{
%this.menuBar.attachToCanvas(Canvas, 0);
@ -421,9 +468,9 @@ function EditorGui::setMenuDefaultState(%this)
if(! isObject(%this.menuBar))
return 0;
for(%i = 0;%i < %this.menuBar.getCount();%i++)
for(%i = 0;%i < %this.menuBar.getMenuCount();%i++)
{
%menu = %this.menuBar.getObject(%i);
%menu = %this.menuBar.getMenu(%i);
%menu.setupDefaultState();
}
@ -437,9 +484,10 @@ function EditorGui::findMenu(%this, %name)
if(! isObject(%this.menuBar))
return 0;
for(%i = 0;%i < %this.menuBar.getCount();%i++)
for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++)
{
%menu = %this.menuBar.getObject(%i);
%menu = %this.menuBar.getMenu(%i);
if(%name $= %menu.barTitle)
return %menu;

View file

@ -0,0 +1,121 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
//Using calculations and values provided by Alan Zucconi
// www.alanzucconi.com
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
in vec2 uv0;
uniform sampler2D backBufferTex;
in float mode;
out vec4 OUT_col;
void main()
{
vec4 imageColor = texture( backBufferTex, uv0 );
if(mode == 0)
{
OUT_col = imageColor;
}
else
{
vec3 R = imageColor.r;
vec3 G = imageColor.g;
vec3 B = imageColor.b;
if(mode == 1) // Protanopia
{
R = vec3(0.56667, 0.43333, 0);
G = vec3(0.55833, 0.44167, 0);
B = vec3(0, 0.24167, 0.75833);
}
else if(mode == 2) // Protanomaly
{
R = vec3(0.81667, 0.18333, 0);
G = vec3(0.33333, 0.66667, 0);
B = vec3(0, 0.125, 0.875);
}
else if(mode == 3) // Deuteranopia
{
R = vec3(0.625, 0.375, 0);
G = vec3(0.70, 0.30, 0);
B = vec3(0, 0.30, 0.70);
}
else if(mode == 4) // Deuteranomaly
{
R = vec3(0.80, 0.20, 0);
G = vec3(0.25833, 0.74167, 0);
B = vec3(0, 0.14167, 0.85833);
}
else if(mode == 5) // Tritanopia
{
R = vec3(0.95, 0.05, 0);
G = vec3(0, 0.43333, 0.56667);
B = vec3(0, 0.475, 0.525);
}
else if(mode == 6) // Tritanomaly
{
R = vec3(0.96667, 0.03333, 0);
G = vec3(0, 0.73333, 0.26667);
B = vec3(0, 0.18333, 0.81667);
}
else if(mode == 7) // Achromatopsia
{
R = vec3(0.299, 0.587, 0.114);
G = vec3(0.299, 0.587, 0.114);
B = vec3(0.299, 0.587, 0.114);
}
else if(mode == 8) // Achromatomaly
{
R = vec3(0.618, 0.32, 0.062);
G = vec3(0.163, 0.775, 0.062);
B = vec3(0.163, 0.320, 0.516);
}
//First set
vec4 c = imageColor;
c.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
c.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
c.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
vec3 cb = c.rgb;
cb.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
cb.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
cb.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
// Difference
vec3 diff = abs(c.rgb - cb);
float lum = c.r*.3 + c.g*.59 + c.b*.11;
vec3 bw = vec3(lum, lum, lum);
// return vec4(lerp(bw, vec3(1, 0, 0), saturate((diff.r + diff.g + diff.b) / 3)), c.a);
OUT_col = vec4(c.rgb,1);
}
}

View file

@ -0,0 +1,118 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
//Using calculations and values provided by Alan Zucconi
// www.alanzucconi.com
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(backBufferTex,0);
uniform float mode;
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float4 imageColor = TORQUE_TEX2D( backBufferTex, IN.uv0 );
if(mode == 0)
{
return imageColor;
}
else
{
float3 R = imageColor.r;
float3 G = imageColor.g;
float3 B = imageColor.b;
if(mode == 1) // Protanopia
{
R = float3(0.56667, 0.43333, 0);
G = float3(0.55833, 0.44167, 0);
B = float3(0, 0.24167, 0.75833);
}
else if(mode == 2) // Protanomaly
{
R = float3(0.81667, 0.18333, 0);
G = float3(0.33333, 0.66667, 0);
B = float3(0, 0.125, 0.875);
}
else if(mode == 3) // Deuteranopia
{
R = float3(0.625, 0.375, 0);
G = float3(0.70, 0.30, 0);
B = float3(0, 0.30, 0.70);
}
else if(mode == 4) // Deuteranomaly
{
R = float3(0.80, 0.20, 0);
G = float3(0.25833, 0.74167, 0);
B = float3(0, 0.14167, 0.85833);
}
else if(mode == 5) // Tritanopia
{
R = float3(0.95, 0.05, 0);
G = float3(0, 0.43333, 0.56667);
B = float3(0, 0.475, 0.525);
}
else if(mode == 6) // Tritanomaly
{
R = float3(0.96667, 0.03333, 0);
G = float3(0, 0.73333, 0.26667);
B = float3(0, 0.18333, 0.81667);
}
else if(mode == 7) // Achromatopsia
{
R = float3(0.299, 0.587, 0.114);
G = float3(0.299, 0.587, 0.114);
B = float3(0.299, 0.587, 0.114);
}
else if(mode == 8) // Achromatomaly
{
R = float3(0.618, 0.32, 0.062);
G = float3(0.163, 0.775, 0.062);
B = float3(0.163, 0.320, 0.516);
}
//First set
float4 c = imageColor;
c.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
c.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
c.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
float3 cb = c.rgb;
cb.r = c.r * R[0] + c.g * R[1] + c.b * R[2];
cb.g = c.r * G[0] + c.g * G[1] + c.b * G[2];
cb.b = c.r * B[0] + c.g * B[1] + c.b * B[2];
// Difference
float3 diff = abs(c.rgb - cb);
float lum = c.r*.3 + c.g*.59 + c.b*.11;
float3 bw = float3(lum, lum, lum);
// return float4(lerp(bw, float3(1, 0, 0), saturate((diff.r + diff.g + diff.b) / 3)), c.a);
return float4(c.rgb,1);
}
}

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D colorBufferTex;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
in vec2 uv0;

View file

@ -20,14 +20,14 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "core/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
TORQUE_UNIFORM_SAMPLER1D(depthViz, 1);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float depth = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).w;
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
return float4( TORQUE_TEX1D( depthViz, depth ).rgb, 1.0 );
}

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D glowBuffer;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(glowBuffer, 0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D lightDeferredTex;

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/shaderModelAutoGen.hlsl"
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D lightDeferredTex;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
in vec2 uv0;

View file

@ -20,13 +20,13 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "core/shaders/shaderModelAutoGen.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
#include "../../../../core/rendering/shaders/shaderModelAutoGen.hlsl"
TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0);
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
{
float3 normal = TORQUE_PREPASS_UNCONDITION( deferredTex, IN.uv0 ).xyz;
float3 normal = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).xyz;
return float4( ( normal + 1.0 ) * 0.5, 1.0 );
}

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D shadowMap;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/shaderModel.hlsl"
#include "../../../../core/rendering/shaders/shaderModel.hlsl"
struct MaterialDecoratorConnectV
{

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/gl/hlslCompat.glsl"
#include "../../../../core/rendering/shaders/gl/hlslCompat.glsl"
in vec2 uv0;
uniform sampler2D matinfoTex;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "core/shaders/postfx/postFx.hlsl"
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(matinfoTex,0);