Sfoglia il codice sorgente

Fixed some bugs, added cylinder body

Added cylinder rigid body shape, in PhysicsScene, EditorWindow, SceneLoader
Added a method to set the default values for atmospheric scattering data, in Containers
Added a way to apply a torque impulse for a rigid body, in RigidBodyComponent
Added callbacks for physics changes for lua scripts, in LuaScript
Fixed a bug of clipboard manipulation (copy/cut) freezing the engine for a short time, because SDL doesn't support multithreaded clipboards, in GUIHandler
Fixed a bug of ImGui sometimes having the right-mouse-button state stuck on activated after moving the camera in the editor with the mouse, in Window
Fixed a bug of scripts of the same name not being shown separately in shader assets window, in EditowWindow
Updated engine version to v0.2.6
Paul A 1 anno fa
parent
commit
09c1faaa0e

BIN
Praxis3D/Data/Models/Default/cube1x1.fbx


+ 171 - 0
Praxis3D/Data/Scripts/Camera_free_auto_rotation.lua

@@ -0,0 +1,171 @@
+
+function init()
+	-- Create needed variables
+	create(Types.GameplayVariables, 'gameplayVariables');
+	create(Types.InputVariables, 'inputVariables');
+	create(Types.SpatialDataManager, 'spatialData');
+	
+	-- Create key commands, used to track pressed keys
+	create(Types.KeyCommand, 'forwardKey')
+	create(Types.KeyCommand, 'backwardKey')
+	create(Types.KeyCommand, 'leftKey')
+	create(Types.KeyCommand, 'rightKey')
+	create(Types.KeyCommand, 'upKey')
+	create(Types.KeyCommand, 'downKey')
+	create(Types.KeyCommand, 'sprintKey')	
+	create(Types.KeyCommand, 'ctrlKey')
+	create(Types.KeyCommand, 'mouseLeftKey')
+	create(Types.KeyCommand, 'mouseRightKey')
+	create(Types.KeyCommand, 'autoRotatekey')
+	create(Types.KeyCommand, 'autoMovekey')
+	
+	-- Bind keys to their corresponding buttons on the keyboard
+	forwardKey:bind(inputVariables.forward_key)
+	backwardKey:bind(inputVariables.backward_key)
+	leftKey:bind(inputVariables.left_strafe_key)
+	rightKey:bind(inputVariables.right_strafe_key)
+	upKey:bind(inputVariables.up_key)
+	downKey:bind(inputVariables.down_key)
+	sprintKey:bind(inputVariables.sprint_key)
+	ctrlKey:bindByName('Key_leftctrl')
+	mouseLeftKey:bindByName('Mouse_left')
+	mouseRightKey:bindByName('Mouse_right')
+	autoMovekey:bindByName('Key_F3')
+	autoRotatekey:bindByName('Key_F4')
+	
+	-- Get the camera movement speed
+	if cameraSpeed then 
+		movementSpeedF = cameraSpeed
+	else
+		movementSpeedF = gameplayVariables.camera_freelook_speed
+	end
+	
+	-- Get the camera movement speed multiplier
+	if cameraSpeedMultiplier then 
+		movementSpeedMultF = cameraSpeedMultiplier
+	else
+		movementSpeedMultF = 1.0
+	end
+	
+	if not cameraAutoRotationSpeed then
+		cameraAutoRotationSpeed = 10.0
+	end
+	
+	movementKeysActive = true
+	autoRotate = false
+	autoMove = false
+	
+	ErrHandlerLoc.logErrorCode(ErrorCode.Initialize_success, getLuaFilename())
+end
+
+function update(p_deltaTime)
+	if autoRotatekey:isActivated() then
+		autoRotate = not autoRotate
+		autoRotatekey:deactivate()
+		if not autoRotate then
+			rightKey:deactivate()
+		end
+	end
+	
+	if autoMovekey:isActivated() then
+		autoMove = not autoMove
+	end
+	
+	-- Get current mouse data
+	mouseData = getMouseInfo()
+	
+	-- Get current spatial data and its inverse
+	localTransformMat4 = spatialData:getLocalTransform()
+	localTransformInverseMat4 = localTransformMat4:inverse()
+	
+	-- Extract position from spatial data
+	positionVec3 = localTransformMat4:getPosVec3()
+	
+	-- Calculate new view angles based on mouse movement
+	horizontalAngleF = mouseData.m_movementX * inputVariables.mouse_jaw * inputVariables.mouse_sensitivity
+	verticalAngleF = mouseData.m_movementY * inputVariables.mouse_pitch * inputVariables.mouse_sensitivity
+	
+	-- Rotate the camera matrix by the view angles
+	-- Perform rotations only if the mouse is captured inside the game window
+	if getMouseCapture() or mouseRightKey:isActivated() then
+		-- Rotate camera up/down based on the X direction (left/right) of the view matrix (camera's inverse matrix)
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(verticalAngleF), localTransformInverseMat4:getRotXVec3())
+		-- Rotate camera left/right on a fixed Y direction (up/down) to not introduce any roll
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(horizontalAngleF), Vec3.new(0.0, 1.0, 0.0))
+	end
+	
+	-- Perform only when in Editor mode
+	if (getEngineState() == EngineStateType.Editor) then
+	
+		-- Stop capturing movement keys when CTRL is pressed (for example, when saving a scene with CTRL+S shortcut)
+		if ctrlKey:isActivated() then
+			movementKeysActive = false
+		else
+			movementKeysActive = true
+		end
+		
+		-- Capture mouse when right mouse button is pressed only, since uncaptured mouse is required to interact with the Editor GUI
+		if mouseRightKey:isActivated() then
+			setMouseCapture(true)
+		else
+			setMouseCapture(false)
+		end
+		
+	end
+		
+	if autoRotate then
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(-p_deltaTime * cameraAutoRotationSpeed), Vec3.new(0.0, 1.0, 0.0))
+		rightKey:activate()
+		movementKeysActive = true
+	end
+	
+	-- Get the view direction that is facing forward
+	forwardDirectionVec3 = localTransformInverseMat4:getRotZVec3()
+	forwardDirectionVec3 = forwardDirectionVec3:normalize()
+	
+	-- Get the view direction that is facing to the right
+	rightDirectionVec3 = localTransformInverseMat4:getRotXVec3()
+	rightDirectionVec3 = rightDirectionVec3:normalize()
+	
+	-- Get the view direction that is facing up
+	upDirectionVec3 = localTransformInverseMat4:getRotYVec3()
+	upDirectionVec3 = upDirectionVec3:normalize()
+	
+	-- Increase movement speed if the sprint key is pressed
+	if sprintKey:isActivated() then
+		finalMovementSpeedF = movementSpeedF * movementSpeedMultF
+	else
+		finalMovementSpeedF = movementSpeedF
+	end
+	
+	-- Adjust camera position based on key presses and view direction
+	-- Forwards / backwards - Z direction
+	if (movementKeysActive and forwardKey:isActivated()) or autoMove then
+		positionVec3 = positionVec3 - forwardDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	if movementKeysActive and backwardKey:isActivated() then
+		positionVec3 = positionVec3 + forwardDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end
+	
+	-- Left / right - X direction
+	if movementKeysActive and rightKey:isActivated() then
+		positionVec3 = positionVec3 + rightDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	if movementKeysActive and leftKey:isActivated() then
+		positionVec3 = positionVec3 - rightDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	
+	-- Up / down - Y direction
+	if movementKeysActive and upKey:isActivated() then
+		positionVec3 = positionVec3 + upDirectionVec3:mulF(finalMovementSpeedF * 0.5 * p_deltaTime)
+	end	
+	if movementKeysActive and downKey:isActivated() then
+		positionVec3 = positionVec3 - upDirectionVec3:mulF(finalMovementSpeedF * 0.5 * p_deltaTime)
+	end
+		
+	-- Set the new position of the camera, and keep the W variable the same
+	localTransformMat4:setPosVec4(Vec4.new(positionVec3, localTransformMat4:getPosVec4().w))
+		
+	-- Update the camera with the new matrix
+	spatialData:setLocalTransform(localTransformMat4)
+end

+ 168 - 0
Praxis3D/Data/Scripts/Camera_free_auto_rotation_acceleration.lua

@@ -0,0 +1,168 @@
+
+function init()
+	-- Create needed variables
+	create(Types.GameplayVariables, 'gameplayVariables');
+	create(Types.InputVariables, 'inputVariables');
+	create(Types.SpatialDataManager, 'spatialData');
+	
+	-- Create key commands, used to track pressed keys
+	create(Types.KeyCommand, 'forwardKey')
+	create(Types.KeyCommand, 'backwardKey')
+	create(Types.KeyCommand, 'leftKey')
+	create(Types.KeyCommand, 'rightKey')
+	create(Types.KeyCommand, 'upKey')
+	create(Types.KeyCommand, 'downKey')
+	create(Types.KeyCommand, 'sprintKey')	
+	create(Types.KeyCommand, 'ctrlKey')
+	create(Types.KeyCommand, 'mouseLeftKey')
+	create(Types.KeyCommand, 'mouseRightKey')
+	create(Types.KeyCommand, 'autoRotatekey')
+	
+	-- Bind keys to their corresponding buttons on the keyboard
+	forwardKey:bind(inputVariables.forward_key)
+	backwardKey:bind(inputVariables.backward_key)
+	leftKey:bind(inputVariables.left_strafe_key)
+	rightKey:bind(inputVariables.right_strafe_key)
+	upKey:bind(inputVariables.up_key)
+	downKey:bind(inputVariables.down_key)
+	sprintKey:bind(inputVariables.sprint_key)
+	ctrlKey:bindByName('Key_leftctrl')
+	mouseLeftKey:bindByName('Mouse_left')
+	mouseRightKey:bindByName('Mouse_right')
+	autoRotatekey:bindByName('Key_F4')
+	
+	-- Get the camera movement speed
+	if cameraSpeed then 
+		movementSpeedF = cameraSpeed
+	else
+		movementSpeedF = gameplayVariables.camera_freelook_speed
+	end
+	
+	-- Get the camera movement speed multiplier
+	if cameraSpeedMultiplier then 
+		movementSpeedMultF = cameraSpeedMultiplier
+	else
+		movementSpeedMultF = 1.0
+	end
+	
+	finalMovementSpeedF = movementSpeedF
+		
+	ErrHandlerLoc.logErrorCode(ErrorCode.Initialize_success, getLuaFilename())
+	
+	movementKeysActive = true
+	autoRotate = false
+end
+
+function update(p_deltaTime)
+	if autoRotatekey:isActivated() then
+		autoRotate = not autoRotate
+		autoRotatekey:deactivate()
+		if not autoRotate then
+			rightKey:deactivate()
+		end
+	end
+
+	-- Get current mouse data
+	mouseData = getMouseInfo()
+	
+	-- Get current spatial data and its inverse
+	localTransformMat4 = spatialData:getLocalTransform()
+	localTransformInverseMat4 = localTransformMat4:inverse()
+	
+	-- Extract position from spatial data
+	positionVec3 = localTransformMat4:getPosVec3()
+	
+	-- Calculate new view angles based on mouse movement
+	horizontalAngleF = mouseData.m_movementX * inputVariables.mouse_jaw * inputVariables.mouse_sensitivity
+	verticalAngleF = mouseData.m_movementY * inputVariables.mouse_pitch * inputVariables.mouse_sensitivity
+	
+	-- Rotate the camera matrix by the view angles
+	-- Perform rotations only if the mouse is captured inside the game window
+	if getMouseCapture() or mouseRightKey:isActivated() then
+		-- Rotate camera up/down based on the X direction (left/right) of the view matrix (camera's inverse matrix)
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(verticalAngleF), localTransformInverseMat4:getRotXVec3())
+		-- Rotate camera left/right on a fixed Y direction (up/down) to not introduce any roll
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(horizontalAngleF), Vec3.new(0.0, 1.0, 0.0))
+	end
+	
+	-- Perform only when in Editor mode
+	if (getEngineState() == EngineStateType.Editor) then
+	
+		-- Stop capturing movement keys when CTRL is pressed (for example, when saving a scene with CTRL+S shortcut)
+		if ctrlKey:isActivated() then
+			movementKeysActive = false
+		else
+			movementKeysActive = true
+		end
+		
+		-- Capture mouse when right mouse button is pressed only, since uncaptured mouse is required to interact with the Editor GUI
+		if mouseRightKey:isActivated() then
+			setMouseCapture(true)
+		else
+			setMouseCapture(false)
+		end
+		
+	end
+		
+	if autoRotate then
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(-p_deltaTime * cameraAutoRotationSpeed), Vec3.new(0.0, 1.0, 0.0))
+		rightKey:activate()
+		movementKeysActive = true
+	end
+	
+	-- Get the view direction that is facing forward
+	forwardDirectionVec3 = localTransformInverseMat4:getRotZVec3()
+	forwardDirectionVec3 = forwardDirectionVec3:normalize()
+	
+	-- Get the view direction that is facing to the right
+	rightDirectionVec3 = localTransformInverseMat4:getRotXVec3()
+	rightDirectionVec3 = rightDirectionVec3:normalize()
+	
+	-- Get the view direction that is facing up
+	upDirectionVec3 = localTransformInverseMat4:getRotYVec3()
+	upDirectionVec3 = upDirectionVec3:normalize()
+	
+	-- Increase movement speed if the sprint key is pressed
+	if sprintKey:isActivated() then
+		finalMovementSpeedF = finalMovementSpeedF * movementSpeedMultF
+	else
+		if finalMovementSpeedF > movementSpeedF then
+			finalMovementSpeedF = finalMovementSpeedF / movementSpeedMultF
+		end
+		
+		if finalMovementSpeedF < movementSpeedF then
+			finalMovementSpeedF = movementSpeedF
+		end
+	end
+	
+	-- Adjust camera position based on key presses and view direction
+	-- Forwards / backwards - Z direction
+	if movementKeysActive and forwardKey:isActivated() then
+		positionVec3 = positionVec3 - forwardDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	if movementKeysActive and backwardKey:isActivated() then
+		positionVec3 = positionVec3 + forwardDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end
+	
+	-- Left / right - X direction
+	if movementKeysActive and rightKey:isActivated() then
+		positionVec3 = positionVec3 + rightDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	if movementKeysActive and leftKey:isActivated() then
+		positionVec3 = positionVec3 - rightDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	
+	-- Up / down - Y direction
+	if movementKeysActive and upKey:isActivated() then
+		positionVec3 = positionVec3 + upDirectionVec3:mulF(finalMovementSpeedF * 0.5 * p_deltaTime)
+	end	
+	if movementKeysActive and downKey:isActivated() then
+		positionVec3 = positionVec3 - upDirectionVec3:mulF(finalMovementSpeedF * 0.5 * p_deltaTime)
+	end
+		
+	-- Set the new position of the camera, and keep the W variable the same
+	localTransformMat4:setPosVec4(Vec4.new(positionVec3, localTransformMat4:getPosVec4().w))
+		
+	-- Update the camera with the new matrix
+	spatialData:setLocalTransform(localTransformMat4)
+end

+ 214 - 0
Praxis3D/Data/Scripts/Camera_free_auto_rotation_acceleration_auto.lua

@@ -0,0 +1,214 @@
+
+function init()
+	-- Create needed variables
+	create(Types.GameplayVariables, 'gameplayVariables');
+	create(Types.InputVariables, 'inputVariables');
+	create(Types.SpatialDataManager, 'spatialData');
+	
+	-- Create key commands, used to track pressed keys
+	create(Types.KeyCommand, 'forwardKey')
+	create(Types.KeyCommand, 'backwardKey')
+	create(Types.KeyCommand, 'leftKey')
+	create(Types.KeyCommand, 'rightKey')
+	create(Types.KeyCommand, 'upKey')
+	create(Types.KeyCommand, 'downKey')
+	create(Types.KeyCommand, 'sprintKey')	
+	create(Types.KeyCommand, 'ctrlKey')
+	create(Types.KeyCommand, 'mouseLeftKey')
+	create(Types.KeyCommand, 'mouseRightKey')
+	create(Types.KeyCommand, 'autoRotatekey')
+	
+	-- Bind keys to their corresponding buttons on the keyboard
+	forwardKey:bind(inputVariables.forward_key)
+	backwardKey:bind(inputVariables.backward_key)
+	leftKey:bind(inputVariables.left_strafe_key)
+	rightKey:bind(inputVariables.right_strafe_key)
+	upKey:bind(inputVariables.up_key)
+	downKey:bind(inputVariables.down_key)
+	sprintKey:bind(inputVariables.sprint_key)
+	ctrlKey:bindByName('Key_leftctrl')
+	mouseLeftKey:bindByName('Mouse_left')
+	mouseRightKey:bindByName('Mouse_right')
+	autoRotatekey:bindByName('Key_F4')
+	
+	-- Get the camera movement speed
+	if cameraSpeed then 
+		movementSpeedF = cameraSpeed
+	else
+		movementSpeedF = gameplayVariables.camera_freelook_speed
+	end
+	
+	-- Get the camera movement speed multiplier
+	if cameraSpeedMultiplier then 
+		movementSpeedMultF = cameraSpeedMultiplier
+	else
+		movementSpeedMultF = 1.0
+	end
+	
+	finalMovementSpeedF = movementSpeedF
+	
+	movementKeysActive = true
+	autoRotate = false
+	
+	timePassed = 0.0
+	timeToDelayStart = 5.0
+	timeToStopSprint = timeToDelayStart + 4.4
+	timeToStopMovement = timeToDelayStart + 30.0
+	sprintExpired = false
+	movementExpired = false
+	
+	ErrHandlerLoc.logErrorCode(ErrorCode.Initialize_success, getLuaFilename())
+end
+
+function update(p_deltaTime)
+	
+	if getPhysicsSimulationRunning() then
+		timePassed = timePassed + p_deltaTime
+		
+		if timeToDelayStart < timePassed then
+			if timeToStopSprint > timePassed then
+				sprintKey:activate()
+			else
+				if not sprintExpired then
+					sprintKey:deactivate()
+					sprintExpired = true
+				end
+			end
+			
+			if timeToStopMovement > timePassed then
+				backwardKey:activate()
+			else
+				if not movementExpired then
+					backwardKey:deactivate()
+					movementExpired = true
+				end
+			end
+		end
+	end
+	
+	if autoRotatekey:isActivated() then
+		autoRotate = not autoRotate
+		autoRotatekey:deactivate()
+		if not autoRotate then
+			rightKey:deactivate()
+		end
+	end
+		
+	if sprintKey:isActivated() then
+		sprintKeyActivated = true
+	end
+	
+	if backwardKey:isActivated() then
+		backwardsKeyActivated = true
+	end
+	
+	-- Get current mouse data
+	mouseData = getMouseInfo()
+	
+	-- Get current spatial data and its inverse
+	localTransformMat4 = spatialData:getLocalTransform()
+	localTransformInverseMat4 = localTransformMat4:inverse()
+	
+	-- Extract position from spatial data
+	positionVec3 = localTransformMat4:getPosVec3()
+	
+	-- Calculate new view angles based on mouse movement
+	horizontalAngleF = mouseData.m_movementX * inputVariables.mouse_jaw * inputVariables.mouse_sensitivity
+	verticalAngleF = mouseData.m_movementY * inputVariables.mouse_pitch * inputVariables.mouse_sensitivity
+	
+	-- Rotate the camera matrix by the view angles
+	-- Perform rotations only if the mouse is captured inside the game window
+	if getMouseCapture() or mouseRightKey:isActivated() then
+		-- Rotate camera up/down based on the X direction (left/right) of the view matrix (camera's inverse matrix)
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(verticalAngleF), localTransformInverseMat4:getRotXVec3())
+		-- Rotate camera left/right on a fixed Y direction (up/down) to not introduce any roll
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(horizontalAngleF), Vec3.new(0.0, 1.0, 0.0))
+	end
+	
+	-- Perform only when in Editor mode
+	if (getEngineState() == EngineStateType.Editor) then
+	
+		-- Stop capturing movement keys when CTRL is pressed (for example, when saving a scene with CTRL+S shortcut)
+		if ctrlKey:isActivated() then
+			movementKeysActive = false
+		else
+			movementKeysActive = true
+		end
+		
+		-- Capture mouse when right mouse button is pressed only, since uncaptured mouse is required to interact with the Editor GUI
+		if mouseRightKey:isActivated() then
+			setMouseCapture(true)
+		else
+			setMouseCapture(false)
+		end
+		
+	end
+		
+	if autoRotate then
+		localTransformMat4 = localTransformMat4:rotate(toRadianF(-p_deltaTime * cameraAutoRotationSpeed), Vec3.new(0.0, 1.0, 0.0))
+		rightKey:activate()
+		movementKeysActive = true
+	end
+	
+	-- Get the view direction that is facing forward
+	forwardDirectionVec3 = localTransformInverseMat4:getRotZVec3()
+	forwardDirectionVec3 = forwardDirectionVec3:normalize()
+	
+	-- Get the view direction that is facing to the right
+	rightDirectionVec3 = localTransformInverseMat4:getRotXVec3()
+	rightDirectionVec3 = rightDirectionVec3:normalize()
+	
+	-- Get the view direction that is facing up
+	upDirectionVec3 = localTransformInverseMat4:getRotYVec3()
+	upDirectionVec3 = upDirectionVec3:normalize()
+	
+	-- Increase movement speed if the sprint key is pressed
+	if sprintKey:isActivated() then
+		finalMovementSpeedF = finalMovementSpeedF * movementSpeedMultF
+	else
+		if finalMovementSpeedF > movementSpeedF then
+			finalMovementSpeedF = finalMovementSpeedF / movementSpeedMultF
+		end
+		
+		if finalMovementSpeedF < movementSpeedF then
+			finalMovementSpeedF = movementSpeedF
+		end
+		
+		if sprintExpired then
+			if finalMovementSpeedF < movementSpeedF * 100000.0 then
+				finalMovementSpeedF = movementSpeedF * 100000.0
+			end
+		end
+	end
+	
+	-- Adjust camera position based on key presses and view direction
+	-- Forwards / backwards - Z direction
+	if movementKeysActive and forwardKey:isActivated() then
+		positionVec3 = positionVec3 - forwardDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	if movementKeysActive and backwardKey:isActivated() then
+		positionVec3 = positionVec3 + forwardDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end
+	
+	-- Left / right - X direction
+	if movementKeysActive and rightKey:isActivated() then
+		positionVec3 = positionVec3 + rightDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	if movementKeysActive and leftKey:isActivated() then
+		positionVec3 = positionVec3 - rightDirectionVec3:mulF(finalMovementSpeedF * p_deltaTime)
+	end	
+	
+	-- Up / down - Y direction
+	if movementKeysActive and upKey:isActivated() then
+		positionVec3 = positionVec3 + upDirectionVec3:mulF(finalMovementSpeedF * 0.5 * p_deltaTime)
+	end	
+	if movementKeysActive and downKey:isActivated() then
+		positionVec3 = positionVec3 - upDirectionVec3:mulF(finalMovementSpeedF * 0.5 * p_deltaTime)
+	end
+		
+	-- Set the new position of the camera, and keep the W variable the same
+	localTransformMat4:setPosVec4(Vec4.new(positionVec3, localTransformMat4:getPosVec4().w))
+		
+	-- Update the camera with the new matrix
+	spatialData:setLocalTransform(localTransformMat4)
+end

+ 9 - 1
Praxis3D/Data/Scripts/Sun_move.lua

@@ -5,7 +5,13 @@ function init ()
 	create(Types.SpatialDataManager, 'spatialData');
 	create(Types.SpatialDataManager, 'spatialData');
 		
 		
 	enabled = false
 	enabled = false
-	moveSpeed = 2.0
+	--moveSpeed = 2.0
+	
+	if sunMoveSpeed then
+		moveSpeed = sunMoveSpeed
+	else
+		moveSpeed = 5.0
+	end
 	
 	
 	create(Types.KeyCommand, 'forwardKey')
 	create(Types.KeyCommand, 'forwardKey')
 	create(Types.KeyCommand, 'backwardKey')
 	create(Types.KeyCommand, 'backwardKey')
@@ -24,11 +30,13 @@ function update (p_deltaTime)
 	
 	
 	if forwardKey:isActivated() then
 	if forwardKey:isActivated() then
 		eulerAngle.x = eulerAngle.x + (moveSpeed * p_deltaTime)
 		eulerAngle.x = eulerAngle.x + (moveSpeed * p_deltaTime)
+		--eulerAngle.y = eulerAngle.y + (moveSpeed * p_deltaTime)
 		angleChanged = true
 		angleChanged = true
 	end	
 	end	
 	
 	
 	if backwardKey:isActivated() then
 	if backwardKey:isActivated() then
 		eulerAngle.x = eulerAngle.x - (moveSpeed * p_deltaTime)
 		eulerAngle.x = eulerAngle.x - (moveSpeed * p_deltaTime)
+		--eulerAngle.y = eulerAngle.y - (moveSpeed * p_deltaTime)
 		angleChanged = true
 		angleChanged = true
 	end	
 	end	
 	
 	

+ 109 - 0
Praxis3D/Data/Scripts/Sun_move_auto.lua

@@ -0,0 +1,109 @@
+
+function init ()
+	-- Create needed variables
+	create(Types.InputVariables, 'inputVariables');
+	create(Types.SpatialDataManager, 'spatialData');
+		
+	enabled = false
+	--moveSpeed = 2.0
+	
+	if sunMoveSpeed then
+		moveSpeed = sunMoveSpeed
+	else
+		moveSpeed = 10.0
+	end
+	
+	create(Types.KeyCommand, 'forwardKey')
+	create(Types.KeyCommand, 'backwardKey')
+	
+	forwardKey:bind(inputVariables.debug_1_key)
+	backwardKey:bind(inputVariables.debug_2_key)
+	
+	timePassed = 0.0
+	timeToDelayStart = 10.0
+	timeToStopSprint = timeToDelayStart + 4.0
+	timeToStopFirstMovement = timeToDelayStart + 13.0
+	timeToStopMovement = timeToDelayStart + 40.0
+	accelerationModifier = 0.001
+	maxSpeed = 12.0
+	minSpeed = 4.0
+	firstMovementExpired = false
+	movementExpired = false
+	
+	ErrHandlerLoc.logErrorCode(ErrorCode.Initialize_success, getLuaFilename())
+end
+	
+function update (p_deltaTime)
+	if getPhysicsSimulationRunning() then
+		timePassed = timePassed + p_deltaTime
+		
+		if timeToDelayStart < timePassed then
+			if timeToStopSprint > timePassed then
+				moveSpeed = moveSpeed * (p_deltaTime * accelerationModifier)
+			else
+				moveSpeed = moveSpeed / (p_deltaTime * accelerationModifier)
+			end
+			
+			if timeToStopMovement > timePassed then
+				backwardKey:activate()
+			else
+				if not movementExpired then
+					backwardKey:deactivate()
+					movementExpired = true
+				end
+			end
+			
+			if timeToStopFirstMovement < timePassed then
+				firstMovementExpired = true
+			end
+		end
+		
+	end
+	
+	if moveSpeed > maxSpeed then
+		moveSpeed = maxSpeed
+	end
+	
+	if moveSpeed < minSpeed then
+		moveSpeed = minSpeed
+	end
+	
+	angleChanged = false
+	
+	-- Get current spatial data and its inverse
+	localTransformMat4 = spatialData:getLocalTransform()
+	localTransformInverseMat4 = localTransformMat4:inverse()
+	
+	spatialData:calculateLocalRotationEuler()
+	eulerAngle = spatialData:getLocalSpaceData().m_spatialData.m_rotationEuler
+	
+	if forwardKey:isActivated() then
+		eulerAngle.x = eulerAngle.x + (moveSpeed * p_deltaTime)
+		eulerAngle.y = eulerAngle.y + (moveSpeed * p_deltaTime)
+		angleChanged = true
+	end	
+	
+	if backwardKey:isActivated() then
+		-- Rotate camera left/right on a fixed Y direction (up/down) to not introduce any roll
+		localTransformMat4 = localTransformMat4:rotate(-toRadianF(moveSpeed * p_deltaTime), Vec3.new(0.5, 0.5, 0.0))
+		
+		--eulerAngle.x = eulerAngle.x - (moveSpeed * p_deltaTime)
+		--if not firstMovementExpired then
+		--	eulerAngle.y = eulerAngle.y - (moveSpeed * p_deltaTime)
+		--end
+		angleChanged = true
+	end	
+	
+	if angleChanged then
+		spatialData:setLocalRotationEuler(eulerAngle)
+		--spatialData:update()
+		--spatialData:calculateLocalRotationQuaternion()
+	end
+	
+	--print(eulerAngle.x)
+	
+	--postChanges(Changes.GUI.Sequence)
+	
+	-- Update the camera with the new matrix
+	spatialData:setLocalTransform(localTransformMat4)
+end

+ 4 - 4
Praxis3D/Data/Shaders/lightPass.frag

@@ -8,17 +8,17 @@
 */
 */
 #version 430 core
 #version 430 core
 
 
-#define SHADOW_MAPPING 0
+#define SHADOW_MAPPING 1
 
 
 #define AVG_INTENDED_BRIGHTNESS 0.5
 #define AVG_INTENDED_BRIGHTNESS 0.5
 #define MIN_INTENDED_BRIGHTNESS 0.001
 #define MIN_INTENDED_BRIGHTNESS 0.001
 #define MAX_INTENDED_BRIGHTNESS 100.0
 #define MAX_INTENDED_BRIGHTNESS 100.0
 
 
-#define MAX_NUM_POINT_LIGHTS 20
-#define MAX_NUM_SPOT_LIGHTS 10
+#define MAX_NUM_POINT_LIGHTS 450
+#define MAX_NUM_SPOT_LIGHTS 50
 #define PI 3.1415926535
 #define PI 3.1415926535
 
 
-#define NUM_OF_CASCADES 1
+#define NUM_OF_CASCADES 7
 #define NUM_OF_PCF_SAMPLES 16
 #define NUM_OF_PCF_SAMPLES 16
 
 
 const float g_pcfSampleWeight = 1.0 / NUM_OF_PCF_SAMPLES;
 const float g_pcfSampleWeight = 1.0 / NUM_OF_PCF_SAMPLES;

+ 1 - 1
Praxis3D/Praxis3D.vcxproj.filters

@@ -466,7 +466,7 @@
       <Filter>GUI\Objects\Source Files</Filter>
       <Filter>GUI\Objects\Source Files</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\GUISystem.cpp">
     <ClCompile Include="Source\GUISystem.cpp">
-      <Filter>Source Files</Filter>
+      <Filter>GUI\Source Files</Filter>
     </ClCompile>
     </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>

+ 11 - 5
Praxis3D/Source/Config.h

@@ -319,8 +319,14 @@ namespace Systems
 			static constexpr BitMask Kinematic				= Changes::Type::Physics + Changes::Common::Shared8;
 			static constexpr BitMask Kinematic				= Changes::Type::Physics + Changes::Common::Shared8;
 			static constexpr BitMask Gravity				= Changes::Type::Physics + Changes::Common::Shared9;
 			static constexpr BitMask Gravity				= Changes::Type::Physics + Changes::Common::Shared9;
 
 
-			static constexpr BitMask All					= CollisionShapeType | CollisionShapeSize | Friction | RollingFriction | 
+			static constexpr BitMask Impulse				= Changes::Type::Physics + Changes::Common::Shared10;
+			static constexpr BitMask Torque					= Changes::Type::Physics + Changes::Common::Shared11;
+
+			static constexpr BitMask AllDynamic				= Impulse | Torque;
+			static constexpr BitMask AllStatic				= CollisionShapeType | CollisionShapeSize | Friction | RollingFriction |
 																SpinningFriction | Mass | Restitution | Kinematic | Gravity;
 																SpinningFriction | Mass | Restitution | Kinematic | Gravity;
+
+			static constexpr BitMask All					= AllDynamic | AllStatic;
 		}
 		}
 		namespace Script
 		namespace Script
 		{
 		{
@@ -976,7 +982,7 @@ public:
 			render_to_texture_resolution_y = 900;
 			render_to_texture_resolution_y = 900;
 			tonemap_method = 6;
 			tonemap_method = 6;
 			alpha_threshold = 0.0f;
 			alpha_threshold = 0.0f;
-			ambient_intensity_directional = 0.3f;
+			ambient_intensity_directional = 0.1f;
 			ambient_intensity_point = 0.1f;
 			ambient_intensity_point = 0.1f;
 			ambient_intensity_spot = 0.1f;
 			ambient_intensity_spot = 0.1f;
 			ao_hbao_bias = 0.1f;
 			ao_hbao_bias = 0.1f;
@@ -1450,9 +1456,9 @@ public:
 			ssao_pass_frag_shader = "ambientOcclusionPassSSAO.frag";
 			ssao_pass_frag_shader = "ambientOcclusionPassSSAO.frag";
 			ssao_pass_vert_shader = "ambientOcclusionPassSSAO.vert";
 			ssao_pass_vert_shader = "ambientOcclusionPassSSAO.vert";
 			texture_repetition_noise_texture = "gray_noise_medium.png";
 			texture_repetition_noise_texture = "gray_noise_medium.png";
-			csm_bias_scale = 0.0004f;
+			csm_bias_scale = 0.00015f;
 			csm_max_shadow_bias = 0.0005f;
 			csm_max_shadow_bias = 0.0005f;
-			csm_penumbra_size = 1.42f;
+			csm_penumbra_size = 0.720f;
 			csm_penumbra_size_scale_min = 1.0f;
 			csm_penumbra_size_scale_min = 1.0f;
 			csm_penumbra_size_scale_max = 2000.0f;
 			csm_penumbra_size_scale_max = 2000.0f;
 			current_viewport_position_x = 0.0f;
 			current_viewport_position_x = 0.0f;
@@ -1469,7 +1475,7 @@ public:
 			parallax_mapping_min_steps = 8.0f;
 			parallax_mapping_min_steps = 8.0f;
 			parallax_mapping_max_steps = 32.0f;
 			parallax_mapping_max_steps = 32.0f;
 			csm_num_of_pcf_samples = 16;
 			csm_num_of_pcf_samples = 16;
-			csm_resolution = 2048;
+			csm_resolution = 4096;
 			current_viewport_size_x = 0;
 			current_viewport_size_x = 0;
 			current_viewport_size_y = 0;
 			current_viewport_size_y = 0;
 			depth_test_func = GL_LESS;
 			depth_test_func = GL_LESS;

+ 24 - 1
Praxis3D/Source/Containers.h

@@ -305,7 +305,8 @@ struct AtmosphericScatteringData
 		m_planetCenterPosition = glm::vec3(0.0f, -6360000.0f, 0.0f);
 		m_planetCenterPosition = glm::vec3(0.0f, -6360000.0f, 0.0f);
 
 
 		m_sunIrradiance = glm::vec3(1.474000f, 1.850400f, 1.911980f);
 		m_sunIrradiance = glm::vec3(1.474000f, 1.850400f, 1.911980f);
-		m_sunSize = 0.00935f;
+		m_sunSize = 0.02935f;
+		//m_sunSize = 0.00935f; old value
 	}
 	}
 
 
 	// Atmosphere
 	// Atmosphere
@@ -488,6 +489,28 @@ struct ShadowMappingData
 		m_zClipping = false;
 		m_zClipping = false;
 	}
 	}
 
 
+	void setDefaultValues()
+	{
+		m_penumbraScaleRange = glm::vec2(Config::rendererVar().csm_penumbra_size_scale_min, Config::rendererVar().csm_penumbra_size_scale_max);
+		m_csmBiasScale = Config::rendererVar().csm_bias_scale;
+		m_csmCascadePlaneZMultiplier = 10.0f;
+		m_penumbraSize = Config::rendererVar().csm_penumbra_size;
+		m_csmResolution = Config::rendererVar().csm_resolution;
+		m_numOfPCFSamples = Config::rendererVar().csm_num_of_pcf_samples;
+		m_shadowMappingEnabled = true;
+		m_zClipping = true;
+
+		// Populate the cascade vector with default entries
+		m_shadowCascadePlaneDistances.emplace_back(8.0f, false, 0.0075f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(16.0f, false, 0.0005f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(32.0f, false, 0.0005f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(64.0f, false, 0.0005f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(128.0f, false, 0.0005f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(256.0f, false, 0.0005f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(512.0f, false, 0.0005f, 1.0f);
+		m_shadowCascadePlaneDistances.emplace_back(1.0f, true, 0.0005f, 1.0f);
+	}
+
 	std::vector<ShadowCascadeData> m_shadowCascadePlaneDistances;
 	std::vector<ShadowCascadeData> m_shadowCascadePlaneDistances;
 
 
 	// Cascaded shadow mapping data
 	// Cascaded shadow mapping data

+ 47 - 9
Praxis3D/Source/EditorWindow.cpp

@@ -2421,7 +2421,28 @@ void EditorWindow::update(const float p_deltaTime)
                                             break;
                                             break;
                                         case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Cylinder:
                                         case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Cylinder:
                                             {
                                             {
+                                                // Get the collision shape data
+                                                m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize = rigidBodyComponent->getCollisionShapeSize();
+
+                                                // Draw CYLINDER RADIUS
+                                                drawLeftAlignedLabelText("Cylinder radius:", inputWidgetOffset);
+                                                if(ImGui::DragFloat("##CylinderRadiusDrag", &m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.x, Config::GUIVar().editor_float_slider_speed))
+                                                {
+                                                    m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.z = m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.x;
 
 
+                                                    // If the cylinder half extents size vector was changed, send a notification to the Rigid Body Component
+                                                    m_systemScene->getSceneLoader()->getChangeController()->sendChange(this, rigidBodyComponent, Systems::Changes::Physics::CollisionShapeSize);
+                                                }
+                                                captureMouseWhileItemActive();
+
+                                                // Draw CYLINDER HEIGHT
+                                                drawLeftAlignedLabelText("Cylinder height:", inputWidgetOffset);
+                                                if(ImGui::DragFloat("##CylinderHeightDrag", &m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.y, Config::GUIVar().editor_float_slider_speed))
+                                                {
+                                                    // If the cylinder half extents size vector was changed, send a notification to the Rigid Body Component
+                                                    m_systemScene->getSceneLoader()->getChangeController()->sendChange(this, rigidBodyComponent, Systems::Changes::Physics::CollisionShapeSize);
+                                                }
+                                                captureMouseWhileItemActive();
                                             }
                                             }
                                             break;
                                             break;
                                         case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Sphere:
                                         case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Sphere:
@@ -2431,9 +2452,12 @@ void EditorWindow::update(const float p_deltaTime)
 
 
                                                 // Draw SPHERE RADIUS
                                                 // Draw SPHERE RADIUS
                                                 drawLeftAlignedLabelText("Sphere radius:", inputWidgetOffset);
                                                 drawLeftAlignedLabelText("Sphere radius:", inputWidgetOffset);
-                                                if(ImGui::DragFloat3("##SphereRadiusDrag", glm::value_ptr(m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize), Config::GUIVar().editor_float_slider_speed, 0.0f, 10000.0f))
+                                                if(ImGui::DragFloat("##SphereRadiusDrag", &m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.x, Config::GUIVar().editor_float_slider_speed))
                                                 {
                                                 {
-                                                    // If the box half extents size vector was changed, send a notification to the Rigid Body Component
+                                                    m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.y = m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.x;
+                                                    m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.z = m_selectedEntity.m_componentData.m_physicsComponents.m_rigidBodyConstructionInfo->m_collisionShapeSize.x;
+
+                                                    // If the sphere size vector was changed, send a notification to the Rigid Body Component
                                                     m_systemScene->getSceneLoader()->getChangeController()->sendChange(this, rigidBodyComponent, Systems::Changes::Physics::CollisionShapeSize);
                                                     m_systemScene->getSceneLoader()->getChangeController()->sendChange(this, rigidBodyComponent, Systems::Changes::Physics::CollisionShapeSize);
                                                 }
                                                 }
                                                 captureMouseWhileItemActive();
                                                 captureMouseWhileItemActive();
@@ -3452,7 +3476,7 @@ void EditorWindow::update(const float p_deltaTime)
                         if(ImGui::BeginChild("##ShaderAssetsUniformUpdate", ImVec2(contentRegionWidth * 0.2f, 0), true))
                         if(ImGui::BeginChild("##ShaderAssetsUniformUpdate", ImVec2(contentRegionWidth * 0.2f, 0), true))
                         {
                         {
                             // Calculate widget offset used to draw a label on the left and a widget on the right (opposite of how ImGui draws it)
                             // Calculate widget offset used to draw a label on the left and a widget on the right (opposite of how ImGui draws it)
-                            float inputWidgetOffset = ImGui::GetCursorPosX() + ImGui::CalcItemWidth() * 0.75f + ImGui::GetStyle().ItemInnerSpacing.x;
+                            float inputWidgetOffset = ImGui::GetCursorPosX() + ImGui::CalcTextSize("Updates per frame:").x + ImGui::GetStyle().ItemInnerSpacing.x + ImGui::GetStyle().IndentSpacing;
 
 
                             ImGui::SeparatorText("Uniform updater:");
                             ImGui::SeparatorText("Uniform updater:");
 
 
@@ -3802,7 +3826,7 @@ void EditorWindow::update(const float p_deltaTime)
                         ImGui::SeparatorText("Lua scripts:");
                         ImGui::SeparatorText("Lua scripts:");
                         for(decltype(m_luaScriptAssets.size()) i = 0, size = m_luaScriptAssets.size(); i < size; i++)
                         for(decltype(m_luaScriptAssets.size()) i = 0, size = m_luaScriptAssets.size(); i < size; i++)
                         {
                         {
-                            if(ImGui::Selectable(m_luaScriptAssets[i].second.c_str(), m_selectedLuaScript != NULL_ENTITY_ID ? m_luaScriptAssets[i].first == m_selectedLuaScript : false))
+                            if(ImGui::Selectable((m_luaScriptAssets[i].second + " (" + Utilities::toString(m_luaScriptAssets[i].first) + ")").c_str(), m_selectedLuaScript != NULL_ENTITY_ID ? m_luaScriptAssets[i].first == m_selectedLuaScript : false))
                             {
                             {
                                 m_selectedLuaScript = m_luaScriptAssets[i].first;
                                 m_selectedLuaScript = m_luaScriptAssets[i].first;
                             }
                             }
@@ -4138,11 +4162,15 @@ void EditorWindow::update(const float p_deltaTime)
 
 
                     // If the mouse is hovering over the viewport, stop capturing it, so the engine can handle mouse events
                     // If the mouse is hovering over the viewport, stop capturing it, so the engine can handle mouse events
                     if(ImGui::IsItemHovered())
                     if(ImGui::IsItemHovered())
+                    {
                         ImGui::CaptureMouseFromApp(false);
                         ImGui::CaptureMouseFromApp(false);
+                    }
 
 
                     // If the viewport is focused, stop capturing key presses, so the engine can handle keyboard events
                     // If the viewport is focused, stop capturing key presses, so the engine can handle keyboard events
                     if(ImGui::IsItemFocused())
                     if(ImGui::IsItemFocused())
+                    {
                         ImGui::CaptureKeyboardFromApp(false);
                         ImGui::CaptureKeyboardFromApp(false);
+                    }
 
 
                     ImGui::EndTabItem();
                     ImGui::EndTabItem();
                 }
                 }
@@ -4299,7 +4327,7 @@ void EditorWindow::update(const float p_deltaTime)
 
 
                         ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.26f, 0.26f, 0.26f, 1.0f));
                         ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.26f, 0.26f, 0.26f, 1.0f));
                         ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
                         ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
-                        if(ImGui::BeginChild("##NewSceneSettingsWindow", ImVec2(contentRegionSize.x * 0.6f, contentRegionSize.y * 0.9f), true))
+                        if(ImGui::BeginChild("##NewSceneSettingsWindow", ImVec2(contentRegionSize.x * 0.6f, contentRegionSize.y - m_imguiStyle.FramePadding.y), true))
                         {
                         {
                             ImGui::PopStyleVar(); // ImGuiStyleVar_ChildBorderSize
                             ImGui::PopStyleVar(); // ImGuiStyleVar_ChildBorderSize
                             ImGui::PopStyleColor(); // ImGuiCol_Border
                             ImGui::PopStyleColor(); // ImGuiCol_Border
@@ -6372,20 +6400,28 @@ void EditorWindow::generateNewMap(PropertySet &p_newSceneProperties, SceneData &
     dirLightObjectEntry.addProperty(Properties::PropertyID::Name, std::string("Sun"));
     dirLightObjectEntry.addProperty(Properties::PropertyID::Name, std::string("Sun"));
     dirLightObjectEntry.addProperty(Properties::PropertyID::ID, 1);
     dirLightObjectEntry.addProperty(Properties::PropertyID::ID, 1);
     dirLightObjectEntry.addProperty(Properties::PropertyID::Parent, 0);
     dirLightObjectEntry.addProperty(Properties::PropertyID::Parent, 0);
-    dirLightObjectEntry.addPropertySet(Properties::PropertyID::World).addPropertySet(Properties::PropertyID::SpatialComponent);
+    dirLightObjectEntry.addPropertySet(Properties::PropertyID::World).addPropertySet(Properties::PropertyID::SpatialComponent).addProperty(Properties::PropertyID::LocalRotation, glm::vec3(140.0f, 10.0f, 180.0f));
     auto &lightComponentEntry = dirLightObjectEntry.addPropertySet(Properties::PropertyID::Graphics).addPropertySet(Properties::PropertyID::LightComponent);
     auto &lightComponentEntry = dirLightObjectEntry.addPropertySet(Properties::PropertyID::Graphics).addPropertySet(Properties::PropertyID::LightComponent);
     lightComponentEntry.addProperty(Properties::PropertyID::Type, Properties::PropertyID::DirectionalLight);
     lightComponentEntry.addProperty(Properties::PropertyID::Type, Properties::PropertyID::DirectionalLight);
     lightComponentEntry.addProperty(Properties::PropertyID::Intensity, 10.0f);
     lightComponentEntry.addProperty(Properties::PropertyID::Intensity, 10.0f);
 
 
+    // Create camera entity
     auto &editorCameraObjectEntry = gameObjects.addPropertySet(Properties::ArrayEntry);
     auto &editorCameraObjectEntry = gameObjects.addPropertySet(Properties::ArrayEntry);
     editorCameraObjectEntry.addProperty(Properties::PropertyID::Name, std::string("EditorCamera"));
     editorCameraObjectEntry.addProperty(Properties::PropertyID::Name, std::string("EditorCamera"));
-    editorCameraObjectEntry.addProperty(Properties::PropertyID::ID, 2000000000);
+    editorCameraObjectEntry.addProperty(Properties::PropertyID::ID, 20000000);
     editorCameraObjectEntry.addProperty(Properties::PropertyID::Parent, 0);
     editorCameraObjectEntry.addProperty(Properties::PropertyID::Parent, 0);
     editorCameraObjectEntry.addPropertySet(Properties::PropertyID::Graphics).addPropertySet(Properties::PropertyID::CameraComponent);
     editorCameraObjectEntry.addPropertySet(Properties::PropertyID::Graphics).addPropertySet(Properties::PropertyID::CameraComponent);
     auto &luaComponentEntry = editorCameraObjectEntry.addPropertySet(Properties::PropertyID::Script).addPropertySet(Properties::PropertyID::LuaComponent);
     auto &luaComponentEntry = editorCameraObjectEntry.addPropertySet(Properties::PropertyID::Script).addPropertySet(Properties::PropertyID::LuaComponent);
     luaComponentEntry.addProperty(Properties::PropertyID::Filename, std::string("Camera_free.lua"));
     luaComponentEntry.addProperty(Properties::PropertyID::Filename, std::string("Camera_free.lua"));
     luaComponentEntry.addProperty(Properties::PropertyID::PauseInEditor, false);
     luaComponentEntry.addProperty(Properties::PropertyID::PauseInEditor, false);
-    editorCameraObjectEntry.addPropertySet(Properties::PropertyID::World).addPropertySet(Properties::PropertyID::SpatialComponent);
+    auto &luaVariables = luaComponentEntry.addPropertySet(Properties::PropertyID::Variables);
+    auto &cameraSpeed = luaVariables.addPropertySet(Properties::PropertyID::ArrayEntry);
+    cameraSpeed.addProperty(Properties::PropertyID::Name, std::string("cameraSpeed"));
+    cameraSpeed.addProperty(Properties::PropertyID::Value, 10.0f);
+    auto &cameraSpeedMult = luaVariables.addPropertySet(Properties::PropertyID::ArrayEntry);
+    cameraSpeedMult.addProperty(Properties::PropertyID::Name, std::string("cameraSpeedMultiplier"));
+    cameraSpeedMult.addProperty(Properties::PropertyID::Value, 100.0f);
+    editorCameraObjectEntry.addPropertySet(Properties::PropertyID::World).addPropertySet(Properties::PropertyID::SpatialComponent).addProperty(Properties::PropertyID::LocalPosition, glm::vec3(0.0f, 15.0f, 0.0f));
 
 
     // Add root property set for systems
     // Add root property set for systems
     auto &rootSystemsPropertySet = p_newSceneProperties.addPropertySet(Properties::Systems);
     auto &rootSystemsPropertySet = p_newSceneProperties.addPropertySet(Properties::Systems);
@@ -6447,6 +6483,8 @@ void EditorWindow::generateNewMap(PropertySet &p_newSceneProperties, SceneData &
     shadowMappingPropertySet.addProperty(Properties::PropertyID::ZClipping, p_sceneData.m_shadowMappingData.m_zClipping);
     shadowMappingPropertySet.addProperty(Properties::PropertyID::ZClipping, p_sceneData.m_shadowMappingData.m_zClipping);
     shadowMappingPropertySet.addProperty(Properties::PropertyID::ZPlaneMultiplier, p_sceneData.m_shadowMappingData.m_csmCascadePlaneZMultiplier);
     shadowMappingPropertySet.addProperty(Properties::PropertyID::ZPlaneMultiplier, p_sceneData.m_shadowMappingData.m_csmCascadePlaneZMultiplier);
     shadowMappingPropertySet.addPropertySet(Properties::PCF).addProperty(Properties::PropertyID::Samples, (int)p_sceneData.m_shadowMappingData.m_numOfPCFSamples);
     shadowMappingPropertySet.addPropertySet(Properties::PCF).addProperty(Properties::PropertyID::Samples, (int)p_sceneData.m_shadowMappingData.m_numOfPCFSamples);
+
+    // Add shadow mapping cascades
     auto &cascadesPropertySet = shadowMappingPropertySet.addPropertySet(Properties::PropertyID::Cascades);
     auto &cascadesPropertySet = shadowMappingPropertySet.addPropertySet(Properties::PropertyID::Cascades);
     for(auto &cascade : p_sceneData.m_shadowMappingData.m_shadowCascadePlaneDistances)
     for(auto &cascade : p_sceneData.m_shadowMappingData.m_shadowCascadePlaneDistances)
     {
     {
@@ -6458,4 +6496,4 @@ void EditorWindow::generateNewMap(PropertySet &p_newSceneProperties, SceneData &
         singleCascadePropertySet.addProperty(Properties::PropertyID::BiasMax, cascade.m_maxBias);
         singleCascadePropertySet.addProperty(Properties::PropertyID::BiasMax, cascade.m_maxBias);
         singleCascadePropertySet.addProperty(Properties::PropertyID::PenumbraScale, cascade.m_penumbraScale);
         singleCascadePropertySet.addProperty(Properties::PropertyID::PenumbraScale, cascade.m_penumbraScale);
     }
     }
-}
+}

+ 2 - 0
Praxis3D/Source/EditorWindow.h

@@ -803,6 +803,8 @@ private:
 
 
 			m_aoData.setDefaultValues();
 			m_aoData.setDefaultValues();
 
 
+			m_shadowMappingData.setDefaultValues();
+
 			m_renderingPasses.push_back(RenderPassType::RenderPassType_ShadowMapping);
 			m_renderingPasses.push_back(RenderPassType::RenderPassType_ShadowMapping);
 			m_renderingPasses.push_back(RenderPassType::RenderPassType_Geometry);
 			m_renderingPasses.push_back(RenderPassType::RenderPassType_Geometry);
 			m_renderingPasses.push_back(RenderPassType::RenderPassType_AmbientOcclusion);
 			m_renderingPasses.push_back(RenderPassType::RenderPassType_AmbientOcclusion);

+ 62 - 0
Praxis3D/Source/GUIHandler.cpp

@@ -1,6 +1,68 @@
 
 
+//#include "imgui.cpp"
+
 #include "GUIHandler.h"
 #include "GUIHandler.h"
 
 
+ErrorCode GUIHandler::init()
+{
+	ErrorCode returnError = ErrorCode::Success;
+
+	// Setup Dear ImGui context
+	IMGUI_CHECKVERSION();
+	ImGui::CreateContext();
+	m_io = &ImGui::GetIO();
+
+	// Enable docking if it is set in the config
+	if(Config::GUIVar().gui_docking_enabled)
+		m_io->ConfigFlags |= ImGuiConfigFlags_DockingEnable;
+
+	// Setup Dear ImGui style
+	if(Config::GUIVar().gui_dark_style)
+		ImGui::StyleColorsDark();
+	else
+		ImGui::StyleColorsClassic();
+
+	auto windowHandle = WindowLocator::get().getSDLWindowHandle();
+	auto glContextHandle = WindowLocator::get().getGLContextHandle();
+
+	if(windowHandle != nullptr)
+	{
+		if(glContextHandle != nullptr)
+		{
+			std::string glslVersionString = "#version " + Utilities::toString(Config::engineVar().glsl_version);
+			const char *glsl_version = glslVersionString.c_str();
+
+			auto &imguiIO = ImGui::GetIO();
+
+			// Store the default clipboard implementation
+			auto defaultSetClipboardTextFn = imguiIO.SetClipboardTextFn;
+			auto defaultGetClipboardTextFn = imguiIO.GetClipboardTextFn;
+			auto defaultClipboardUserData = imguiIO.ClipboardUserData;
+
+			// Setup Platform/Renderer backends
+			ImGui_ImplSDL2_InitForOpenGL(windowHandle, glContextHandle);
+			ImGui_ImplOpenGL3_Init(glsl_version);
+
+			// Reset the clipboard functions to the default implementation,
+			// because SDL clipboard functions are not suitable for multithreading
+			// (freezes the process for about 10s when writing to clipboard)
+			imguiIO.SetClipboardTextFn = defaultSetClipboardTextFn;
+			imguiIO.GetClipboardTextFn = defaultGetClipboardTextFn;
+			imguiIO.ClipboardUserData = defaultClipboardUserData;
+
+			auto *m_defaultFont = imguiIO.Fonts->AddFontDefault();
+
+			m_initialized = true;
+		}
+		else
+			returnError = ErrorCode::GL_context_missing;
+	}
+	else
+		returnError = ErrorCode::Window_handle_missing;
+
+	return returnError;
+}
+
 void GUIHandler::render()
 void GUIHandler::render()
 {
 {
 	// Create draw data from GUI elements
 	// Create draw data from GUI elements

+ 1 - 46
Praxis3D/Source/GUIHandler.h

@@ -119,52 +119,7 @@ public:
 	bool isKeyboardCaptured() { return m_io->WantCaptureKeyboard; }
 	bool isKeyboardCaptured() { return m_io->WantCaptureKeyboard; }
 
 
 protected:
 protected:
-	ErrorCode init()
-	{
-		ErrorCode returnError = ErrorCode::Success;
-
-		// Setup Dear ImGui context
-		IMGUI_CHECKVERSION();
-		ImGui::CreateContext();
-		m_io = &ImGui::GetIO();
-
-		// Enable docking if it is set in the config
-		if(Config::GUIVar().gui_docking_enabled)
-			m_io->ConfigFlags |= ImGuiConfigFlags_DockingEnable;
-
-		// Setup Dear ImGui style
-		if(Config::GUIVar().gui_dark_style)
-			ImGui::StyleColorsDark();
-		else
-			ImGui::StyleColorsClassic();
-
-		auto windowHandle = WindowLocator::get().getSDLWindowHandle();
-		auto glContextHandle = WindowLocator::get().getGLContextHandle();
-
-		if(windowHandle != nullptr)
-		{
-			if(glContextHandle != nullptr)
-			{
-				std::string glslVersionString = "#version " + Utilities::toString(Config::engineVar().glsl_version);
-				const char *glsl_version = glslVersionString.c_str();
-
-				// Setup Platform/Renderer backends
-				ImGui_ImplSDL2_InitForOpenGL(windowHandle, glContextHandle);
-				ImGui_ImplOpenGL3_Init(glsl_version);
-
-				auto &imguiIO = ImGui::GetIO();
-				auto *m_defaultFont = imguiIO.Fonts->AddFontDefault();
-
-				m_initialized = true;
-			}
-			else
-				returnError = ErrorCode::GL_context_missing;
-		}
-		else
-			returnError = ErrorCode::Window_handle_missing;
-
-		return returnError;
-	}
+	ErrorCode init();
 
 
 	void initRendering() 
 	void initRendering() 
 	{
 	{

+ 8 - 0
Praxis3D/Source/LuaScript.cpp

@@ -210,6 +210,11 @@ void LuaScript::setDefinitions()
 
 
 	// Create entries for GUI changes
 	// Create entries for GUI changes
 	m_changeTypesTable[sol::update_if_empty]["GUI"]["Sequence"] = Int64Packer(Systems::Changes::GUI::Sequence);
 	m_changeTypesTable[sol::update_if_empty]["GUI"]["Sequence"] = Int64Packer(Systems::Changes::GUI::Sequence);
+
+	// Create entries for PHYSICS changes
+	sol::table physicsChanges = m_changeTypesTable["Physics"].get_or_create<sol::table>();
+	physicsChanges[sol::update_if_empty]["Impulse"] = Int64Packer(Systems::Changes::Physics::Impulse);
+	physicsChanges[sol::update_if_empty]["Torque"] = Int64Packer(Systems::Changes::Physics::Torque);
 }
 }
 
 
 void LuaScript::setFunctions()
 void LuaScript::setFunctions()
@@ -220,6 +225,7 @@ void LuaScript::setFunctions()
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const bool p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const bool p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const int p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const int p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const float p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const float p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
+		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const glm::vec3 p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); },
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const std::string &p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); }));
 		[this](SystemObject *p_observer, const Int64Packer &p_changeType, const std::string &p_v1) -> const void { this->queueChange(p_observer, p_changeType.get(), p_v1); }));
 
 
 	// Entity functions
 	// Entity functions
@@ -231,10 +237,12 @@ void LuaScript::setFunctions()
 		[this](ComponentsConstructionInfo &p_constructionInfo, const std::string &p_filename, const bool p_forceReload) -> bool { return m_scriptScene->getSceneLoader()->importPrefab(p_constructionInfo, p_filename, p_forceReload) == ErrorCode::Success; }));
 		[this](ComponentsConstructionInfo &p_constructionInfo, const std::string &p_filename, const bool p_forceReload) -> bool { return m_scriptScene->getSceneLoader()->importPrefab(p_constructionInfo, p_filename, p_forceReload) == ErrorCode::Success; }));
 
 
 	// Entity component functions
 	// Entity component functions
+	m_luaState.set_function("getRigidBodyComponent", [this](const EntityID p_entityID) -> RigidBodyComponent *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<RigidBodyComponent>(p_entityID); });
 	m_luaState.set_function("getSoundComponent", [this](const EntityID p_entityID) -> SoundComponent *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SoundComponent>(p_entityID); });
 	m_luaState.set_function("getSoundComponent", [this](const EntityID p_entityID) -> SoundComponent *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SoundComponent>(p_entityID); });
 	m_luaState.set_function("getSpatialComponent", [this](const EntityID p_entityID) -> SpatialComponent *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SpatialComponent>(p_entityID); });
 	m_luaState.set_function("getSpatialComponent", [this](const EntityID p_entityID) -> SpatialComponent *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SpatialComponent>(p_entityID); });
 
 
 	// Entity component system object functions
 	// Entity component system object functions
+	m_luaState.set_function("getRigidBodyComponentSystemObject", [this](const EntityID p_entityID) -> SystemObject *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<RigidBodyComponent>(p_entityID); });
 	m_luaState.set_function("getSoundComponentSystemObject", [this](const EntityID p_entityID) -> SystemObject * { return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SoundComponent>(p_entityID); });
 	m_luaState.set_function("getSoundComponentSystemObject", [this](const EntityID p_entityID) -> SystemObject * { return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SoundComponent>(p_entityID); });
 	m_luaState.set_function("getSpatialComponentSystemObject", [this](const EntityID p_entityID) -> SystemObject *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SpatialComponent>(p_entityID); });
 	m_luaState.set_function("getSpatialComponentSystemObject", [this](const EntityID p_entityID) -> SystemObject *{ return static_cast<WorldScene *>(m_scriptScene->getSceneLoader()->getSystemScene(Systems::World))->getEntityRegistry().try_get<SpatialComponent>(p_entityID); });
 
 

+ 17 - 10
Praxis3D/Source/PhysicsScene.cpp

@@ -385,18 +385,25 @@ SystemObject *PhysicsScene::createComponent(const EntityID &p_entityID, const Ri
 			switch(component.m_collisionShapeType)
 			switch(component.m_collisionShapeType)
 			{
 			{
 				case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Box:
 				case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Box:
-				{
-					btVector3 boxHalfExtents = Math::toBtVector3(p_constructionInfo.m_collisionShapeSize);
-					component.m_collisionShape.m_boxShape = new btBoxShape(boxHalfExtents);
-				}
-				break;
+					{
+						btVector3 boxHalfExtents = Math::toBtVector3(p_constructionInfo.m_collisionShapeSize);
+						component.m_collisionShape.m_boxShape = new btBoxShape(boxHalfExtents);
+					}
+					break;
 
 
 				case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Sphere:
 				case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Sphere:
-				{
-					float radius = p_constructionInfo.m_collisionShapeSize.x;
-					component.m_collisionShape.m_sphereShape = new btSphereShape(radius);
-				}
-				break;
+					{
+						float radius = p_constructionInfo.m_collisionShapeSize.x;
+						component.m_collisionShape.m_sphereShape = new btSphereShape(radius);
+					}
+					break;
+
+				case RigidBodyComponent::CollisionShapeType::CollisionShapeType_Cylinder:
+					{
+						btVector3 cylinderHalfExtents = Math::toBtVector3(p_constructionInfo.m_collisionShapeSize);
+						component.m_collisionShape.m_cylinderShape = new btCylinderShape(cylinderHalfExtents);
+					}
+					break;
 			}
 			}
 
 
 			// Success on the loaded collision shape
 			// Success on the loaded collision shape

+ 3 - 2
Praxis3D/Source/PhysicsScene.h

@@ -122,10 +122,11 @@ public:
 		p_constructionInfo.m_name = p_component.getName();
 		p_constructionInfo.m_name = p_component.getName();
 
 
 		p_constructionInfo.m_friction = p_component.getRigidBody()->getFriction();
 		p_constructionInfo.m_friction = p_component.getRigidBody()->getFriction();
-		p_constructionInfo.m_kinematic = p_component.getRigidBody()->isKinematicObject();
+		p_constructionInfo.m_rollingFriction = p_component.getRigidBody()->getRollingFriction();
+		p_constructionInfo.m_spinningFriction = p_component.getRigidBody()->getSpinningFriction();
 		p_constructionInfo.m_mass = p_component.getRigidBody()->getMass();
 		p_constructionInfo.m_mass = p_component.getRigidBody()->getMass();
 		p_constructionInfo.m_restitution = p_component.getRigidBody()->getRestitution();
 		p_constructionInfo.m_restitution = p_component.getRigidBody()->getRestitution();
-		p_constructionInfo.m_rollingFriction = p_component.getRigidBody()->getRollingFriction();
+		p_constructionInfo.m_kinematic = p_component.getRigidBody()->isKinematicObject();
 		p_constructionInfo.m_collisionShapeType = p_component.getCollisionShapeType();
 		p_constructionInfo.m_collisionShapeType = p_component.getCollisionShapeType();
 		p_constructionInfo.m_collisionShapeSize = p_component.getCollisionShapeSize();
 		p_constructionInfo.m_collisionShapeSize = p_component.getCollisionShapeSize();
 		p_constructionInfo.m_linearVelocity = Math::toGlmVec3(p_component.getRigidBody()->getLinearVelocity());
 		p_constructionInfo.m_linearVelocity = Math::toGlmVec3(p_component.getRigidBody()->getLinearVelocity());

+ 20 - 0
Praxis3D/Source/RigidBodyComponent.cpp

@@ -92,6 +92,9 @@ void RigidBodyComponent::changeOccurred(ObservedSubject *p_subject, BitMask p_ch
 		case CollisionShapeType::CollisionShapeType_ConvexHull:
 		case CollisionShapeType::CollisionShapeType_ConvexHull:
 			break;
 			break;
 		case CollisionShapeType::CollisionShapeType_Cylinder:
 		case CollisionShapeType::CollisionShapeType_Cylinder:
+			m_collisionShape.m_cylinderShape->setImplicitShapeDimensions(Math::toBtVector3(
+				p_subject->getVec3(this, Systems::Changes::Physics::CollisionShapeSize) - glm::vec3(m_collisionShape.m_cylinderShape->getMargin())));
+			static_cast<PhysicsScene *>(m_systemScene)->cleanProxyFromPairs(*m_rigidBody);
 			break;
 			break;
 		case CollisionShapeType::CollisionShapeType_Sphere:
 		case CollisionShapeType::CollisionShapeType_Sphere:
 			m_collisionShape.m_sphereShape->setImplicitShapeDimensions(Math::toBtVector3(
 			m_collisionShape.m_sphereShape->setImplicitShapeDimensions(Math::toBtVector3(
@@ -129,6 +132,8 @@ void RigidBodyComponent::changeOccurred(ObservedSubject *p_subject, BitMask p_ch
 				case CollisionShapeType::CollisionShapeType_ConvexHull:
 				case CollisionShapeType::CollisionShapeType_ConvexHull:
 					break;
 					break;
 				case CollisionShapeType::CollisionShapeType_Cylinder:
 				case CollisionShapeType::CollisionShapeType_Cylinder:
+					m_collisionShape.m_cylinderShape = new btCylinderShape(Math::toBtVector3(oldCollisionShapeSize));
+					m_rigidBody->setCollisionShape(m_collisionShape.m_cylinderShape);
 					break;
 					break;
 				case CollisionShapeType::CollisionShapeType_Sphere:
 				case CollisionShapeType::CollisionShapeType_Sphere:
 					m_collisionShape.m_sphereShape = new btSphereShape(oldCollisionShapeSize.x);
 					m_collisionShape.m_sphereShape = new btSphereShape(oldCollisionShapeSize.x);
@@ -203,5 +208,20 @@ void RigidBodyComponent::changeOccurred(ObservedSubject *p_subject, BitMask p_ch
 		}
 		}
 	}
 	}
 
 
+
+	//if(CheckBitmask(p_changeType, Systems::Changes::Physics::AllDynamic))
+	{
+		if(CheckBitmask(p_changeType, Systems::Changes::Physics::Impulse))
+		{
+
+		}
+
+		if(CheckBitmask(p_changeType, Systems::Changes::Physics::Torque))
+		{
+			m_rigidBody->applyTorqueImpulse(Math::toBtVector3(p_subject->getVec3(this, Systems::Changes::Spatial::LocalPosition)));
+			m_rigidBody->activate(true);
+		}
+	}
+
 	postChanges(newChanges);
 	postChanges(newChanges);
 }
 }

+ 43 - 28
Praxis3D/Source/SceneLoader.cpp

@@ -944,41 +944,56 @@ void SceneLoader::importFromProperties(PhysicsComponentsConstructionInfo &p_cons
 				{
 				{
 					switch(typeProperty.getID())
 					switch(typeProperty.getID())
 					{
 					{
-					case Properties::Box:
-					{
-						// Get the size property
-						auto const &sizeProperty = collisionShapeProperty.getPropertyByID(Properties::Size);
+						case Properties::Box:
+							{
+								// Get the size property
+								auto const &sizeProperty = collisionShapeProperty.getPropertyByID(Properties::Size);
 
 
-						// If the size was not given, leave it to a default 0.5f all around (so it gets to the final 1.0/1.0/1.0 dimension)
-						if(sizeProperty)
-							p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeSize = sizeProperty.getVec3f();
-						else
-							ErrHandlerLoc().get().log(ErrorCode::Property_missing_size, p_name, ErrorSource::Source_RigidBodyComponent);
+								// If the size was not given, leave it to a default 0.5f all around (so it gets to the final 1.0/1.0/1.0 dimension)
+								if(sizeProperty)
+									p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeSize = sizeProperty.getVec3f();
+								else
+									ErrHandlerLoc().get().log(ErrorCode::Property_missing_size, p_name, ErrorSource::Source_RigidBodyComponent);
 
 
-						p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeType = RigidBodyComponent::CollisionShapeType::CollisionShapeType_Box;
-					}
-					break;
+								p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeType = RigidBodyComponent::CollisionShapeType::CollisionShapeType_Box;
+							}
+							break;
 
 
-					case Properties::Sphere:
-					{
-						// Get the size property
-						auto const &sizeProperty = collisionShapeProperty.getPropertyByID(Properties::Size);
+						case Properties::Cylinder:
+							{
+								// Get the size property
+								auto const &sizeProperty = collisionShapeProperty.getPropertyByID(Properties::Size);
 
 
-						// If the size was not given, leave it to a default radius of 0.5f (which makes the sphere diameter equal to 1.0)
-						if(sizeProperty)
-							p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeSize = sizeProperty.getVec3f();
-						else
-							ErrHandlerLoc().get().log(ErrorCode::Property_missing_radius, p_name, ErrorSource::Source_RigidBodyComponent);
+								// If the size was not given, leave it to a default radius of 0.5f (which makes the sphere diameter equal to 1.0)
+								if(sizeProperty)
+									p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeSize = sizeProperty.getVec3f();
+								else
+									ErrHandlerLoc().get().log(ErrorCode::Property_missing_size, p_name, ErrorSource::Source_RigidBodyComponent);
 
 
-						p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeType = RigidBodyComponent::CollisionShapeType::CollisionShapeType_Sphere;
-					}
-					break;
+								p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeType = RigidBodyComponent::CollisionShapeType::CollisionShapeType_Cylinder;
+							}
+							break;
 
 
-					default:
+						case Properties::Sphere:
+							{
+								// Get the size property
+								auto const &sizeProperty = collisionShapeProperty.getPropertyByID(Properties::Size);
 
 
-						// If this is reached, the collision shape type was not valid
-						ErrHandlerLoc().get().log(ErrorCode::Collision_invalid, p_name, ErrorSource::Source_RigidBodyComponent);
-						break;
+								// If the size was not given, leave it to a default radius of 0.5f (which makes the sphere diameter equal to 1.0)
+								if(sizeProperty)
+									p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeSize = sizeProperty.getVec3f();
+								else
+									ErrHandlerLoc().get().log(ErrorCode::Property_missing_radius, p_name, ErrorSource::Source_RigidBodyComponent);
+
+								p_constructionInfo.m_rigidBodyConstructionInfo->m_collisionShapeType = RigidBodyComponent::CollisionShapeType::CollisionShapeType_Sphere;
+							}
+							break;
+
+						default:
+
+							// If this is reached, the collision shape type was not valid
+							ErrHandlerLoc().get().log(ErrorCode::Collision_invalid, p_name, ErrorSource::Source_RigidBodyComponent);
+							break;
 					}
 					}
 				}
 				}
 				else
 				else

+ 3 - 3
Praxis3D/Source/Version.h

@@ -4,12 +4,12 @@
 #define VERSION_TO_STRING(v) VERSION_TO_STRING_HELPER(v)
 #define VERSION_TO_STRING(v) VERSION_TO_STRING_HELPER(v)
 
 
 #define PRAXIS3D_COMMIT_DATE_YEAR 2024
 #define PRAXIS3D_COMMIT_DATE_YEAR 2024
-#define PRAXIS3D_COMMIT_DATE_MONTH 02
-#define PRAXIS3D_COMMIT_DATE_DAY 25
+#define PRAXIS3D_COMMIT_DATE_MONTH 04
+#define PRAXIS3D_COMMIT_DATE_DAY 06
 
 
 #define PRAXIS3D_VERSION_MAJOR 0
 #define PRAXIS3D_VERSION_MAJOR 0
 #define PRAXIS3D_VERSION_MINOR 2
 #define PRAXIS3D_VERSION_MINOR 2
-#define PRAXIS3D_VERSION_PATCH 5
+#define PRAXIS3D_VERSION_PATCH 6
 
 
 #define PRAXIS3D_COMMIT_DATE ((PRAXIS3D_COMMIT_DATE_YEAR << 16) | (PRAXIS3D_COMMIT_DATE_MONTH << 8) | PRAXIS3D_COMMIT_DATE_DAY)
 #define PRAXIS3D_COMMIT_DATE ((PRAXIS3D_COMMIT_DATE_YEAR << 16) | (PRAXIS3D_COMMIT_DATE_MONTH << 8) | PRAXIS3D_COMMIT_DATE_DAY)
 #define PRAXIS3D_COMMIT_DATE_STRING VERSION_TO_STRING(PRAXIS3D_COMMIT_DATE_YEAR) "-" VERSION_TO_STRING(PRAXIS3D_COMMIT_DATE_MONTH) "-" VERSION_TO_STRING(PRAXIS3D_COMMIT_DATE_DAY)
 #define PRAXIS3D_COMMIT_DATE_STRING VERSION_TO_STRING(PRAXIS3D_COMMIT_DATE_YEAR) "-" VERSION_TO_STRING(PRAXIS3D_COMMIT_DATE_MONTH) "-" VERSION_TO_STRING(PRAXIS3D_COMMIT_DATE_DAY)

+ 4 - 2
Praxis3D/Source/Window.cpp

@@ -192,7 +192,9 @@ void Window::handleEvents()
 		else
 		else
 		{
 		{
 			// If GUI is enabled, send the event to it
 			// If GUI is enabled, send the event to it
-			if(m_enableGUI && !Config::m_windowVar.mouse_captured)
+			// A fix for right mouse button being stuck down (in ImGui) when moving the camera around in the editor, which forces mouse capturing and in turn doesn't send the mouse up events to ImGui:
+			// send the mouse button up events to ImGui even when mouse capturing is turned on
+			if(m_enableGUI && (!Config::m_windowVar.mouse_captured || SDLEvent.type == SDL_MOUSEBUTTONUP))
 				m_guiHandler->processSDLEvent(SDLEvent);
 				m_guiHandler->processSDLEvent(SDLEvent);
 				
 				
 			handleSDLEvent(SDLEvent);
 			handleSDLEvent(SDLEvent);
@@ -356,8 +358,8 @@ void Window::handleSDLEvent(const SDL_Event &p_SDLEvent)
 						m_binds[Scancode::Mouse_x2].activate();
 						m_binds[Scancode::Mouse_x2].activate();
 						break;
 						break;
 				}
 				}
-				break;
 			}
 			}
+			break;
 		}
 		}
 
 
 	case SDL_MOUSEBUTTONUP:
 	case SDL_MOUSEBUTTONUP:

+ 428 - 20
Praxis3D/imgui.ini

@@ -4,8 +4,8 @@ Size=400,400
 Collapsed=0
 Collapsed=0
 
 
 [Window][Dear ImGui Demo]
 [Window][Dear ImGui Demo]
-Pos=740,181
-Size=799,986
+Pos=1028,196
+Size=696,842
 Collapsed=0
 Collapsed=0
 
 
 [Window][Dear ImGui Stack Tool]
 [Window][Dear ImGui Stack Tool]
@@ -80,30 +80,30 @@ DockId=0x00000002,0
 
 
 [Window][DockSpaceViewport_11111111]
 [Window][DockSpaceViewport_11111111]
 Pos=0,69
 Pos=0,69
-Size=2335,1309
+Size=5120,1371
 Collapsed=0
 Collapsed=0
 
 
 [Window][##LeftWindow]
 [Window][##LeftWindow]
 Pos=0,69
 Pos=0,69
-Size=342,1086
+Size=342,1148
 Collapsed=0
 Collapsed=0
 DockId=0x00000001,0
 DockId=0x00000001,0
 
 
 [Window][##RightWindow]
 [Window][##RightWindow]
-Pos=1797,69
-Size=538,1309
+Pos=4582,69
+Size=538,1371
 Collapsed=0
 Collapsed=0
 DockId=0x00000008,0
 DockId=0x00000008,0
 
 
 [Window][##BottomWindow]
 [Window][##BottomWindow]
-Pos=0,1157
-Size=1795,221
+Pos=0,1219
+Size=4580,221
 Collapsed=0
 Collapsed=0
 DockId=0x00000006,0
 DockId=0x00000006,0
 
 
 [Window][##CenterWindow]
 [Window][##CenterWindow]
 Pos=344,69
 Pos=344,69
-Size=1451,1086
+Size=4236,1148
 Collapsed=0
 Collapsed=0
 DockId=0x00000004,0
 DockId=0x00000004,0
 
 
@@ -128,13 +128,13 @@ Size=666,477
 Collapsed=0
 Collapsed=0
 
 
 [Window][Dear ImGui Metrics/Debugger]
 [Window][Dear ImGui Metrics/Debugger]
-Pos=107,298
+Pos=408,283
 Size=608,708
 Size=608,708
 Collapsed=0
 Collapsed=0
 
 
 [Window][Dear ImGui Debug Log]
 [Window][Dear ImGui Debug Log]
-Pos=210,725
-Size=623,156
+Pos=1034,343
+Size=682,518
 Collapsed=0
 Collapsed=0
 
 
 [Window][Save scene##EditorFileBrowserDialog]
 [Window][Save scene##EditorFileBrowserDialog]
@@ -193,7 +193,7 @@ Size=240,71
 Collapsed=0
 Collapsed=0
 
 
 [Window][Open a texture file##OpenTextureFileFileDialog]
 [Window][Open a texture file##OpenTextureFileFileDialog]
-Pos=400,192
+Pos=575,225
 Size=1007,703
 Size=1007,703
 Collapsed=0
 Collapsed=0
 
 
@@ -213,7 +213,7 @@ Size=855,618
 Collapsed=0
 Collapsed=0
 
 
 [Window][##AddEntityPopup]
 [Window][##AddEntityPopup]
-Pos=288,973
+Pos=262,278
 Size=400,155
 Size=400,155
 Collapsed=0
 Collapsed=0
 
 
@@ -223,7 +223,7 @@ Size=801,605
 Collapsed=0
 Collapsed=0
 
 
 [Window][##LoadingStatusWindow]
 [Window][##LoadingStatusWindow]
-Pos=1037,588
+Pos=-32,-35
 Size=64,70
 Size=64,70
 Collapsed=0
 Collapsed=0
 
 
@@ -247,8 +247,7 @@ Size=80,71
 Collapsed=0
 Collapsed=0
 
 
 [Window][##ExampleMapInfo]
 [Window][##ExampleMapInfo]
-Pos=0,0
-Size=2335,1378
+Size=1920,1027
 Collapsed=0
 Collapsed=0
 
 
 [Window][CloseEditor]
 [Window][CloseEditor]
@@ -271,6 +270,11 @@ Pos=770,526
 Size=240,71
 Size=240,71
 Collapsed=0
 Collapsed=0
 
 
+[Window][Tree spawner]
+Pos=485,346
+Size=170,78
+Collapsed=0
+
 [Table][0x9A4BDFDE,4]
 [Table][0x9A4BDFDE,4]
 RefScale=13
 RefScale=13
 Column 0  Sort=0v
 Column 0  Sort=0v
@@ -4911,12 +4915,416 @@ Column 0  Sort=0v
 RefScale=13
 RefScale=13
 Column 0  Sort=0v
 Column 0  Sort=0v
 
 
+[Table][0x7A2B3C56,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1642AEF1,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x3E3D5952,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x074CFAE7,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xFE2B4A21,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x61A00877,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC830B447,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x8AEF662E,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x9B6297AD,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x6D2F6A85,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x29390F81,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xFE24FEA0,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x6720B894,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xDD913C58,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xD75274BC,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xD0E21D34,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x53B9EC67,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x3FD07EC0,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xD695B776,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xDDE291B8,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x99F4F4BC,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x8D36C6F0,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x081A9DE1,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x8914147A,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x4BE600EA,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x7B37BB47,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x57752364,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x3B1CB1C3,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x13634660,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1026E40A,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x44FCA6EA,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x887C72DA,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xE415E07D,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x8E87507E,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x70DEE6F4,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1CB77453,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x0CDC6941,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x60B5FBE6,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x89F03250,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x08FEBBCB,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x666FE1B1,4]
+RefScale=13
+Column 3  Sort=0^
+
+[Table][0x4F1A51DF,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xFF55A482,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x2A866C43,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x0634F4AA,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x0312CFC7,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x2EE9A938,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x24852B63,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC3BE89C7,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x30374404,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x8078B159,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xAFD71B60,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x4692D2D6,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xA90D0137,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC79C5B4D,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xB5E3B358,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x48C0975F,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x6653DD18,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x66E0AE2C,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x5F90404B,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x192FBBA6,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x9683E230,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x97718032,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x09DF7662,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1D06DC0F,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x3DDD2C2E,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xA5C84EDB,4]
+RefScale=13
+Column 3  Sort=0^
+
+[Table][0xE60E7645,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x56418318,4]
+RefScale=13
+Column 3  Sort=0^
+
+[Table][0xC9A1DC7C,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x20E415CA,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xCF7BC62B,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xA1EA9C51,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xE1DE2BDF,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x7F7148D0,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC98E800C,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x6222BC58,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x3173E7EB,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC2FA2A28,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC645B64D,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x5AB0EBEF,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC49DAF0B,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC690AB75,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xE044CDFF,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1C0A2E1E,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xDEF2D9EC,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x208DC58E,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xE3FE095F,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xCB8AD837,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x946F1954,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x33A5F913,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x7E834FA3,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xC6004CB5,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x3DD4706B,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x7E74DBD1,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x5F4D3CFB,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x8A4C3E3C,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x96476140,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1E137CCB,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0x1478FD4F,4]
+RefScale=13
+Column 0  Sort=0v
+
+[Table][0xE7F1308C,4]
+RefScale=13
+Column 0  Sort=0v
+
 [Docking][Data]
 [Docking][Data]
-DockSpace         ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,69 Size=2335,1309 Split=X
+DockSpace         ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,69 Size=5120,1371 Split=X
   DockNode        ID=0x00000007 Parent=0x8B93E3BD SizeRef=1380,1011 Split=Y
   DockNode        ID=0x00000007 Parent=0x8B93E3BD SizeRef=1380,1011 Split=Y
-    DockNode      ID=0x00000005 Parent=0x00000007 SizeRef=1920,1148 Split=X
+    DockNode      ID=0x00000005 Parent=0x00000007 SizeRef=1920,1086 Split=X
       DockNode    ID=0x00000001 Parent=0x00000005 SizeRef=342,1011 Selected=0xB1B21E90
       DockNode    ID=0x00000001 Parent=0x00000005 SizeRef=342,1011 Selected=0xB1B21E90
-      DockNode    ID=0x00000003 Parent=0x00000005 SizeRef=1676,1011 Split=X
+      DockNode    ID=0x00000003 Parent=0x00000005 SizeRef=1451,1011 Split=X
         DockNode  ID=0x00000002 Parent=0x00000003 SizeRef=332,1042 Selected=0xD00C9CD4
         DockNode  ID=0x00000002 Parent=0x00000003 SizeRef=332,1042 Selected=0xD00C9CD4
         DockNode  ID=0x00000004 Parent=0x00000003 SizeRef=1586,1042 CentralNode=1 Selected=0xFB1B6F35
         DockNode  ID=0x00000004 Parent=0x00000003 SizeRef=1586,1042 CentralNode=1 Selected=0xFB1B6F35
     DockNode      ID=0x00000006 Parent=0x00000007 SizeRef=1920,221 Selected=0x51C0BD29
     DockNode      ID=0x00000006 Parent=0x00000007 SizeRef=1920,221 Selected=0x51C0BD29