public Matrix GetLightVolumeWorldMatrix(Cell c, GameObjectReference objRef) { Matrix scale, rotate, translate; float fRadius = (float)Math.Tan(objRef.OuterAngle * 0.5f) * objRef.MaxRange; scale = Matrix.Scaling(fRadius * 2.0f, objRef.MaxRange * 2.0f, fRadius * 2.0f); rotate = RotateToFace(WorldSpace.GetRealWorldPos(objRef.Position, c), WorldSpace.GetRealWorldPos(objRef.Target, c), Vector3.UnitY); translate = WorldSpace.GetRealWorldMatrix(objRef.Position, c); return(scale * rotate * translate); }
public Matrix GetLightVolumeWorldMatrix(Cell c, GameObjectReference objRef) { float fScale = objRef.MaxRange * 1.1f; Matrix scale, translate, world = Matrix.Identity; translate = WorldSpace.GetRealWorldMatrix(objRef.Position, c); scale = Matrix.Scaling(fScale, fScale, fScale); world = Matrix.Multiply(world, scale); world = Matrix.Multiply(world, translate); return(world); }
public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor) { Matrix scale, translate, sphereMatWVP; translate = WorldSpace.GetRealWorldMatrix(objRef.Position, c); scale = Matrix.Scaling(objRef.MaxRange, objRef.MaxRange, objRef.MaxRange); sphereMatWVP = scale * translate; RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Point], sphereMatWVP, GridColor); RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Point], translate, GridColor); }
public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor) { //if (targetMesh == null) // targetMesh = new GameObjectRef(@"system/box.mesh", "box.mesh", MeshInputElements10.PositionOnly4); Model targetMesh = WorldData.GetObject("light_target") as Model; Matrix scale, rotate, translate, matWVP; float fRadius = (float)Math.Tan(objRef.OuterAngle * 0.5f) * objRef.MaxRange; scale = Matrix.Scaling(fRadius, objRef.MaxRange, fRadius); rotate = RotateToFace(WorldSpace.GetRealWorldPos(objRef.Position, c), WorldSpace.GetRealWorldPos(objRef.Target, c), Vector3.UnitY); translate = WorldSpace.GetRealWorldMatrix(objRef.Position, c); matWVP = scale * rotate * translate; RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Spot], matWVP, GridColor); RenderingFunctions.DrawLightVolume(targetMesh, Matrix.Scaling(1, 1, 1) * WorldSpace.GetRealWorldMatrix(objRef.Target, c), GridColor); }
public override void RenderDebugLightVolume(GameObjectReference objRef, Cell c, Vector4 GridColor) { Matrix m = GetLightVolumeMatrix(c, objRef.Position, objRef.EndPoint, objRef.MaxRange); RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Area], m, GridColor); RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Area], Matrix.Scaling(2, 2, 2) * WorldSpace.GetRealWorldMatrix(objRef.Position, c), GridColor); RenderingFunctions.DrawLightVolume(DeferredRenderer.lightVolume[(int)LightType.Area], Matrix.Scaling(2, 2, 2) * WorldSpace.GetRealWorldMatrix(objRef.EndPoint, c), GridColor); }