new private static void Load()
 {
     if (!Loaded)
     {
         ShapeRenderer.Load();
         Loaded           = true;
         SphereModel      = AssetManager.Load <Model>("Models/Deferred/Sphere");
         ShadowProjection = Matrix.CreatePerspectiveFieldOfView(90 * 3.14159265f / 180, 1, 0.1f, 2000) * Matrix.CreateScale(-1, 1, 1);
     }
 }
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (!Sphere.get())
            {
                ShapeRenderer.DrawCube(WorldMatrix, camera, drawColor);
            }
            else
            {
                ShapeRenderer.DrawSphere(WorldMatrix, camera, drawColor);
            }

            base.Draw3D(camera, DrawTag);
        }
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (lightState == BasicLight.LightState.Dead)
            {
                base.Draw3D(camera, DrawTag);
                return;
            }

            if (DrawTag == GameObjectTag._3DPreDraw)
            {
                if (RealtimeShadows.get())
                {
                    DrawShadows();
                }
            }
            else
            {
#if EDITOR && WINDOWS
                if (DrawTag == GameObjectTag._3DForward)
                {
                    if (EditorSelected)
                    {
                        Vector4 Col = Vector4.One;
                        ShapeRenderer.DrawSphere(WorldMatrix, camera, Col);
                    }
                    if (ShadowCube != null)
                    {
                        ShapeRenderer.DrawSphere(WorldMatrix, camera, ShadowCube.Value);
                    }
                }
                else
#endif
                if (MyEffect.Holder != null)
                {
                    Game1.graphicsDevice.RasterizerState = RasterizerState.CullClockwise;
                    DeferredLightEffect effect3D = (DeferredLightEffect)MyEffect.Holder;

                    effect3D.SetTextureSize(ParentScene.WindowSize);
                    effect3D.SetUV(camera);
                    effect3D.SetInverseCamera(camera);
                    effect3D.SetLight(Position.get(), Scale.get() / 2);
                    effect3D.SetFromObject(this);
                    effect3D.SetFromCamera(camera);
                    effect3D.MyEffect.CurrentTechnique.Passes[0].Apply();
                    Render.DrawModel(SphereModel, MyEffect.get());
                }
            }
            base.Draw3D(camera, DrawTag);
        }
        public override void Create()
        {
            Delay  = new FloatValue("Delay", 60);
            Sphere = new BoolValue("Sphere");
            base.Create();

#if EDITOR
            if (ParentLevel.LevelForEditing)
            {
                AddTag(GameObjectTag._3DForward);
                ShapeRenderer.Load();
                ApplyScale(Vector3.One * 200, Vector3.Zero, false);
            }
#endif
        }
        public override void Create()
        {
            SetCollisionShape(new OrientedBoxShape());
            AddTag(GameObjectTag._3DSolid);

            base.Create();

#if EDITOR
            if (ParentLevel.LevelForEditing)
            {
                AddTag(GameObjectTag._3DForward);
                ShapeRenderer.Load();
                ApplyScale(Vector3.One * 200, Vector3.Zero, false);
            }
#endif
        }
示例#6
0
        public override void Create()
        {
            MyEvent          = new EventValue("Event");
            TriggeringObject = new ObjectValue("Trigger Object", typeof(Basic3DObject));
            TriggeringType   = new TypeValue("Trigger Type", typeof(Basic3DObject));
            SetCollisionShape(new OrientedBoxShape());
            Used       = new BoolValue("Used");
            AllowReset = new BoolValue("Allow Reset");
            ResetDelay = new IntValue("Reset Delay", 1000);

            base.Create();
            AddTag(GameObjectTag.Update);

#if EDITOR
            if (ParentLevel.LevelForEditing)
            {
                AddTag(GameObjectTag._3DForward);
                ShapeRenderer.Load();
                ApplyScale(Vector3.One * 200, Vector3.Zero, false);
            }
#endif
        }
 public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
 {
     ShapeRenderer.DrawCube(WorldMatrix, camera, drawColor);
     base.Draw3D(camera, DrawTag);
 }