mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-20 03:45:26 +00:00
Removes current implement of shadow caching
Also removes EC stuff as it's not ready for prime-time yet
This commit is contained in:
parent
f007700646
commit
66cc6fb9d1
141 changed files with 67 additions and 19491 deletions
|
|
@ -25,7 +25,6 @@ function CoreModule::onCreate(%this)
|
|||
ModuleDatabase.LoadExplicit( "Core_Lighting" );
|
||||
ModuleDatabase.LoadExplicit( "Core_SFX" );
|
||||
ModuleDatabase.LoadExplicit( "Core_PostFX" );
|
||||
ModuleDatabase.LoadExplicit( "Core_Components" );
|
||||
ModuleDatabase.LoadExplicit( "Core_GameObjects" );
|
||||
|
||||
%prefPath = getPrefpath();
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
function Core_Components::onCreate(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function Core_Components::onDestroy(%this)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<ModuleDefinition
|
||||
ModuleId="Core_Components"
|
||||
VersionId="1"
|
||||
Description="Module that implements the core engine-level setup for the game."
|
||||
ScriptFile="Core_Components.cs"
|
||||
CreateFunction="onCreate"
|
||||
DestroyFunction="onDestroy"
|
||||
Group="Core">
|
||||
<DeclaredAssets
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
Extension="asset.taml"
|
||||
Recurse="true" />
|
||||
<AutoloadAssets
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetType="ComponentAsset"
|
||||
Recurse="true" />
|
||||
</ModuleDefinition>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="RigidBodyComponentAsset"
|
||||
componentClass="RigidBodyComponent"
|
||||
friendlyName="Rigid Body"
|
||||
componentType="Physics"
|
||||
description="Allows an entity to have rigid body physics." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="ActionAnimationComponentAsset"
|
||||
componentClass="ActionAnimationComponent"
|
||||
friendlyName="Action Animation"
|
||||
componentType="animation"
|
||||
description="Allows a mesh component to be animated." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="AIControllerComponentAsset"
|
||||
componentClass="AIControllerComponent"
|
||||
friendlyName="AI Player Controller"
|
||||
componentType="Game"
|
||||
description="Enables an entity to move like a player object." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="AnimationComponentAsset"
|
||||
componentClass="AnimationComponent"
|
||||
friendlyName="animation"
|
||||
componentType="animation"
|
||||
description="Allows a mesh component to be animated." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="ArmAnimationComponentAsset"
|
||||
componentClass="ArmAnimationComponent"
|
||||
friendlyName="Arm Animation"
|
||||
componentType="animation"
|
||||
description="Allows a mesh component to be animated." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="CameraOrbiterComponentAsset"
|
||||
componentClass="CameraOrbiterComponent"
|
||||
friendlyName="Camera Orbiter"
|
||||
componentType="Game"
|
||||
description="Acts as a boon arm for a camera component." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="ShapeCollisionComponentAsset"
|
||||
componentClass="ShapeCollisionComponent"
|
||||
friendlyName="Shape Collision"
|
||||
componentType="Collision"
|
||||
description="Enables an entity to collide with things with bounds, collision or visible meshes" />
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="CameraComponentAsset"
|
||||
componentClass="CameraComponent"
|
||||
friendlyName="Camera"
|
||||
componentType="Game"
|
||||
description="Allows the component owner to operate as a camera."
|
||||
scriptFile="core/components/components/game/camera.cs" />
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function CameraComponent::onAdd(%this)
|
||||
{
|
||||
%this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
|
||||
|
||||
%test = %this.clientOwner;
|
||||
|
||||
%barf = ClientGroup.getCount();
|
||||
|
||||
%clientID = %this.getClientID();
|
||||
if(%clientID && !isObject(%clientID.camera))
|
||||
{
|
||||
%this.scopeToClient(%clientID);
|
||||
%this.setDirty();
|
||||
|
||||
%clientID.setCameraObject(%this.owner);
|
||||
%clientID.setControlCameraFov(%this.FOV);
|
||||
|
||||
%clientID.camera = %this.owner;
|
||||
}
|
||||
|
||||
%res = $pref::Video::mode;
|
||||
%derp = 0;
|
||||
}
|
||||
|
||||
function CameraComponent::onRemove(%this)
|
||||
{
|
||||
%clientID = %this.getClientID();
|
||||
if(%clientID)
|
||||
%clientID.clearCameraObject();
|
||||
}
|
||||
|
||||
function CameraComponent::onInspectorUpdate(%this)
|
||||
{
|
||||
//if(%this.clientOwner)
|
||||
//%this.clientOwner.setCameraObject(%this.owner);
|
||||
}
|
||||
|
||||
function CameraComponent::getClientID(%this)
|
||||
{
|
||||
return ClientGroup.getObject(%this.clientOwner-1);
|
||||
}
|
||||
|
||||
function CameraComponent::isClientCamera(%this, %client)
|
||||
{
|
||||
%clientID = ClientGroup.getObject(%this.clientOwner-1);
|
||||
|
||||
if(%client.getID() == %clientID)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function CameraComponent::onClientConnect(%this, %client)
|
||||
{
|
||||
//if(%this.isClientCamera(%client) && !isObject(%client.camera))
|
||||
//{
|
||||
%this.scopeToClient(%client);
|
||||
%this.setDirty();
|
||||
|
||||
%client.setCameraObject(%this.owner);
|
||||
%client.setControlCameraFov(%this.FOV);
|
||||
|
||||
%client.camera = %this.owner;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
|
||||
//}
|
||||
}
|
||||
|
||||
function CameraComponent::onClientDisconnect(%this, %client)
|
||||
{
|
||||
Parent::onClientDisconnect(%this, %client);
|
||||
|
||||
if(isClientCamera(%client)){
|
||||
%this.clearScopeToClient(%client);
|
||||
%client.clearCameraObject();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
function VRCameraComponent::onAdd(%this)
|
||||
{
|
||||
%this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
|
||||
|
||||
%test = %this.clientOwner;
|
||||
|
||||
%barf = ClientGroup.getCount();
|
||||
|
||||
%clientID = %this.getClientID();
|
||||
if(%clientID && !isObject(%clientID.camera))
|
||||
{
|
||||
%this.scopeToClient(%clientID);
|
||||
%this.setDirty();
|
||||
|
||||
%clientID.setCameraObject(%this.owner);
|
||||
%clientID.setControlCameraFov(%this.FOV);
|
||||
|
||||
%clientID.camera = %this.owner;
|
||||
}
|
||||
|
||||
%res = $pref::Video::mode;
|
||||
%derp = 0;
|
||||
}
|
||||
|
||||
function VRCameraComponent::onRemove(%this)
|
||||
{
|
||||
%clientID = %this.getClientID();
|
||||
if(%clientID)
|
||||
%clientID.clearCameraObject();
|
||||
}
|
||||
|
||||
function CameraComponent::onInspectorUpdate(%this)
|
||||
{
|
||||
//if(%this.clientOwner)
|
||||
//%this.clientOwner.setCameraObject(%this.owner);
|
||||
}
|
||||
|
||||
function VRCameraComponent::getClientID(%this)
|
||||
{
|
||||
return ClientGroup.getObject(%this.clientOwner-1);
|
||||
}
|
||||
|
||||
function VRCameraComponent::isClientCamera(%this, %client)
|
||||
{
|
||||
%clientID = ClientGroup.getObject(%this.clientOwner-1);
|
||||
|
||||
if(%client.getID() == %clientID)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function VRCameraComponent::onClientConnect(%this, %client)
|
||||
{
|
||||
//if(%this.isClientCamera(%client) && !isObject(%client.camera))
|
||||
//{
|
||||
%this.scopeToClient(%client);
|
||||
%this.setDirty();
|
||||
|
||||
%client.setCameraObject(%this.owner);
|
||||
%client.setControlCameraFov(%this.FOV);
|
||||
|
||||
%client.camera = %this.owner;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
|
||||
//}
|
||||
}
|
||||
|
||||
function VRCameraComponent::onClientDisconnect(%this, %client)
|
||||
{
|
||||
Parent::onClientDisconnect(%this, %client);
|
||||
|
||||
if(isClientCamera(%client)){
|
||||
%this.clearScopeToClient(%client);
|
||||
%client.clearCameraObject();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="ControlObjectComponentAsset"
|
||||
componentName="ControlObjectComponent"
|
||||
componentClass="ControlObjectComponent"
|
||||
friendlyName="Control Object"
|
||||
componentType="Game"
|
||||
description="Allows the component owner to be controlled by a client." />
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="ItemRotationComponentAsset"
|
||||
componentName="ItemRotationComponent"
|
||||
componentClass="Component"
|
||||
friendlyName="Item Rotation"
|
||||
componentType="Game"
|
||||
description="Rotates the entity around an axis, like an item pickup."
|
||||
scriptFile="core/components/components/game/itemRotate.cs" />
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//registerComponent("ItemRotationComponent", "Component", "Item Rotation", "Game", false, "Rotates the entity around the z axis, like an item pickup.");
|
||||
|
||||
function ItemRotationComponent::onAdd(%this)
|
||||
{
|
||||
%this.addComponentField(rotationsPerMinute, "Number of rotations per minute", "float", "5", "");
|
||||
%this.addComponentField(forward, "Rotate forward or backwards", "bool", "1", "");
|
||||
%this.addComponentField(horizontal, "Rotate horizontal or verticle, true for horizontal", "bool", "1", "");
|
||||
}
|
||||
|
||||
function ItemRotationComponent::Update(%this)
|
||||
{
|
||||
%tickRate = 0.032;
|
||||
|
||||
//Rotations per second is calculated based on a standard update tick being 32ms. So we scale by the tick speed, then add that to our rotation to
|
||||
//get a nice rotation speed.
|
||||
if(%this.horizontal)
|
||||
{
|
||||
if(%this.forward)
|
||||
%this.owner.rotation.z += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
|
||||
else
|
||||
%this.owner.rotation.z -= ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.owner.rotation.x += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="PlayerSpawnerComponentAsset"
|
||||
componentName="PlayerSpawner"
|
||||
componentClass="Component"
|
||||
friendlyName="Player Spawner"
|
||||
componentType="Game"
|
||||
description="When a client connects, it spawns a player object for them and attaches them to it."
|
||||
scriptFile="core/components/components/game/playerSpawner.cs" />
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//registerComponent("PlayerSpawner", "Component",
|
||||
// "Player Spawner", "Game", false, "When a client connects, it spawns a player object for them and attaches them to it");
|
||||
|
||||
function PlayerSpawner::onAdd(%this)
|
||||
{
|
||||
%this.clientCount = 1;
|
||||
%this.friendlyName = "Player Spawner";
|
||||
%this.componentType = "Spawner";
|
||||
|
||||
%this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject");
|
||||
}
|
||||
|
||||
function PlayerSpawner::onClientConnect(%this, %client)
|
||||
{
|
||||
%playerObj = spawnGameObject(%this.GameObjectName, false);
|
||||
|
||||
if(!isObject(%playerObj))
|
||||
return;
|
||||
|
||||
%playerObj.position = %this.owner.position;
|
||||
|
||||
%playerObj.notify("onClientConnect", %client);
|
||||
|
||||
switchControlObject(%client, %playerObj);
|
||||
switchCamera(%client, %playerObj);
|
||||
|
||||
%client.player = %playerObj;
|
||||
%client.camera = %playerObj;
|
||||
|
||||
%inventory = %playerObj.getComponent(InventoryController);
|
||||
|
||||
if(isObject(%inventory))
|
||||
{
|
||||
for(%i=0; %i<5; %i++)
|
||||
{
|
||||
%arrow = spawnGameObject(ArrowProjectile, false);
|
||||
|
||||
%inventory.addItem(%arrow);
|
||||
}
|
||||
}
|
||||
|
||||
%playerObj.position = %this.owner.position;
|
||||
%playerObj.rotation = "0 0 0";
|
||||
|
||||
%this.clientCount++;
|
||||
}
|
||||
|
||||
function PlayerSpawner::onClientDisConnect(%this, %client)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerSpawner::getClientID(%this)
|
||||
{
|
||||
return ClientGroup.getObject(%this.clientOwner-1);
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="FPSControlsComponentAsset"
|
||||
componentName="FPSControls"
|
||||
componentClass="Component"
|
||||
friendlyName="FPS Controls"
|
||||
componentType="Input"
|
||||
description="First Person Shooter-type controls." />
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//registerComponent("FPSControls", "Component", "FPS Controls", "Input", false, "First Person Shooter-type controls");
|
||||
|
||||
function FPSControls::onAdd(%this)
|
||||
{
|
||||
//
|
||||
%this.beginGroup("Keys");
|
||||
%this.addComponentField(forwardKey, "Key to bind to vertical thrust", keybind, "keyboard w");
|
||||
%this.addComponentField(backKey, "Key to bind to vertical thrust", keybind, "keyboard s");
|
||||
%this.addComponentField(leftKey, "Key to bind to horizontal thrust", keybind, "keyboard a");
|
||||
%this.addComponentField(rightKey, "Key to bind to horizontal thrust", keybind, "keyboard d");
|
||||
|
||||
%this.addComponentField(jump, "Key to bind to horizontal thrust", keybind, "keyboard space");
|
||||
%this.endGroup();
|
||||
|
||||
%this.beginGroup("Mouse");
|
||||
%this.addComponentField(pitchAxis, "Key to bind to horizontal thrust", keybind, "mouse yaxis");
|
||||
%this.addComponentField(yawAxis, "Key to bind to horizontal thrust", keybind, "mouse xaxis");
|
||||
%this.endGroup();
|
||||
|
||||
%this.addComponentField(moveSpeed, "Horizontal thrust force", float, 300.0);
|
||||
%this.addComponentField(jumpStrength, "Vertical thrust force", float, 3.0);
|
||||
//
|
||||
|
||||
%control = %this.owner.getComponent( ControlObjectComponent );
|
||||
if(!%control)
|
||||
return echo("SPECTATOR CONTROLS: No Control Object behavior!");
|
||||
|
||||
//%this.Physics = %this.owner.getComponent( PlayerPhysicsComponent );
|
||||
|
||||
//%this.Animation = %this.owner.getComponent( AnimationComponent );
|
||||
|
||||
//%this.Camera = %this.owner.getComponent( MountedCameraComponent );
|
||||
|
||||
//%this.Animation.playThread(0, "look");
|
||||
|
||||
%this.setupControls(%control.getClientID());
|
||||
}
|
||||
|
||||
function FPSControls::onRemove(%this)
|
||||
{
|
||||
Parent::onBehaviorRemove(%this);
|
||||
|
||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.forwardKey);
|
||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.backKey);
|
||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.leftKey);
|
||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.rightKey);
|
||||
|
||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.pitchAxis);
|
||||
commandToClient(%control.clientOwnerID, 'removeInput', %this.yawAxis);
|
||||
}
|
||||
|
||||
function FPSControls::onBehaviorFieldUpdate(%this, %field)
|
||||
{
|
||||
%controller = %this.owner.getBehavior( ControlObjectBehavior );
|
||||
commandToClient(%controller.clientOwnerID, 'updateInput', %this.getFieldValue(%field), %field);
|
||||
}
|
||||
|
||||
function FPSControls::onClientConnect(%this, %client)
|
||||
{
|
||||
%this.setupControls(%client);
|
||||
}
|
||||
|
||||
|
||||
function FPSControls::setupControls(%this, %client)
|
||||
{
|
||||
%control = %this.owner.getComponent( ControlObjectComponent );
|
||||
if(!%control.isControlClient(%client))
|
||||
{
|
||||
echo("FPS CONTROLS: Client Did Not Match");
|
||||
return;
|
||||
}
|
||||
|
||||
%inputCommand = "FPSControls";
|
||||
|
||||
%test = %this.forwardKey;
|
||||
|
||||
/*SetInput(%client, %this.forwardKey.x, %this.forwardKey.y, %inputCommand@"_forwardKey");
|
||||
SetInput(%client, %this.backKey.x, %this.backKey.y, %inputCommand@"_backKey");
|
||||
SetInput(%client, %this.leftKey.x, %this.leftKey.y, %inputCommand@"_leftKey");
|
||||
SetInput(%client, %this.rightKey.x, %this.rightKey.y, %inputCommand@"_rightKey");
|
||||
|
||||
SetInput(%client, %this.jump.x, %this.jump.y, %inputCommand@"_jump");
|
||||
|
||||
SetInput(%client, %this.pitchAxis.x, %this.pitchAxis.y, %inputCommand@"_pitchAxis");
|
||||
SetInput(%client, %this.yawAxis.x, %this.yawAxis.y, %inputCommand@"_yawAxis");*/
|
||||
|
||||
SetInput(%client, "keyboard", "w", %inputCommand@"_forwardKey");
|
||||
SetInput(%client, "keyboard", "s", %inputCommand@"_backKey");
|
||||
SetInput(%client, "keyboard", "a", %inputCommand@"_leftKey");
|
||||
SetInput(%client, "keyboard", "d", %inputCommand@"_rightKey");
|
||||
|
||||
SetInput(%client, "keyboard", "space", %inputCommand@"_jump");
|
||||
|
||||
SetInput(%client, "mouse", "yaxis", %inputCommand@"_pitchAxis");
|
||||
SetInput(%client, "mouse", "xaxis", %inputCommand@"_yawAxis");
|
||||
|
||||
SetInput(%client, "keyboard", "f", %inputCommand@"_flashlight");
|
||||
|
||||
}
|
||||
|
||||
function FPSControls::onMoveTrigger(%this, %triggerID)
|
||||
{
|
||||
//check if our jump trigger was pressed!
|
||||
if(%triggerID == 2)
|
||||
{
|
||||
%this.owner.applyImpulse("0 0 0", "0 0 " @ %this.jumpStrength);
|
||||
}
|
||||
}
|
||||
|
||||
function FPSControls::Update(%this)
|
||||
{
|
||||
return;
|
||||
|
||||
%moveVector = %this.owner.getMoveVector();
|
||||
%moveRotation = %this.owner.getMoveRotation();
|
||||
|
||||
%this.Physics.moveVector = "0 0 0";
|
||||
|
||||
if(%moveVector.x != 0)
|
||||
{
|
||||
%fv = VectorNormalize(%this.owner.getRightVector());
|
||||
|
||||
%forMove = VectorScale(%fv, (%moveVector.x));// * (%this.moveSpeed * 0.032)));
|
||||
|
||||
//%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
||||
|
||||
%this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove);
|
||||
|
||||
//if(%forMove > 0)
|
||||
// %this.Animation.playThread(1, "run");
|
||||
}
|
||||
/*else
|
||||
{
|
||||
%fv = VectorNormalize(%this.owner.getRightVector());
|
||||
|
||||
%forMove = VectorScale(%fv, (%moveVector.x * (%this.moveSpeed * 0.032)));
|
||||
|
||||
if(%forMove <= 0)
|
||||
%this.Animation.stopThread(1);
|
||||
|
||||
}*/
|
||||
|
||||
if(%moveVector.y != 0)
|
||||
{
|
||||
%fv = VectorNormalize(%this.owner.getForwardVector());
|
||||
|
||||
%forMove = VectorScale(%fv, (%moveVector.y));// * (%this.moveSpeed * 0.032)));
|
||||
|
||||
//%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
||||
|
||||
%this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove);
|
||||
|
||||
//if(VectorLen(%this.Physics.velocity) < 2)
|
||||
// %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
||||
}
|
||||
|
||||
/*if(%moveVector.z)
|
||||
{
|
||||
%fv = VectorNormalize(%this.owner.getUpVector());
|
||||
|
||||
%forMove = VectorScale(%fv, (%moveVector.z * (%this.moveSpeed * 0.032)));
|
||||
|
||||
%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
|
||||
}*/
|
||||
|
||||
if(%moveRotation.x != 0)
|
||||
{
|
||||
%look = mRadToDeg(%moveRotation.x) / 180;
|
||||
|
||||
//%this.Animation.setThreadPos(0, %look);
|
||||
|
||||
%this.owner.getComponent( MountedCameraComponent ).rotationOffset.x += mRadToDeg(%moveRotation.x);
|
||||
|
||||
//%this.Camera.rotationOffset.x += mRadToDeg(%moveRotation.x);
|
||||
}
|
||||
// %this.owner.rotation.x += mRadToDeg(%moveRotation.x);
|
||||
|
||||
if(%moveRotation.z != 0)
|
||||
{
|
||||
%zrot = mRadToDeg(%moveRotation.z);
|
||||
%this.owner.getComponent( MountedCameraComponent ).rotationOffset.z += %zrot;
|
||||
//%this.owner.rotation.z += %zrot;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
function FPSControls_forwardKey(%val)
|
||||
{
|
||||
$mvForwardAction = %val;
|
||||
}
|
||||
|
||||
function FPSControls_backKey(%val)
|
||||
{
|
||||
$mvBackwardAction = %val;
|
||||
}
|
||||
|
||||
function FPSControls_leftKey(%val)
|
||||
{
|
||||
$mvLeftAction = %val;
|
||||
}
|
||||
|
||||
function FPSControls_rightKey(%val)
|
||||
{
|
||||
$mvRightAction = %val;
|
||||
}
|
||||
|
||||
function FPSControls_yawAxis(%val)
|
||||
{
|
||||
$mvYaw += getMouseAdjustAmount(%val);
|
||||
}
|
||||
|
||||
function FPSControls_pitchAxis(%val)
|
||||
{
|
||||
$mvPitch += getMouseAdjustAmount(%val);
|
||||
}
|
||||
|
||||
function FPSControls_jump(%val)
|
||||
{
|
||||
$mvTriggerCount2++;
|
||||
}
|
||||
|
||||
function FPSControls_flashLight(%val)
|
||||
{
|
||||
$mvTriggerCount3++;
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function SetInput(%client, %device, %key, %command, %bindMap, %behav)
|
||||
{
|
||||
commandToClient(%client, 'SetInput', %device, %key, %command, %bindMap, %behav);
|
||||
}
|
||||
|
||||
function RemoveInput(%client, %device, %key, %command, %bindMap)
|
||||
{
|
||||
commandToClient(%client, 'removeInput', %device, %key, %command, %bindMap);
|
||||
}
|
||||
|
||||
function clientCmdSetInput(%device, %key, %command, %bindMap, %behav)
|
||||
{
|
||||
//if we're requesting a custom bind map, set that up
|
||||
if(%bindMap $= "")
|
||||
%bindMap = moveMap;
|
||||
|
||||
if (!isObject(%bindMap)){
|
||||
new ActionMap(moveMap);
|
||||
moveMap.push();
|
||||
}
|
||||
|
||||
//get our local
|
||||
//%localID = ServerConnection.resolveGhostID(%behav);
|
||||
|
||||
//%tmpl = %localID.getTemplate();
|
||||
//%tmpl.insantiateNamespace(%tmpl.getName());
|
||||
|
||||
//first, check if we have an existing command
|
||||
%oldBind = %bindMap.getBinding(%command);
|
||||
if(%oldBind !$= "")
|
||||
%bindMap.unbind(getField(%oldBind, 0), getField(%oldBind, 1));
|
||||
|
||||
//now, set the requested bind
|
||||
%bindMap.bind(%device, %key, %command);
|
||||
}
|
||||
|
||||
function clientCmdRemoveSpecCtrlInput(%device, %key, %bindMap)
|
||||
{
|
||||
//if we're requesting a custom bind map, set that up
|
||||
if(%bindMap $= "")
|
||||
%bindMap = moveMap;
|
||||
|
||||
if (!isObject(%bindMap))
|
||||
return;
|
||||
|
||||
%bindMap.unbind(%device, %key);
|
||||
}
|
||||
|
||||
function clientCmdSetupClientBehavior(%bhvrGstID)
|
||||
{
|
||||
%localID = ServerConnection.resolveGhostID(%bhvrGstID);
|
||||
%tmpl = %localID.getTemplate();
|
||||
%tmpl.insantiateNamespace(%tmpl.getName());
|
||||
}
|
||||
|
||||
function getMouseAdjustAmount(%val)
|
||||
{
|
||||
// based on a default camera FOV of 90'
|
||||
return(%val * ($cameraFov / 90) * 0.01) * $pref::Input::LinkMouseSensitivity;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="MeshComponentAsset"
|
||||
componentClass="MeshComponent"
|
||||
friendlyName="mesh"
|
||||
componentType="Render"
|
||||
description="Enables an entity to render a shape." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="PlayerControllerComponentAsset"
|
||||
componentClass="PlayerControllerComponent"
|
||||
friendlyName="Player Controller"
|
||||
componentType="Game"
|
||||
description="Enables an entity to move like a player object." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="SoundComponentAsset"
|
||||
componentClass="SoundComponent"
|
||||
friendlyName="Sound(Component)"
|
||||
componentType="sound"
|
||||
description="Stores up to 4 sounds for playback." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="StateMachineComponentAsset"
|
||||
componentClass="StateMachineComponent"
|
||||
friendlyName="State Machine"
|
||||
componentType="Game"
|
||||
description="Enables a state machine on the entity." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ComponentAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="TriggerComponentAsset"
|
||||
componentClass="TriggerComponent"
|
||||
friendlyName="Trigger Component"
|
||||
componentType="Collision"
|
||||
description="Enables callback and event behaviors on collision with the entity." />
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<GameObjectAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="AIPlayerObject"
|
||||
gameObjectName="AIPlayerObject"
|
||||
scriptFile="AIPlayerObject.cs"
|
||||
TAMLFile="AIPlayerObject.taml"
|
||||
description="A basic AI Player Object example." />
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
function AIPlayerObject::onAdd(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::onRemove(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::moveVectorEvent(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::moveYawEvent(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::movePitchEvent(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::moveRollEvent(%this){}
|
||||
|
||||
function AIPlayerObject::moveTriggerEvent(%this, %triggerNum, %triggerValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::onCollisionEvent(%this, %colObject, %colNormal, %colPoint, %colMatID, %velocity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AIPlayerObject::processTick(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<AIPlayerObject
|
||||
scale="1 1 1"
|
||||
class="AIPlayerObject"
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
position="0 0 0"
|
||||
rotation="0 -0 -0"
|
||||
LocalPosition="0 0 0"
|
||||
LocalRotation="1 0 0 0"
|
||||
lifetimeMS="0"
|
||||
gameObject="Core_GameObjects:AIPlayerObject">
|
||||
</AIPlayerObject>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<GameObjectAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="PlayerObject"
|
||||
gameObjectName="PlayerObject"
|
||||
scriptFile="PlayerObject.cs"
|
||||
TAMLFile="PlayerObject.taml"
|
||||
description="A basic Player Object example." />
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
function PlayerObject::onAdd(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::onRemove(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::moveVectorEvent(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::moveYawEvent(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::movePitchEvent(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::moveRollEvent(%this){}
|
||||
|
||||
function PlayerObject::moveTriggerEvent(%this, %triggerNum, %triggerValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::onCollisionEvent(%this, %colObject, %colNormal, %colPoint, %colMatID, %velocity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function PlayerObject::processTick(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
<PlayerObject
|
||||
scale="1 1 1"
|
||||
class="PlayerObject"
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
position="0 0 0"
|
||||
rotation="0 -0 -0"
|
||||
LocalPosition="0 0 0"
|
||||
LocalRotation="1 0 0 0"
|
||||
lifetimeMS="0"
|
||||
gameObject="Core_GameObjects:PlayerObject">
|
||||
<MeshComponent
|
||||
componentType="Render"
|
||||
friendlyName="Mesh Component"
|
||||
description="Causes the object to render a non-animating 3d shape using the file provided."
|
||||
networked="true"
|
||||
enabled="true"
|
||||
internalName="MeshComponent" />
|
||||
<ShapeCollisionComponent
|
||||
componentType="Collision"
|
||||
friendlyName="Shape Collision"
|
||||
description="A stub component class that physics components should inherit from."
|
||||
networked="false"
|
||||
enabled="true"
|
||||
internalName="CollisionComponent"
|
||||
CollisionType="Collision Mesh"
|
||||
LineOfSightType="Collision Mesh"
|
||||
DecalType="Collision Mesh"
|
||||
CollisionMeshPrefix="Collision"
|
||||
BlockCollisions="true" />
|
||||
<AnimationComponent
|
||||
componentType="Render"
|
||||
friendlyName="Animation(Component)"
|
||||
description="Allows a rendered mesh to be animated"
|
||||
networked="true"
|
||||
enabled="true"
|
||||
internalName="AnimationComponent" />
|
||||
<PlayerControllerComponent
|
||||
componentType="Physics"
|
||||
friendlyName="Player Controller"
|
||||
description="A general-purpose physics player controller."
|
||||
networked="false"
|
||||
enabled="true"
|
||||
internalName="PhysicsComponent"
|
||||
inputVelocity="0 0 0"
|
||||
useDirectMoveInput="0 -3.37028e+15 0" />
|
||||
<StateMachineComponent
|
||||
componentType="Game"
|
||||
friendlyName="State Machine"
|
||||
description="A generic state machine."
|
||||
networked="false"
|
||||
enabled="true"
|
||||
internalName="StateMachineComponent" />
|
||||
<CameraComponent
|
||||
friendlyName="Camera(Component)"
|
||||
networked="true"
|
||||
enabled="true"
|
||||
internalName="CameraComponent"
|
||||
FOV="80"
|
||||
MinFOV="5"
|
||||
MaxFOV="175"
|
||||
ScreenAspect="1065353216 1065353216"
|
||||
positionOffset="0 0 0"
|
||||
rotationOffset="0 -0 -0"
|
||||
useParentTransform="true" />
|
||||
<CameraOrbiterComponent
|
||||
networked="false"
|
||||
enabled="true"
|
||||
internalName="CameraOrbiterComponent"
|
||||
orbitDistance="8"
|
||||
rotation="0 0 0"
|
||||
maxPitchAngle="70"
|
||||
minPitchAngle="-10" />
|
||||
<ControlObjectComponent
|
||||
componentType="Game"
|
||||
friendlyName="Control Object"
|
||||
description="Allows owner entity to be controlled by a client."
|
||||
networked="false"
|
||||
enabled="true"
|
||||
internalName="ControlObjectComponent"
|
||||
clientOwner="0" />
|
||||
<SoundComponent
|
||||
componentType="Sound"
|
||||
friendlyName="Sound(Component)"
|
||||
description="Stores up to 4 sounds for playback."
|
||||
networked="true"
|
||||
enabled="true"
|
||||
internalName="SoundComponent">
|
||||
<SoundComponent.MPreviewSounds>
|
||||
<MPreviewSound
|
||||
MPreviewSound="false" />
|
||||
<MPreviewSound
|
||||
MPreviewSound="false" />
|
||||
<MPreviewSound
|
||||
MPreviewSound="false" />
|
||||
<MPreviewSound
|
||||
MPreviewSound="false" />
|
||||
</SoundComponent.MPreviewSounds>
|
||||
<SoundComponent.Plays>
|
||||
<Play
|
||||
Play="false" />
|
||||
<Play
|
||||
Play="false" />
|
||||
<Play
|
||||
Play="false" />
|
||||
<Play
|
||||
Play="false" />
|
||||
</SoundComponent.Plays>
|
||||
</SoundComponent>
|
||||
<InteractComponent
|
||||
componentType="Game"
|
||||
friendlyName="Interact"
|
||||
description="Allows owner entity interact."
|
||||
networked="false"
|
||||
enabled="true"
|
||||
internalName="InteractComponent" />
|
||||
</PlayerObject>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<GameObjectAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="soundEmitterObject"
|
||||
gameObjectName="soundEmitterObject"
|
||||
TAMLFile="soundEmitterObject.taml"
|
||||
description="A basic sound emitter example." />
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<soundEmitterObject
|
||||
scale="1 1 1"
|
||||
class="SoundEmitterObject"
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
position="0 0 0"
|
||||
Rotation="0 -0 -0"
|
||||
LocalPosition="0 0 0"
|
||||
LocalRotation="1 0 0 0"/>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<GameObjectAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="StaticShapeObject"
|
||||
gameObjectName="StaticShapeObject"
|
||||
TAMLFile="staticShapeObject.taml"
|
||||
description="A basic static shape example." />
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<StaticShapeObject
|
||||
scale="1 1 1"
|
||||
class="StaticShapeObject"
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
position="0 0 0"
|
||||
Rotation="0 -0 -0"
|
||||
LocalPosition="0 0 0"
|
||||
LocalRotation="1 0 0 0"/>
|
||||
|
|
@ -111,7 +111,6 @@ uniform sampler2D deferredBuffer;
|
|||
uniform samplerCube shadowMap;
|
||||
#else
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
#endif
|
||||
|
||||
uniform sampler2D lightBuffer;
|
||||
|
|
@ -131,7 +130,6 @@ uniform vec4 lightParams;
|
|||
uniform float lightInvSqrRange;
|
||||
uniform float shadowSoftness;
|
||||
uniform mat3 worldToLightProj;
|
||||
uniform mat3 dynamicWorldToLightProj;
|
||||
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform mat4 cameraToWorld;
|
||||
|
|
@ -180,10 +178,7 @@ void main()
|
|||
|
||||
#else
|
||||
vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
vec2 dynShadowCoord = decodeShadowCoord( tMul( dynamicWorldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
float static_shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float dynamic_shadowed = softShadow_filter(dynamicShadowMap, ssPos.xy/ssPos.w, dynShadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ uniform sampler2D cookieMap;
|
|||
|
||||
uniform sampler2D deferredBuffer;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D matInfoBuffer;
|
||||
|
||||
|
|
@ -60,7 +59,6 @@ uniform vec4 lightMapParams;
|
|||
|
||||
uniform vec4 vsFarPlane;
|
||||
uniform mat4 worldToLightProj;
|
||||
uniform mat4 dynamicWorldToLightProj;
|
||||
uniform vec4 lightParams;
|
||||
uniform float shadowSoftness;
|
||||
uniform vec3 eyePosWorld;
|
||||
|
|
@ -101,21 +99,15 @@ void main()
|
|||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
// Get the shadow texture coordinate
|
||||
// Get the shadow texture coordinate
|
||||
vec4 pxlPosLightProj = tMul( worldToLightProj, vec4( surface.P, 1 ) );
|
||||
vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
vec4 dynPxlPosLightProj = tMul( dynamicWorldToLightProj, vec4( surface.P, 1 ) );
|
||||
vec2 dynShadowCoord = ( ( dynPxlPosLightProj.xy / dynPxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
|
||||
dynShadowCoord.y = 1.0f - dynShadowCoord.y;
|
||||
vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
//distance to light in shadow map space
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
float dynDistToLight = dynPxlPosLightProj.z / lightRange;
|
||||
float static_shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float dynamic_shadowed = softShadow_filter(dynamicShadowMap, ssPos.xy/ssPos.w, dynShadowCoord, shadowSoftness, dynDistToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
vec3 lightCol = lightColor.rgb;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ in vec3 vsEyeRay;
|
|||
|
||||
uniform sampler2D deferredBuffer;
|
||||
uniform sampler2D shadowMap;
|
||||
uniform sampler2D dynamicShadowMap;
|
||||
|
||||
uniform sampler2D colorBuffer;
|
||||
uniform sampler2D matInfoBuffer;
|
||||
|
|
@ -67,14 +66,6 @@ uniform vec4 scaleY;
|
|||
uniform vec4 offsetX;
|
||||
uniform vec4 offsetY;
|
||||
|
||||
//dynamic shadowMap
|
||||
uniform mat4 dynamicWorldToLightProj;
|
||||
uniform vec4 dynamicScaleX;
|
||||
uniform vec4 dynamicScaleY;
|
||||
uniform vec4 dynamicOffsetX;
|
||||
uniform vec4 dynamicOffsetY;
|
||||
uniform vec4 dynamicFarPlaneScalePSSM;
|
||||
|
||||
vec4 AL_VectorLightShadowCast( sampler2D _sourceShadowMap,
|
||||
vec2 _texCoord,
|
||||
mat4 _worldToLightProj,
|
||||
|
|
@ -216,23 +207,16 @@ void main()
|
|||
vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
|
||||
vec4 static_shadowed_colors = AL_VectorLightShadowCast( shadowMap, uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
|
||||
vec4 shadowed_colors = AL_VectorLightShadowCast( shadowMap, uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
|
||||
farPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
vec4 dynamic_shadowed_colors = AL_VectorLightShadowCast( dynamicShadowMap, uv0.xy, dynamicWorldToLightProj, surface.P, dynamicScaleX,
|
||||
dynamicScaleY, dynamicOffsetX, dynamicOffsetY, dynamicFarPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
float static_shadowed = static_shadowed_colors.a;
|
||||
float dynamic_shadowed = dynamic_shadowed_colors.a;
|
||||
float shadow = shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightingColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5;
|
||||
lightingColor = shadowed_colors.rgb;
|
||||
#endif
|
||||
|
||||
static_shadowed = lerp( static_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
dynamic_shadowed = lerp( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
float shadow = min(static_shadowed, dynamic_shadowed);
|
||||
shadow = lerp( shadow, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( fadeOutAmt > 1.0 )
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
|||
TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1);
|
||||
#else
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2);
|
||||
#endif
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5);
|
||||
|
|
@ -134,7 +133,6 @@ uniform float lightInvSqrRange;
|
|||
uniform float shadowSoftness;
|
||||
uniform float4x4 worldToCamera;
|
||||
uniform float3x3 worldToLightProj;
|
||||
uniform float3x3 dynamicWorldToLightProj;
|
||||
|
||||
uniform float3 eyePosWorld;
|
||||
uniform float4x4 cameraToWorld;
|
||||
|
|
@ -183,10 +181,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
|
||||
#else
|
||||
float2 shadowCoord = decodeShadowCoord( mul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
float2 dynShadowCoord = decodeShadowCoord( mul( dynamicWorldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
float static_shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float dynamic_shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), ssPos.xy, dynShadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
float shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ struct ConvexConnectP
|
|||
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2);
|
||||
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
|
|
@ -65,7 +64,6 @@ uniform float2 lightSpotParams;
|
|||
uniform float4 lightMapParams;
|
||||
uniform float4 vsFarPlane;
|
||||
uniform float4x4 worldToLightProj;
|
||||
uniform float4x4 dynamicWorldToLightProj;
|
||||
uniform float4 lightParams;
|
||||
|
||||
uniform float shadowSoftness;
|
||||
|
|
@ -112,16 +110,10 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
|
||||
float4 dynPxlPosLightProj = mul( dynamicWorldToLightProj, float4( surface.P, 1 ) );
|
||||
float2 dynShadowCoord = ( ( dynPxlPosLightProj.xy / dynPxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
|
||||
dynShadowCoord.y = 1.0f - dynShadowCoord.y;
|
||||
|
||||
//distance to light in shadow map space
|
||||
//distance to light in shadow map space
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
float dynDistToLight = dynPxlPosLightProj.z / lightRange;
|
||||
float static_shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float dynamic_shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), ssPos.xy, dynShadowCoord, shadowSoftness, dynDistToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
float shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
float3 lightCol = lightColor.rgb;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2);
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 5);
|
||||
TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 6);
|
||||
|
|
@ -64,13 +63,6 @@ uniform float4 scaleX;
|
|||
uniform float4 scaleY;
|
||||
uniform float4 offsetX;
|
||||
uniform float4 offsetY;
|
||||
// Dynamic Shadows
|
||||
uniform float4x4 dynamicWorldToLightProj;
|
||||
uniform float4 dynamicScaleX;
|
||||
uniform float4 dynamicScaleY;
|
||||
uniform float4 dynamicOffsetX;
|
||||
uniform float4 dynamicOffsetY;
|
||||
uniform float4 dynamicFarPlaneScalePSSM;
|
||||
|
||||
float4 AL_VectorLightShadowCast( TORQUE_SAMPLER2D(sourceShadowMap),
|
||||
float2 texCoord,
|
||||
|
|
@ -205,23 +197,16 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
|
||||
float4 static_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(shadowMap), IN.uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
|
||||
float4 shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(shadowMap), IN.uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
|
||||
farPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), IN.uv0.xy, dynamicWorldToLightProj, surface.P, dynamicScaleX,
|
||||
dynamicScaleY, dynamicOffsetX, dynamicOffsetY, dynamicFarPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
float static_shadowed = static_shadowed_colors.a;
|
||||
float dynamic_shadowed = dynamic_shadowed_colors.a;
|
||||
float shadow = shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightingColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5;
|
||||
lightingColor = shadowed_colors.rgb;
|
||||
#endif
|
||||
|
||||
static_shadowed = lerp( static_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
dynamic_shadowed = lerp( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
float shadow = min(static_shadowed, dynamic_shadowed);
|
||||
shadow = lerp( shadow, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( fadeOutAmt > 1.0 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue