/// <summary> /// Should always be created through Backend.CreateSpriteBatch /// </summary> internal SpriteBatch(Backend backend, Renderer.RenderSystem renderSystem, Common.ResourceManager resourceManager) { if (backend == null) throw new ArgumentNullException("backend"); if (renderSystem == null) throw new ArgumentNullException("renderSystem"); if (resourceManager == null) throw new ArgumentNullException("resourceManager"); Backend = backend; Buffer = new BatchBuffer(renderSystem, new Renderer.VertexFormat(new Renderer.VertexFormatElement[] { new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Position, Renderer.VertexPointerType.Float, 3, 0), new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.TexCoord, Renderer.VertexPointerType.Float, 2, sizeof(float) * 3), new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Color, Renderer.VertexPointerType.Float, 4, sizeof(float) * 5), }), 32); Shader = resourceManager.Load<Resources.ShaderProgram>("/shaders/sprite"); ShaderSRGB = resourceManager.Load<Resources.ShaderProgram>("/shaders/sprite", "SRGB"); Quads = new List<QuadInfo>(); for (var i = 0; i < 32; i++) { Quads.Add(new QuadInfo()); } RenderStateAlphaBlend = Backend.CreateRenderState(true, false, false, Renderer.BlendingFactorSrc.SrcAlpha, Renderer.BlendingFactorDest.OneMinusSrcAlpha, Renderer.CullFaceMode.Front); RenderStateNoAlphaBlend = Backend.CreateRenderState(false, false, false, Renderer.BlendingFactorSrc.Zero, Renderer.BlendingFactorDest.One, Renderer.CullFaceMode.Front); }
public World(Backend backend, ResourceManager resourceManager) { var collisionSystem = new Jitter.Collision.CollisionSystemPersistentSAP(); PhysicsWorld = new Jitter.World(collisionSystem); DebugDrawer = new DebugDrawer(backend, resourceManager); }
public DebugDrawer(Backend backend, ResourceManager resourceManager) { if (backend == null) throw new ArgumentNullException("backend"); Backend = backend; Batch = Backend.CreateBatchBuffer(new Renderer.VertexFormat(new Renderer.VertexFormatElement[] { new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Position, Renderer.VertexPointerType.Float, 3, 0), new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Color, Renderer.VertexPointerType.Float, 3, sizeof(float) * 3), new Renderer.VertexFormatElement(Renderer.VertexFormatSemantic.Normal, Renderer.VertexPointerType.Float, 3, sizeof(float) * 6), })); Batch.Begin(); Shader = resourceManager.Load<Graphics.Resources.ShaderProgram>("/shaders/physic_debug_drawer"); RenderStateId = backend.CreateRenderState(false, true, true, BlendingFactorSrc.One, BlendingFactorDest.One); }
public void EndInline(Backend backend) { backend.UpdateMeshInline(MeshHandle, IndexCount / 3, DataCount, IndexCount, VertexData, IndexData, true); }