public void Attach_test() { Attachment attachment = new Attachment(); attachment.Attach(GameObject.CreatePrimitive(PrimitiveType.Cube).transform, GetEquipmentFixture()); Assert.That(attachment.IsAttached); }
public void Detach_test() { Attachment attachment = new Attachment(); attachment.Attach(GameObject.CreatePrimitive(PrimitiveType.Cube).transform, GetEquipmentFixture()); Equipment equipment = attachment.Detach(); Assert.That(equipment != null); Assert.That(equipment.Amount == 1); Assert.That(equipment.EquipmentData.ID == "leather_boots"); Assert.That(!attachment.IsAttached); }
/// <summary> /// Bind this GraphicsSurface for drawing. /// </summary> /// <param name="ctx"> /// A <see cref="GraphicsContext"/> to wich associate its rendering result to this GraphicsSurface. /// </param> public override void BindDraw(GraphicsContext ctx) { // Bind this framebuffer Gl.BindFramebuffer(FramebufferTarget.DrawFramebuffer, ObjectName); List <int> drawBuffers = new List <int>(); for (uint i = 0; i < Gl.CurrentLimits.MaxColorAttachments; i++) { // Reset dirty binding points if ((_ColorBuffers[i] != null) && _ColorBuffers[i].Dirty) { // Ensure created buffer _ColorBuffers[i].Create(ctx); // Ensure attached buffer _ColorBuffers[i].Attach(FramebufferTarget.DrawFramebuffer, FramebufferAttachment.ColorAttachment0 + (int)i); _ColorBuffers[i].Dirty = false; } // Collect draw buffers if (_ColorBuffers[i] != null) { drawBuffers.Add(Gl.COLOR_ATTACHMENT0 + (int)i); } } if (_DepthAttachment != null && _DepthAttachment.Dirty) { // Ensure created buffer _DepthAttachment.Create(ctx); // Ensure attached buffer _DepthAttachment.Attach(FramebufferTarget.DrawFramebuffer, FramebufferAttachment.DepthAttachment); _DepthAttachment.Dirty = false; } // Validate completeness status Validate(ctx); // Update draw buffers Gl.DrawBuffers(drawBuffers.ToArray()); }