Beispiel #1
0
        public AABB EncapsulatingAABB(TransformComponent transform)
        {
            AABB result = AABB.Empty();

            switch (Shape)
            {
            case RyneCollisionShape.CollisionShapeAABB:
                result = ExtractAABB(transform);
                break;

            case RyneCollisionShape.CollisionShapeSphere:
                Sphere sphere = ExtractSphere(transform);
                result.Min = new Float4(sphere.Position - new Float3(sphere.Radius), 0.0f);
                result.Max = new Float4(sphere.Position + new Float3(sphere.Radius), 0.0f);
                break;

            case RyneCollisionShape.CollisionShapeCube:
                Cube cube = ExtractCube(transform);
                foreach (var vertex in cube.GetVertices())
                {
                    result.Min = RyneMath.Min(result.Min, new Float4(vertex));
                    result.Max = RyneMath.Max(result.Max, new Float4(vertex));
                }
                break;

            default:
                Logger.Error("EncapsulatingAABB for unsupported shape");
                break;
            }

            return(result);
        }
Beispiel #2
0
        public override unsafe void RenderGui(ImGuiWrapper gui)
        {
            base.RenderGui(gui);

            if (gui is SceneEditorGui sceneGui)
            {
                var color = Color;
                if (gui.InputFloat3("Color", &color))
                {
                    Color   = RyneMath.Max(color, new Float3(0.01f));
                    Changed = true;
                }

                var intensity = Intensity;
                if (gui.InputFloat("Intensity", ref intensity))
                {
                    Intensity = System.Math.Max(intensity, 0.01f);
                    Changed   = true;
                }
            }

            if (Changed)
            {
                Global.StateManager.GetCurrentState().SceneRenderData.UpdateLight(ToRenderLight(), RenderId);
                Changed = false;
            }
        }
Beispiel #3
0
 public void Expand(Float4 position)
 {
     Max = RyneMath.Max(Max, position);
     Min = RyneMath.Min(Min, position);
 }
Beispiel #4
0
 public void Expand(AABB bounds)
 {
     Max = RyneMath.Max(Max, bounds.Max);
     Min = RyneMath.Min(Min, bounds.Min);
 }