Beispiel #1
0
        public void Insert(Renderable data)
        {
            Time.StartTimer("RenderQueue.Insert()", "Render");

            if (data.Material.ShaderProgram == null) throw new ArgumentNullException("data.Shader", "Renderable's shader must not be null!");

            var shader = data.Material.ShaderProgram;

            // Check if the object needs to be added in solid or transparent batch
            var dict = data.Material.Transparent ? TransparentShaderBatches : SolidShaderBatches;

            ShaderBatch batch = null;

            if (!dict.TryGetValue(shader, out batch))
            {
                batch = new ShaderBatch();
                batch.RenderQueue = this;
                dict.Add(shader, batch);
            }

            batch.Insert(data);
            Count++;

            Time.StopTimer("RenderQueue.Insert()");
        }
Beispiel #2
0
        public void Insert(Renderable data)
        {
            if (data == null)
                return;

            if (Instanced == null && !Batched.ContainsKey(data.Material))
            {
                if (RenderQueue.AllowInstancing && GPUCapabilities.Instancing && data is Model)
                {
                    Instanced = new Dictionary<Mesh,InstancedBatch>();
                    Debug.WriteLine("Instantiated InstacedBatch");
                }
                else
                {
                    Batched.Add(data.Material, new List<Renderable>());
                    BatchCount.Add(data.Material, 0);
                    Debug.WriteLine("Instantiated BatchQueue");
                }
            }

            if(Instanced != null)
            {
                var model = data as Model;
                var mesh = model.Mesh;

                InstancedBatch batch;
                if(!Instanced.TryGetValue(mesh, out batch))
                {
                    batch = new InstancedBatch(model);
                    Instanced.Add(mesh, batch);
                }

                batch.Insert(model);
            }
            else
            {
                var count = BatchCount[data.Material];
                if (Batched[data.Material].Count > count)
                {
                    Batched[data.Material][count] = data;
                }
                else
                {
                    Batched[data.Material].Add(data);
                }
                BatchCount[data.Material] = 1 + count;
            }

            Textures = data.Material.Textures;

            if(locations.Count == 0)
            {
                foreach (var texture in Textures)
                {
                    var uniform = texture.Key;
                    var location = GL.GetUniformLocation(data.Material.ShaderProgram.ID, uniform);
                    locations.Add(uniform, location);
                }
            }
        }
Beispiel #3
0
        public void Insert(Renderable data)
        {
            Program = data.Material.ShaderProgram;
            var textures = data.Material.Textures;

            TextureBatch batchQueue;

            if (textures == null || textures.Count == 0)
            {
                if(textureless == null)
                {
                    textureless = new TextureBatch();
                    textureless.RenderQueue = RenderQueue;
                }

                batchQueue = textureless;
            }
            else
            {
                if (!TextureBatches.TryGetValue(textures, out batchQueue))
                {
                    batchQueue = new TextureBatch();
                    batchQueue.RenderQueue = RenderQueue;
                    TextureBatches.Add(textures, batchQueue);
                }
            }

            batchQueue.Insert(data);
        }
        public Renderable Image(Actor self, string pal)
        {
            var p = self.CenterLocation;
            var loc = p - 0.5f * Animation.Image.size
                + (OffsetFunc != null ? OffsetFunc() : float2.Zero);
            var r = new Renderable(Animation.Image, loc, pal, p.Y);

            return ZOffset != 0 ? r.WithZOffset(ZOffset) : r;
        }
Beispiel #5
0
        public Renderable Image(Actor self, WorldRenderer wr, PaletteReference pal)
        {
            var p = self.CenterLocation;
            var loc = p.ToFloat2() - 0.5f * Animation.Image.size
                + (OffsetFunc != null ? OffsetFunc(wr) : float2.Zero);
            var r = new Renderable(Animation.Image, loc, pal, p.Y);

            return ZOffset != 0 ? r.WithZOffset(ZOffset) : r;
        }
Beispiel #6
0
 private void LoadSimulator(object sender, EventArgs e)
 {
     var model = new Engine();
     var controller = new SimulatorController(model);
     actualPage = new Simulator(controller);
     model.subscribe((Observer)actualPage);
     ((Simulator)actualPage).LoadMainMenu += LoadMainMenu;
     content.Navigate(actualPage);
 }
Beispiel #7
0
 private void LoadMainMenu(object sender, EventArgs e)
 {
     actualPage = new MainMenu();
     ((MainMenu)actualPage).LoadSimulator += LoadSimulator;
     ((MainMenu)actualPage).LoadConfigPanel += LoadConfigPanel;
     ((MainMenu)actualPage).LoadEditor += LoadEditor;
     ((MainMenu)actualPage).CloseApplication += CloseApplication;
     content.Navigate(actualPage);
 }
 public void CopyToArray()
 {
     var bubbleList = new BubbleSortedList { ellipse1, ellipse2, ellipse3, ellipse4 };
     var listRenderable = new Renderable[4];
     bubbleList.CopyTo(listRenderable, 0);
     Assert.AreEqual(ellipse1, listRenderable[0]);
     Assert.AreEqual(ellipse2, listRenderable[1]);
     Assert.AreEqual(ellipse3, listRenderable[2]);
     Assert.AreEqual(ellipse4, listRenderable[3]);
 }
Beispiel #9
0
        public Renderer(Sprite sprite)
        {
            this.sprite = sprite;
            if (sprite is Renderable) renderable = (Renderable) sprite;

            transform = Matrix4.Identity;
            sceneTransform = Matrix4.Identity;
            translation = Vector3.Zero;
            scale = Vector3.One;
            rotation = Quaternion.Identity;

            inverseSceneTransform = Matrix4.Identity;
            touchStage = new Vector2();
            touchLocal = new Vector2();
        }
Beispiel #10
0
 public void AddRenderable(Renderable renderable)
 {
     renderables.Add(renderable);
 }
Beispiel #11
0
        /// <summary>
        /// Triggered by the runtime when a resource is dropped on the scene tree view.
        /// </summary>
        private void Internal_DoOnResourceDropped(SceneObject parent, string[] resourcePaths)
        {
            if (resourcePaths == null)
            {
                return;
            }

            List <SceneObject> addedObjects = new List <SceneObject>();

            for (int i = 0; i < resourcePaths.Length; i++)
            {
                ResourceMeta meta = ProjectLibrary.GetMeta(resourcePaths[i]);
                if (meta == null)
                {
                    continue;
                }

                if (meta.ResType == ResourceType.Mesh)
                {
                    if (!string.IsNullOrEmpty(resourcePaths[i]))
                    {
                        string meshName = Path.GetFileNameWithoutExtension(resourcePaths[i]);

                        Mesh mesh = ProjectLibrary.Load <Mesh>(resourcePaths[i]);
                        if (mesh == null)
                        {
                            continue;
                        }

                        SceneObject so = new SceneObject(meshName);

                        GameObjectUndo.RecordNewSceneObject(so);
                        so.Parent = parent;

                        Renderable renderable = so.AddComponent <Renderable>();
                        renderable.Mesh = mesh;
                        GameObjectUndo.ResolveDiffs();

                        addedObjects.Add(so);
                    }
                }
                else if (meta.ResType == ResourceType.Prefab)
                {
                    if (!string.IsNullOrEmpty(resourcePaths[i]))
                    {
                        Prefab      prefab = ProjectLibrary.Load <Prefab>(resourcePaths[i]);
                        SceneObject so     = UndoRedo.Instantiate(prefab, "Instantiating " + prefab.Name);
                        so.Parent = parent;

                        addedObjects.Add(so);
                    }
                }
            }

            if (addedObjects.Count > 0)
            {
                EditorApplication.SetSceneDirty();
            }

            Selection.SceneObjects = addedObjects.ToArray();
        }
Beispiel #12
0
        internal void UpdateData()
        {
            if (renderableComponents.Length == 0)
            {
                return;
            }

            for (int i = 0; i < renderableComponents.Length; i++)
            {
                Renderable curRend = renderableComponents[i];

                if (!curRend.HasChanged)
                {
                    continue;
                }

                List <float> vertexData = new List <float>();

                for (int j = 0; j < renderableComponents[i].Vertices.Length; j++)
                {
                    // XY
                    vertexData.Add(curRend.Vertices[j].X);
                    vertexData.Add(curRend.Vertices[j].Y);

                    // RGBA
                    vertexData.Add(curRend.Colors[j].R);
                    vertexData.Add(curRend.Colors[j].G);
                    vertexData.Add(curRend.Colors[j].B);
                    vertexData.Add(curRend.Colors[j].A);

                    int currentQuad = j / 4;

                    // Tx Ty
                    if (curRend.TextureOffsets != null)
                    {
                        vertexData.Add(curRend.TextureOffsets[currentQuad, j % 4].X);
                        vertexData.Add(curRend.TextureOffsets[currentQuad, j % 4].Y);
                    }
                    else
                    {
                        vertexData.Add(0);
                        vertexData.Add(0);
                    }


                    // Texture id
                    if (curRend.Texture == null || curRend.TextureOffsets[currentQuad, j % 4].X == -1)
                    {
                        vertexData.Add(1024);
                    }
                    else
                    {
                        vertexData.Add(curRend.Texture.Id);
                    }
                }

                vbo.Bind();
                Gl.BufferSubData(BufferTarget.ArrayBuffer, (IntPtr)curRend.BufferOffset, (uint)(curRend.Vertices.Length * vbo.VertexSize), vertexData.ToArray());
                vbo.Unbind();

                curRend.HasChanged = false;
            }
        }
 public void AddRenderable(Renderable r)
 {
     toAdd.Add(r);
 }
Beispiel #14
0
        private static void Draw(ParticleSystem component)
        {
            SceneObject so = component.SceneObject;

            // Draw collision planes, if enabled
            Gizmos.Color = Color.Yellow;
            ParticleEvolver[] evolvers = component.Evolvers;
            foreach (var entry in evolvers)
            {
                if (entry is ParticleCollisions collisions)
                {
                    if (collisions.Options.mode == ParticleCollisionMode.Plane)
                    {
                        void DrawPlane(Vector3 position, Vector3 right, Vector3 up, Vector3 forward)
                        {
                            Vector3 topLeft  = position - right + up;
                            Vector3 topRight = position + right + up;
                            Vector3 botLeft  = position - right - up;
                            Vector3 botRight = position + right - up;

                            Gizmos.DrawLine(topLeft, topRight);
                            Gizmos.DrawLine(topRight, botRight);
                            Gizmos.DrawLine(botRight, botLeft);
                            Gizmos.DrawLine(botLeft, topLeft);

                            Gizmos.DrawLine(position, position + forward * 0.4f);
                        }

                        SceneObject[] planeObjects = collisions.PlaneObjects;
                        foreach (var planeSO in planeObjects)
                        {
                            Vector3 position = planeSO.Position;
                            Vector3 right    = planeSO.Rotation.Rotate(Vector3.XAxis);
                            Vector3 up       = planeSO.Rotation.Rotate(Vector3.YAxis);
                            Vector3 forward  = planeSO.Forward;

                            DrawPlane(position, right, up, forward);
                        }

                        Plane[] planes = collisions.Planes;
                        foreach (var plane in planes)
                        {
                            Vector3 right, up;
                            Vector3.OrthogonalComplement(plane.normal, out right, out up);

                            DrawPlane(plane.normal * plane.d, right, up, plane.normal);
                        }
                    }
                }
            }

            // Draw emitter shapes
            Gizmos.Transform = Matrix4.TRS(so.Position, Quaternion.LookRotation(so.Rotation.Forward, so.Rotation.Up), Vector3.One);
            Gizmos.Color     = Color.Green;

            ParticleEmitter[] emitters = component.Emitters;
            foreach (var entry in emitters)
            {
                ParticleEmitterShape shape = entry?.Shape;
                if (shape == null)
                {
                    continue;
                }

                if (shape is ParticleEmitterBoxShape boxShape)
                {
                    Gizmos.DrawWireCube(Vector3.Zero, boxShape.Options.extents);
                }
                else if (shape is ParticleEmitterSphereShape sphereShape)
                {
                    ParticleSphereShapeOptions options = sphereShape.Options;
                    Gizmos.DrawWireSphere(Vector3.Zero, options.radius);

                    if (options.thickness > 0.0f)
                    {
                        float innerRadius = options.radius * (1.0f - MathEx.Clamp01(options.thickness));
                        if (options.thickness < 1.0f)
                        {
                            Gizmos.Color = Color.Green * new Color(0.5f, 0.5f, 0.5f);
                            Gizmos.DrawWireSphere(Vector3.Zero, innerRadius);
                        }

                        Gizmos.Color = Color.Green * new Color(0.25f, 0.25f, 0.25f);
                        Gizmos.DrawLine(Vector3.XAxis * innerRadius, Vector3.XAxis * options.radius);
                        Gizmos.DrawLine(-Vector3.XAxis * innerRadius, -Vector3.XAxis * options.radius);
                        Gizmos.DrawLine(Vector3.YAxis * innerRadius, Vector3.YAxis * options.radius);
                        Gizmos.DrawLine(-Vector3.YAxis * innerRadius, -Vector3.YAxis * options.radius);
                        Gizmos.DrawLine(Vector3.ZAxis * innerRadius, Vector3.ZAxis * options.radius);
                        Gizmos.DrawLine(-Vector3.ZAxis * innerRadius, -Vector3.ZAxis * options.radius);
                    }
                }
                else if (shape is ParticleEmitterHemisphereShape hemisphereShape)
                {
                    ParticleHemisphereShapeOptions options = hemisphereShape.Options;
                    Gizmos.DrawWireHemisphere(Vector3.Zero, options.radius);
                    DrawArcWithThickness(Vector3.Zero, options.radius, new Degree(360.0f), options.thickness, Color.Green);

                    if (options.thickness > 0.0f)
                    {
                        float innerRadius = options.radius * (1.0f - MathEx.Clamp01(options.thickness));
                        if (options.thickness < 1.0f)
                        {
                            Gizmos.Color = Color.Green * new Color(0.5f, 0.5f, 0.5f);
                            Gizmos.DrawWireHemisphere(Vector3.Zero, innerRadius);
                        }

                        Gizmos.Color = Color.Green * new Color(0.25f, 0.25f, 0.25f);
                        Gizmos.DrawLine(Vector3.XAxis * innerRadius, Vector3.XAxis * options.radius);
                        Gizmos.DrawLine(-Vector3.XAxis * innerRadius, -Vector3.XAxis * options.radius);
                        Gizmos.DrawLine(Vector3.YAxis * innerRadius, Vector3.YAxis * options.radius);
                        Gizmos.DrawLine(-Vector3.YAxis * innerRadius, -Vector3.YAxis * options.radius);
                        Gizmos.DrawLine(Vector3.ZAxis * innerRadius, Vector3.ZAxis * options.radius);
                    }
                }
                else if (shape is ParticleEmitterCircleShape circleShape)
                {
                    ParticleCircleShapeOptions options = circleShape.Options;
                    DrawArcWithThickness(Vector3.Zero, options.radius, options.arc, options.thickness, Color.Green);
                }
                else if (shape is ParticleEmitterLineShape lineShape)
                {
                    float halfLength = lineShape.Options.length * 0.5f;
                    Gizmos.DrawLine(new Vector3(-halfLength, 0.0f, 0.0f), new Vector3(halfLength, 0.0f, 0.0f));
                }
                else if (shape is ParticleEmitterRectShape rectShape)
                {
                    Vector2 extents = rectShape.Options.extents;
                    Vector3 right   = new Vector3(extents.x, 0.0f, 0.0f);
                    Vector3 up      = new Vector3(0.0f, extents.y, 0.0f);

                    Vector3 topLeft  = -right + up;
                    Vector3 topRight = right + up;
                    Vector3 botLeft  = -right - up;
                    Vector3 botRight = right - up;

                    Gizmos.DrawLine(topLeft, topRight);
                    Gizmos.DrawLine(topRight, botRight);
                    Gizmos.DrawLine(botRight, botLeft);
                    Gizmos.DrawLine(botLeft, topLeft);
                }
                else if (shape is ParticleEmitterConeShape coneShape)
                {
                    ParticleConeShapeOptions options = coneShape.Options;

                    float  topRadius  = options.radius;
                    float  baseRadius = options.length * MathEx.Tan(options.angle);
                    Radian arc        = options.arc;

                    if (topRadius > 0.0f)
                    {
                        DrawArcWithThickness(Vector3.Zero, topRadius, arc, options.thickness, Color.Green);
                    }

                    DrawArcWithThickness(new Vector3(0.0f, 0.0f, -options.length), baseRadius, arc, options.thickness,
                                         Color.Green);

                    Gizmos.Color = Color.Green;
                    DrawConeBorder(topRadius, baseRadius, arc, options.length);

                    if (options.thickness > 0.0f && options.thickness < 1.0f)
                    {
                        Gizmos.Color = Color.Green * new Color(0.5f, 0.5f, 0.5f);
                        DrawConeBorder(
                            topRadius * (1.0f - MathEx.Clamp01(options.thickness)),
                            baseRadius * (1.0f - MathEx.Clamp01(options.thickness)), arc, options.length);
                    }
                }
                else if (shape is ParticleEmitterStaticMeshShape staticMeshShape)
                {
                    RRef <Mesh> mesh = staticMeshShape.Options.mesh;
                    if (mesh.IsLoaded)
                    {
                        Gizmos.DrawWireMesh(mesh.Value.MeshData);
                    }
                }
                else if (shape is ParticleEmitterSkinnedMeshShape skinnedMeshShape)
                {
                    Renderable renderable = skinnedMeshShape.Options.renderable;
                    if (renderable != null)
                    {
                        RRef <Mesh> mesh = renderable.Mesh;
                        if (mesh.IsLoaded)
                        {
                            Gizmos.DrawWireMesh(mesh.Value.MeshData);
                        }
                    }
                }
            }

            // Draw manual bounds
            if (!component.Settings.UseAutomaticBounds)
            {
                Gizmos.Color = Color.LightGray;

                AABox bounds = component.Settings.CustomBounds;
                Gizmos.DrawWireCube(bounds.Center, bounds.Size * 0.5f);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            Animation animation = InspectedObject as Animation;

            if (animation == null)
            {
                return;
            }

            animationClipField.OnChanged += x =>
            {
                AnimationClip clip = Resources.Load <AnimationClip>(x.UUID);

                animation.DefaultClip = clip;
                MarkAsModified();
                ConfirmModify();
            };

            wrapModeField.OnSelectionChanged += x =>
            {
                animation.WrapMode = (AnimWrapMode)x;
                MarkAsModified();
                ConfirmModify();
            };

            speedField.OnChanged   += x => { animation.Speed = x; MarkAsModified(); };
            speedField.OnConfirmed += ConfirmModify;
            speedField.OnFocusLost += ConfirmModify;

            cullingField.OnChanged        += x => { animation.Cull = x; MarkAsModified(); ConfirmModify(); };
            overrideBoundsField.OnChanged += x => { animation.UseBounds = x; MarkAsModified(); ConfirmModify(); };
            centerField.OnChanged         += x =>
            {
                AABox   bounds = animation.Bounds;
                Vector3 min    = x - bounds.Size * 0.5f;
                Vector3 max    = x + bounds.Size * 0.5f;

                animation.Bounds = new AABox(min, max);
                MarkAsModified();
            };
            centerField.OnConfirmed += ConfirmModify;
            centerField.OnFocusLost += ConfirmModify;

            sizeField.OnChanged += x =>
            {
                AABox   bounds = animation.Bounds;
                Vector3 min    = bounds.Center - x * 0.5f;
                Vector3 max    = bounds.Center + x * 0.5f;

                animation.Bounds = new AABox(min, max);
                MarkAsModified();
            };
            sizeField.OnConfirmed += ConfirmModify;
            sizeField.OnFocusLost += ConfirmModify;

            Layout.AddElement(animationClipField);
            Layout.AddElement(wrapModeField);
            Layout.AddElement(speedField);
            Layout.AddElement(cullingField);
            Layout.AddElement(overrideBoundsField);

            GUILayoutX boundsLayout = Layout.AddLayoutX();

            boundsLayout.AddElement(new GUILabel(new LocEdString("Bounds"), GUIOption.FixedWidth(100)));

            GUILayoutY boundsContent = boundsLayout.AddLayoutY();

            boundsContent.AddElement(centerField);
            boundsContent.AddElement(sizeField);

            // Morph shapes
            Renderable  renderable  = animation.SceneObject.GetComponent <Renderable>();
            MorphShapes morphShapes = renderable?.Mesh?.MorphShapes;

            if (morphShapes != null)
            {
                GUIToggle morphShapesToggle = new GUIToggle(new LocEdString("Morph shapes"), EditorStyles.Foldout);

                Layout.AddElement(morphShapesToggle);
                GUILayoutY channelsLayout = Layout.AddLayoutY();

                morphShapesToggle.OnToggled += x =>
                {
                    channelsLayout.Active = x;
                    Persistent.SetBool("Channels_Expanded", x);
                };

                channelsLayout.Active = Persistent.GetBool("Channels_Expanded");

                MorphChannel[] channels = morphShapes.Channels;
                for (int i = 0; i < channels.Length; i++)
                {
                    GUILayoutY channelLayout = channelsLayout.AddLayoutY();

                    GUILayoutX channelTitleLayout = channelLayout.AddLayoutX();
                    channelLayout.AddSpace(5);
                    GUILayoutY channelContentLayout = channelLayout.AddLayoutY();

                    string    channelName      = channels[i].Name;
                    GUIToggle channelNameField = new GUIToggle(channelName, EditorStyles.Expand, GUIOption.FlexibleWidth());

                    channelTitleLayout.AddSpace(15); // Indent
                    channelTitleLayout.AddElement(channelNameField);
                    channelTitleLayout.AddFlexibleSpace();

                    channelNameField.OnToggled += x =>
                    {
                        channelContentLayout.Active = x;

                        Persistent.SetBool(channelName + "_Expanded", x);
                    };

                    channelContentLayout.Active = Persistent.GetBool(channelName + "_Expanded");

                    MorphShape[] shapes = channels[i].Shapes;
                    for (int j = 0; j < shapes.Length; j++)
                    {
                        GUILayoutX shapeLayout = channelContentLayout.AddLayoutX();
                        channelContentLayout.AddSpace(5);

                        LocString nameString = new LocString("[{0}]. {1}");
                        nameString.SetParameter(0, j.ToString());
                        nameString.SetParameter(1, shapes[j].Name);
                        GUILabel shapeNameField = new GUILabel(shapes[j].Name);

                        LocString weightString = new LocEdString("Weight: {0}");
                        weightString.SetParameter(0, shapes[j].Weight.ToString());
                        GUILabel weightField = new GUILabel(weightString);

                        shapeLayout.AddSpace(30); // Indent
                        shapeLayout.AddElement(shapeNameField);
                        shapeLayout.AddFlexibleSpace();
                        shapeLayout.AddElement(weightField);
                    }
                }
            }
        }
Beispiel #16
0
 public virtual bool Trace(ArrayList objects)
 {
     IEnumerator objList = objects.GetEnumerator();
     t = MAX_T;
     @object = null;
     while (objList.MoveNext())
     {
         Renderable @object2 = (Renderable)objList.Current;
         @object2.Intersect(this);
     }
     return (@object != null);
 }
Beispiel #17
0
        public void init(ShaderProgram program, Renderable renderable)
        {
            if (locations != null)
            {
                throw new Exception("Already initialized");
            }
            if (!program.isCompiled_())
            {
                throw new Exception(program.getLog());
            }
            this.program = program;

            int n = uniforms.Count;

            locations = new int[n];
            for (int i = 0; i < n; i++)
            {
                string    input     = uniforms[i];
                Validator validator = validators[i];
                Setter    setter    = setters[i];
                if (validator != null && !validator.validate(this, i, renderable))
                {
                    locations[i] = -1;
                }
                else
                {
                    locations[i] = program.fetchUniformLocation(input, false);
                    if (locations[i] >= 0 && setter != null)
                    {
                        if (setter.isGlobal(this, i))
                        {
                            globalUniforms.Add(i);
                        }
                        else
                        {
                            localUniforms.Add(i);
                        }
                    }
                }

                if (locations[i] < 0)
                {
                    validators[i] = null;
                    setters[i]    = null;
                }
            }

            if (renderable != null)
            {
                VertexAttributes attrs = renderable.meshPart.mesh.getVertexAttributes();
                int c = attrs.size();
                for (int i = 0; i < c; i++)
                {
                    VertexAttribute attr     = attrs[i];
                    int             location = program.getAttributeLocation(attr.alias);
                    if (location >= 0)
                    {
                        attributes.Add(attr.getKey(), location);
                    }
                }
            }
        }
Beispiel #18
0
 public abstract void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes);
Beispiel #19
0
        public override void EventFired(object sender, Event e)
        {
            if (e is ActivationEvent ae0 && ae0.Affected.GetComponent <BossProjectile>() is BossProjectile projectile)
            {
                if (!projectile.Deflected)
                {
                    LevelRenderable lr = projectile.Owner.GetComponent <LevelRenderable>();
                    if (lr != null)
                    {
                        lr.ZOrder = 4;
                    }
                }
                projectile.Deflected = true;
            }
            if ((e is ActivationEvent ae && ae.Affected.HasComponent <Boss>()) || (e is SoftCollisionEvent ce && ce.Sender.Owner.HasComponent <BossProjectile>() && ce.Victim.HasComponent <BossProjectileCatcher>()))
            {
                Boss boss = (e as ActivationEvent)?.Affected.GetComponent <Boss>() ?? Owner.Entities[(e as SoftCollisionEvent).Victim.GetComponent <BossProjectileCatcher>()?.BossId ?? 0].GetComponent <Boss>();
                if (boss == null)
                {
                    return;
                }
                if (e is SoftCollisionEvent sce)
                {
                    if (!sce.Sender.Owner.GetComponent <BossProjectile>().Deflected)
                    {
                        return;
                    }
                    sce.Sender.Owner.Remove();
                }
                int damage = e is SoftCollisionEvent ? 4 : 1;
                if (boss.Health >= 1)
                {
                    Owner.Events.InvokeEvent(new CameraShakeEvent(boss, 16));
                    boss.Health -= damage;
                    if (boss.Health == 20)
                    {
                        Owner.Events.InvokeEvent(new CameraShakeEvent(boss, 16));
                        Renderable renderable = boss.Owner.GetComponent <Renderable>();
                        if (renderable != null && renderable.Sprites.Count > 0)
                        {
                            renderable.Sprites[0].Source.Y = 160;
                        }
                        Entity hit = boss.GlassHitEntity != 0 ? Owner.Entities[boss.GlassHitEntity] : null;
                        if (hit != null)
                        {
                            hit.Active = false;
                        }
                        Entity hit2 = boss.BareHeadEntity != 0 ? Owner.Entities[boss.BareHeadEntity] : null;
                        if (hit2 != null)
                        {
                            hit2.Active = true;
                        }
                    }

                    if (boss.Health <= 0)
                    {
                        KillBoss(boss);
                    }
                }
            }
            if (e is ActivationEvent ae2 && ae2.Affected.HasComponent <GameEnd>())
            {
                Woofer.Controller.AudioUnit["pulse_high"].Play();
                Woofer.Controller.AudioUnit["pulse_high"].Play();
                Woofer.Controller.AudioUnit["pulse_high"].Play();
                Owner.QueueAction(() => Owner.Controller.CommandFired(new InternalSceneChangeCommand(new EndScene())));
            }
        }
Beispiel #20
0
 public abstract bool canRender(Renderable instance);
        private static List <Renderable> ReadUsage(Dictionary <string, AnimationDef> animDefs, Dictionary <string, CharSet> charsets, Dictionary <string, TextDef> textDefs, Dictionary <string, UsageGroup> groupDefs, XmlNode time, TimeBlock parent)
        {
            List <Renderable> objects = new List <Renderable>();

            for (int i = 0; i < time.ChildNodes.Count; i++)
            {
                XmlNode use = time.ChildNodes[i];

                if (use.Name.ToLower() == "useanim")
                {
                    //AnimationDef aDef = (from ad in animDefs
                    //                     where ad.Name == use.Attributes["name"].Value
                    //                     select ad).ToList()[0];

                    Animation a = new Animation(parent, animDefs[use.Attributes["name"].Value])
                    {
                        X = int.Parse(use.Attributes["x"].Value),
                        Y = int.Parse(use.Attributes["y"].Value)
                    };
                    ReadRenderableParams(i, use, a);

                    // read animation attributes
                    a.Attributes = ReadUsageAttributes(use);

                    objects.Add(a);
                }
                else if (use.Name.ToLower() == "usetext")
                {
                    //TextDef tDef = (from t in textDefs
                    //                where t.Name == use.Attributes["name"].Value
                    //                select t).ToList()[0];

                    TextDef tdef;
                    if (use.Attributes["text"] != null && use.Attributes["charset"] != null)
                    {
                        tdef = new TextDef()
                        {
                            CharacterSet = charsets[use.Attributes["charset"].Value],
                            Value        = use.Attributes["text"].Value
                        };
                    }
                    else
                    {
                        tdef = textDefs[use.Attributes["name"].Value];
                    }

                    Text txt = new Text(parent, tdef)
                    {
                        X = int.Parse(use.Attributes["x"].Value),
                        Y = int.Parse(use.Attributes["y"].Value),
                    };
                    ReadRenderableParams(i, use, txt);

                    // read text attributes
                    txt.Attributes = ReadUsageAttributes(use);

                    objects.Add(txt);
                }
                else if (use.Name.ToLower() == "usegroup")
                {
                    UsageGroup g = groupDefs[use.Attributes["name"].Value];
                    foreach (Renderable o in g.Objects)
                    {
                        Renderable oClone = o.Clone();
                        oClone.ParentBlock = parent;
                        objects.Add(oClone);
                    }
                }
            }
            return(objects);
        }
Beispiel #22
0
        public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r)
        {
            foreach (PlayerAnimation player in WatchedComponents)
            {
                Renderable renderable = player.Owner.Components.Get <Renderable>();

                Vector2D[] srcOffsets = new Vector2D[5];
                srcOffsets[Legs]   = new Vector2D(0, Origins[Legs]);
                srcOffsets[Torso]  = new Vector2D(0, Origins[Torso]);
                srcOffsets[Head]   = new Vector2D(0, Origins[Head]);
                srcOffsets[Woofer] = new Vector2D(0, Origins[Woofer]);
                srcOffsets[Arms]   = new Vector2D(0, Origins[Arms]);

                Vector2D[] destOffsets = new Vector2D[5];
                destOffsets[Legs] = destOffsets[Torso] = destOffsets[Head] = destOffsets[Woofer] = destOffsets[Arms] = Vector2D.Empty;

                if (!player.Initialized)
                {
                    renderable.Sprites = new List <Sprite>()
                    {
                        new Sprite(player.SpritesheetName, Destination, new Rectangle(srcOffsets[Legs], 32, 32)),
                        new Sprite(player.SpritesheetName, Destination, new Rectangle(srcOffsets[Torso], 32, 32)),
                        new Sprite(player.SpritesheetName, Destination, new Rectangle(srcOffsets[Head], 32, 32)),
                        new Sprite("woofer", Destination, new Rectangle(srcOffsets[Woofer], 0, 0)),
                        new Sprite(player.SpritesheetName, Destination, new Rectangle(srcOffsets[Arms], 32, 32))
                    };
                    player.Initialized = true;
                }


                Physical physical = player.Owner.Components.Get <Physical>();
                PlayerMovementComponent movement    = player.Owner.Components.Get <PlayerMovementComponent>();
                PlayerOrientation       orientation = player.Owner.Components.Get <PlayerOrientation>();
                if (physical == null || movement == null || orientation == null)
                {
                    continue;
                }
                PulseAbility pulse = player.Owner.Components.Get <PulseAbility>();

                bool handsFree = pulse == null;

                if (orientation.Unit.X > 0 || player.LastLookedRight)
                {
                    for (int i = Legs; i <= Arms; i++)
                    {
                        srcOffsets[i] += OrientationOffset;
                    }
                }

                bool forceLook = handsFree && !movement.OnGround;

                if (orientation.Unit.Y >= Math.Sin(Math.PI / 9))
                {
                    if (!forceLook)
                    {
                        srcOffsets[Head].X += 32;
                    }
                    srcOffsets[Woofer].X += 32;
                    if (!handsFree)
                    {
                        srcOffsets[Arms].X += 32;
                    }
                    if (orientation.Unit.Y >= Math.Sin(2 * Math.PI / 6))
                    {
                        srcOffsets[Woofer].X += 32;
                        if (!handsFree)
                        {
                            srcOffsets[Arms].X += 32;
                        }
                    }
                }
                else if (orientation.Unit.Y <= Math.Sin(-Math.PI / 9))
                {
                    if (!forceLook)
                    {
                        srcOffsets[Head].X += 64;
                    }
                    srcOffsets[Woofer].X += 96;
                    if (!handsFree)
                    {
                        srcOffsets[Arms].X += 96;
                    }
                    if (orientation.Unit.Y <= Math.Sin(-2 * Math.PI / 6))
                    {
                        srcOffsets[Woofer].X += 32;
                        destOffsets[Woofer]  += new Vector2D(0, -3); //Offset woofer down since it goes out of the spritesheet grid
                        if (!handsFree)
                        {
                            srcOffsets[Arms].X += 32;
                        }
                    }
                }

                if (forceLook)
                {
                    srcOffsets[Head].X += physical.Velocity.Y <= 0 ? 64 : 32;
                }

                if (orientation.Unit.X != 0)
                {
                    player.LastLookedRight = orientation.Unit.X > 0;
                }

                if (pulse != null)
                {
                    srcOffsets[Woofer].Y  = 256;
                    srcOffsets[Woofer].Y -= 32 * Math.Round(pulse.EnergyMeter / 20);
                    if (pulse.EnergyMeter == 0 && player.WooferBlinkingTime >= 0.375)
                    {
                        srcOffsets[Woofer].Y += 32;
                    }
                }

                if (handsFree)
                {
                    srcOffsets[Arms].Y += 32;
                }

                if (!movement.OnGround || Math.Abs(physical.Velocity.X) <= 1e-2) /*player.WalkAnimationProgress = 0;*/ } {
Beispiel #23
0
 protected override void DefineLocation(VertexDefinition definition, Renderable target, Type vertexType)
 {
     definition.Map(vertexType, "vPos", VertexSpecialField.Position);
     definition.Map(vertexType, "vUV", VertexSpecialField.UV);
 }
Beispiel #24
0
 private void LoadConfigPanel(object sender, EventArgs e)
 {
     actualPage = new ConfigPanel();
     ((ConfigPanel)actualPage).LoadMainMenu += LoadMainMenu;
     content.Navigate(actualPage);
 }
Beispiel #25
0
 public override void set(BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes)
 {
     cb?.Invoke(shader, inputID, renderable, combinedAttributes);
 }
Beispiel #26
0
 public abstract void remove(Renderable r);
Beispiel #27
0
 protected abstract void DefineLocation(VertexDefinition definition, Renderable target, Type vertexType);
Beispiel #28
0
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            Renderable renderable = InspectedObject as Renderable;

            if (renderable == null)
            {
                return(InspectableState.NotModified);
            }

            bool rebuildMaterialsGUI = false;

            RRef <Material>[] newMaterials = renderable.Materials;
            if (newMaterials == null)
            {
                rebuildMaterialsGUI = materials != null;
            }
            else
            {
                if (materials == null)
                {
                    rebuildMaterialsGUI = true;
                }
                else
                {
                    if (materials.Length != newMaterials.Length)
                    {
                        rebuildMaterialsGUI = true;
                    }
                    else
                    {
                        for (int i = 0; i < materials.Length; i++)
                        {
                            if (materials[i] != newMaterials[i])
                            {
                                rebuildMaterialsGUI = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (rebuildMaterialsGUI)
            {
                BuildMaterialsGUI();
            }

            meshField.ValueRef = renderable.Mesh;

            if (layersValue != renderable.Layers)
            {
                bool[] states = new bool[64];
                for (int i = 0; i < states.Length; i++)
                {
                    states[i] = (renderable.Layers & Layers.Values[i]) == Layers.Values[i];
                }

                layersField.States = states;
                layersValue        = renderable.Layers;
            }

            InspectableState materialsModified = materialsField.Refresh();

            if (materialsModified == InspectableState.Modified)
            {
                renderable.Materials = materials;
            }

            modifyState |= materialsModified;

            if (materials != null)
            {
                for (int i = 0; i < materialParams.Count; i++)
                {
                    Material material = materials[i].Value;
                    if (material != null && materialParams[i] != null)
                    {
                        foreach (var param in materialParams[i])
                        {
                            param.Refresh(material);
                        }
                    }
                }
            }

            InspectableState oldState = modifyState;

            if (modifyState.HasFlag(InspectableState.Modified))
            {
                modifyState = InspectableState.NotModified;
            }

            return(oldState);
        }
Beispiel #29
0
 protected abstract void OnRendering(ShaderDataDispatcher dispatcher, Renderable target, in Matrix4 model, in Matrix4 view, in Matrix4 projection);
Beispiel #30
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderable obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #31
0
 public abstract void add(Renderable r);
 public void RemoveRenderable(Renderable r)
 {
     toRemove.Add(r);
 }
Beispiel #33
0
        /// <inheritdoc />
        public override void Process(Entity entity)
        {
            LoadEmptyTileset();

            Renderable renderable = entity.GetComponent <Renderable>();
            Map        map        = entity.GetComponent <Map>();

            int tileWidth  = _engineService.TileWidth;
            int tileHeight = _engineService.TileHeight;

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = map.Height - 1; y >= 0; y--)
                {
                    Vector2 screenPosition = _isoMathService.MapTileToScreenPosition(x, y);

                    Vector2 position = new Vector2(
                        screenPosition.X,
                        screenPosition.Y);

                    Tile      tile          = map.Tiles[x, y];
                    int       sourceX       = 0;
                    int       sourceY       = 0;
                    Texture2D renderTexture = _emptyCell;

                    if (tile != null)
                    {
                        sourceX       = tileWidth * tile.SourceX;
                        sourceY       = tileHeight * tile.SourceY;
                        renderTexture = renderable.Texture;
                    }

                    Rectangle source = new Rectangle(
                        sourceX,
                        sourceY,
                        tileWidth,
                        tileHeight);

                    _spriteBatch.Draw(
                        renderTexture,
                        position,
                        source,
                        Color.White,
                        0.0f,
                        _origin,
                        1.0f,
                        SpriteEffects.None,
                        0.0f);
                }
            }

            // Move camera to focus more on the area for the first run time.
            if (!_renderedOnce)
            {
                _camera.Position = new Vector2(
                    _camera.Position.X - _camera.BoundingRectangle.Width / 2.0f,
                    _camera.Position.Y - 50
                    );
            }

            _renderedOnce = true;
        }
Beispiel #34
0
        private void OnEditorUpdate()
        {
            if (HasFocus)
            {
                if (!Input.IsPointerButtonHeld(PointerButton.Right))
                {
                    if (VirtualInput.IsButtonDown(EditorApplication.DuplicateKey))
                    {
                        DuplicateSelection();
                    }
                    else if (VirtualInput.IsButtonDown(EditorApplication.DeleteKey))
                    {
                        DeleteSelection();
                    }
                    else if (VirtualInput.IsButtonDown(toggleProfilerOverlayKey))
                    {
                        EditorSettings.SetBool(ProfilerOverlayActiveKey, !EditorSettings.GetBool(ProfilerOverlayActiveKey));
                    }
                    else if (VirtualInput.IsButtonDown(viewToolKey))
                    {
                        EditorApplication.ActiveSceneTool = SceneViewTool.View;
                    }
                    else if (VirtualInput.IsButtonDown(moveToolKey))
                    {
                        EditorApplication.ActiveSceneTool = SceneViewTool.Move;
                    }
                    else if (VirtualInput.IsButtonDown(rotateToolKey))
                    {
                        EditorApplication.ActiveSceneTool = SceneViewTool.Rotate;
                    }
                    else if (VirtualInput.IsButtonDown(scaleToolKey))
                    {
                        EditorApplication.ActiveSceneTool = SceneViewTool.Scale;
                    }
                }
            }

            // Refresh GUI buttons if needed (in case someones changes the values from script)
            if (editorSettingsHash != EditorSettings.Hash)
            {
                UpdateButtonStates();
                UpdateProfilerOverlay();
                editorSettingsHash = EditorSettings.Hash;
            }

            // Update scene view handles and selection
            sceneGizmos.Draw();
            sceneGrid.Draw();

            bool handleActive = sceneHandles.IsActive() || sceneAxesGUI.IsActive();

            Vector2I scenePos;
            bool     inBounds   = ScreenToScenePos(Input.PointerPosition, out scenePos);
            bool     dragResult = false;

            if (Input.IsPointerButtonUp(PointerButton.Left))
            {
                dragResult = EndDragSelection();
                if (sceneHandles.IsActive())
                {
                    sceneHandles.ClearSelection();
                }

                if (sceneAxesGUI.IsActive())
                {
                    sceneAxesGUI.ClearSelection();
                }
            }
            else if (Input.IsPointerButtonDown(PointerButton.Left))
            {
                mouseDownPosition = scenePos;
            }

            bool draggedOver = DragDrop.DragInProgress || DragDrop.DropInProgress;

            draggedOver &= IsPointerHovering && inBounds && DragDrop.Type == DragDropType.Resource;

            if (draggedOver)
            {
                if (DragDrop.DropInProgress)
                {
                    dragActive = false;
                    if (draggedSO != null)
                    {
                        Selection.SceneObject = draggedSO;
                        EditorApplication.SetSceneDirty();
                    }

                    draggedSO = null;
                }
                else
                {
                    if (!dragActive)
                    {
                        dragActive = true;

                        ResourceDragDropData dragData = (ResourceDragDropData)DragDrop.Data;

                        string[] draggedPaths = dragData.Paths;

                        for (int i = 0; i < draggedPaths.Length; i++)
                        {
                            ResourceMeta meta = ProjectLibrary.GetMeta(draggedPaths[i]);
                            if (meta != null)
                            {
                                if (meta.ResType == ResourceType.Mesh)
                                {
                                    if (!string.IsNullOrEmpty(draggedPaths[i]))
                                    {
                                        string meshName = Path.GetFileNameWithoutExtension(draggedPaths[i]);
                                        draggedSO = UndoRedo.CreateSO(meshName, "Created a new Renderable \"" + meshName + "\"");
                                        Mesh mesh = ProjectLibrary.Load <Mesh>(draggedPaths[i]);

                                        Renderable renderable = draggedSO.AddComponent <Renderable>();
                                        renderable.Mesh = mesh;
                                        if (mesh != null)
                                        {
                                            draggedSOOffset = mesh.Bounds.Box.Center;
                                        }
                                        else
                                        {
                                            draggedSOOffset = Vector3.Zero;
                                        }
                                    }

                                    break;
                                }
                                else if (meta.ResType == ResourceType.Prefab)
                                {
                                    if (!string.IsNullOrEmpty(draggedPaths[i]))
                                    {
                                        Prefab prefab = ProjectLibrary.Load <Prefab>(draggedPaths[i]);
                                        draggedSO = UndoRedo.Instantiate(prefab, "Instantiating " + prefab.Name);

                                        if (draggedSO != null)
                                        {
                                            AABox draggedObjBounds = EditorUtility.CalculateBounds(draggedSO);
                                            draggedSOOffset = draggedObjBounds.Center;
                                        }
                                        else
                                        {
                                            draggedSOOffset = Vector3.Zero;
                                        }
                                    }

                                    break;
                                }
                            }
                        }
                    }

                    if (draggedSO != null)
                    {
                        if (Input.IsButtonHeld(ButtonCode.Space))
                        {
                            SnapData snapData;
                            sceneSelection.Snap(scenePos, out snapData, new SceneObject[] { draggedSO });

                            Quaternion q = Quaternion.FromToRotation(Vector3.YAxis, snapData.normal);
                            draggedSO.Position = snapData.position;
                            draggedSO.Rotation = q;
                        }
                        else
                        {
                            Ray worldRay = camera.ViewportToWorldRay(scenePos);
                            draggedSO.Position = worldRay * DefaultPlacementDepth - draggedSOOffset;
                        }
                    }
                }

                return;
            }
            else
            {
                if (dragActive)
                {
                    dragActive = false;

                    if (draggedSO != null)
                    {
                        draggedSO.Destroy();
                        draggedSO = null;
                    }
                }
            }

            if (HasContentFocus || IsPointerHovering)
            {
                cameraController.EnableInput(true);

                if (inBounds && HasContentFocus)
                {
                    if (Input.IsPointerButtonDown(PointerButton.Left))
                    {
                        Rect2I sceneAxesGUIBounds = new Rect2I(Width - HandleAxesGUISize - HandleAxesGUIPaddingX,
                                                               HandleAxesGUIPaddingY, HandleAxesGUISize, HandleAxesGUISize);

                        if (sceneAxesGUIBounds.Contains(scenePos))
                        {
                            sceneAxesGUI.TrySelect(scenePos);
                        }
                        else
                        {
                            sceneHandles.TrySelect(scenePos);
                        }
                    }
                    else if (Input.IsPointerButtonHeld(PointerButton.Left) && !handleActive && !dragActive &&
                             draggedSO == null && scenePos != mouseDownPosition)
                    {
                        if (isDraggingSelection)
                        {
                            UpdateDragSelection(scenePos);
                        }
                        else
                        {
                            StartDragSelection(scenePos);
                        }
                    }
                    else if (Input.IsPointerButtonUp(PointerButton.Left))
                    {
                        if (!handleActive && !dragActive && !dragResult)
                        {
                            bool ctrlHeld = Input.IsButtonHeld(ButtonCode.LeftControl) ||
                                            Input.IsButtonHeld(ButtonCode.RightControl);

                            sceneSelection.PickObject(scenePos, ctrlHeld, new SceneObject[] { draggedSO });
                        }
                    }
                }
            }
            else
            {
                cameraController.EnableInput(false);
            }

            SceneHandles.BeginInput();
            sceneHandles.UpdateInput(scenePos, Input.PointerDelta);
            sceneHandles.Draw();

            sceneAxesGUI.UpdateInput(scenePos);
            sceneAxesGUI.Draw();
            SceneHandles.EndInput();

            sceneSelection.Draw();

            UpdateGridMode();

            if (VirtualInput.IsButtonDown(frameKey))
            {
                cameraController.FrameSelected();
            }
        }
        public virtual Technique handleSchemeNotFound(ushort schemeIndex, string schemeName, Material originalMaterial, ushort lodIndex, Renderable rend)
        {
            global::System.IntPtr cPtr = OgrePINVOKE.MaterialManager_Listener_handleSchemeNotFound(swigCPtr, schemeIndex, schemeName, Material.getCPtr(originalMaterial), lodIndex, Renderable.getCPtr(rend));
            Technique             ret  = (cPtr == global::System.IntPtr.Zero) ? null : new Technique(cPtr, false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #36
0
 /**
  * Adds a drawable to the fragment.
  *
  * @param d
  *      Drawable to add
  */
 public void addDrawable(Renderable d)
 {
     drawables.Add(d);
 }
Beispiel #37
0
 public void Add(Renderable renderable)
 {
     visibles.Add(renderable);
 }
Beispiel #38
0
 public GraphShape(Renderable shp) => Shape = shp;
Beispiel #39
0
 public void Remove(Renderable renderable)
 {
     visibles.Remove(renderable);
 }
Beispiel #40
0
 public void RemoveRenderable(Renderable renderable)
 {
     renderables.Add(renderable);
 }
Beispiel #41
0
		/// <summary>
		/// Marks the event as handled.
		/// </summary>
		/// <param name="handler">The object responsible for handling the event.</param>
		public void Handle(Renderable handler)
		{
			IsHandled = true;
			LastHandler = handler;
		}
        public static IMoveable playerDTOToMoveable(PlayerDTO dto, Color borderColor)
        {
            IRenderable renderable = new Renderable(borderColor, dto.FillColor, 1, dto.Width, dto.Height, dto.Vertices);

            return(playerDTOToMoveable(dto, renderable));
        }
Beispiel #43
0
 public abstract void addCamera(Renderable r);
Beispiel #44
0
        public void Insert(Renderable obj)
        {
            if(!matrices.TryGetValue(obj.Material, out matrix))
            {
                matrix = new List<Matrix4>();
                matrices.Add(obj.Material, matrix);

                if(!mbo.ContainsKey(obj.Material))
                    mbo.Add(obj.Material, GL.GenBuffer());
            }

            matrix.Add(obj.Transform.Matrix);
            Count++;
        }
Beispiel #45
0
 public override void UpdateDrawCallBatches()
 {
     Renderable.EnqueueDrawCalls(_drawCallBatch);
     _drawCallBatch.FinalizeFrame();
 }