public ClientCharacter(Guid id, Implementations.SSBBRenderPipeline pipeline, Vector2 position, Vector2 dimensions, Texture texture, Shader shader) : base(position, ComponentReplicator.PeerType.PT_Remote) { SetId(id); m_visual = new TexturedQuad(dimensions, texture, shader); pipeline.AddRenderable(m_visual, Implementations.SSBBRenderPipeline.LayerIdentifiers.LI_Characters, 0); }
public ModelBox(ModelRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) { PosX1 = par4; PosY1 = par5; PosZ1 = par6; PosX2 = par4 + (float)par7; PosY2 = par5 + (float)par8; PosZ2 = par6 + (float)par9; VertexPositions = new PositionTextureVertex[8]; QuadList = new TexturedQuad[6]; float f = par4 + (float)par7; float f1 = par5 + (float)par8; float f2 = par6 + (float)par9; par4 -= par10; par5 -= par10; par6 -= par10; f += par10; f1 += par10; f2 += par10; if (par1ModelRenderer.Mirror) { float f3 = f; f = par4; par4 = f3; } PositionTextureVertex positiontexturevertex = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F); PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f, par5, par6, 0.0F, 8F); PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f, f1, par6, 8F, 8F); PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(par4, f1, par6, 8F, 0.0F); PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(par4, par5, f2, 0.0F, 0.0F); PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f, par5, f2, 0.0F, 8F); PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f, f1, f2, 8F, 8F); PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(par4, f1, f2, 8F, 0.0F); VertexPositions[0] = positiontexturevertex; VertexPositions[1] = positiontexturevertex1; VertexPositions[2] = positiontexturevertex2; VertexPositions[3] = positiontexturevertex3; VertexPositions[4] = positiontexturevertex4; VertexPositions[5] = positiontexturevertex5; VertexPositions[6] = positiontexturevertex6; VertexPositions[7] = positiontexturevertex7; QuadList[0] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6 }, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.TextureWidth, par1ModelRenderer.TextureHeight); QuadList[1] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3 }, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.TextureWidth, par1ModelRenderer.TextureHeight); QuadList[2] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.TextureWidth, par1ModelRenderer.TextureHeight); QuadList[3] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6 }, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.TextureWidth, par1ModelRenderer.TextureHeight); QuadList[4] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2 }, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.TextureWidth, par1ModelRenderer.TextureHeight); QuadList[5] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7 }, par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.TextureWidth, par1ModelRenderer.TextureHeight); if (par1ModelRenderer.Mirror) { for (int i = 0; i < QuadList.Length; i++) { QuadList[i].FlipFace(); } } }
void i_createDirtPatch(Vector2 position, Vector2 dimensions) { var dirtPatch = new TexturedQuad(dimensions, m_clientControllers.GetTextureManager().GetOrCreateTexture("dirt", "Textures/dirt.jpg"), m_clientControllers.GetShaderManager().GetDefaultShader()); dirtPatch.SetUvScale(dimensions / new Vector2(400, 400)); dirtPatch.SetPosition(position); m_clientControllers.GetSSBBRenderPipeline().AddRenderable(dirtPatch, Implementations.SSBBRenderPipeline.LayerIdentifiers.LI_Background, 1); }
public void addTopPlane(float f, float f1, float f2, int i, int j, int k, float f3) { Side = 2; Offset = f3; x = f; y = f1; z = f2; xMax = (f + i); yMax = (f1 + j); zMax = (f2 + k); corners = new PositionTextureVertex[8]; faces = new TexturedQuad[1]; float f4 = f + i; float f5 = f1 + j; float f6 = f2 + k; f -= f3; f1 -= f3; f2 -= f3; f4 += f3; f5 += f3; f6 += f3; if (mirror) { float f7 = f4; f4 = f; f = f7; } var positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F); var positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8.0F); var positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8.0F, 8.0F); var positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8.0F, 0.0F); var positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F); var positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8.0F); var positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F); var positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8.0F, 0.0F); corners[0] = positiontexturevertex; corners[1] = positiontexturevertex1; corners[2] = positiontexturevertex2; corners[3] = positiontexturevertex3; corners[4] = positiontexturevertex4; corners[5] = positiontexturevertex5; corners[6] = positiontexturevertex6; corners[7] = positiontexturevertex7; faces[0] = new TexturedQuad( new[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, textureOffsetX, textureOffsetY, textureOffsetX + i, textureOffsetY + k, textureWidth, textureHeight); if (mirror) { faces[0].flipFace(); } }
private void OnLoad(object sender, EventArgs e) { // initialize and bind framebuffer _framebuffer = new Framebuffer(); _framebuffer.Bind(FramebufferTarget.Framebuffer); // initialize a renderbuffer and bind it to the depth attachment // to support depth testing while rendering to the texture _depthBuffer = new Renderbuffer(); _depthBuffer.Init(RenderbufferStorage.DepthComponent, FramebufferWidth, FramebufferHeight); _framebuffer.Attach(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, _depthBuffer); // initialize texture and bind it to the color attachment _texture = new Texture2D(SizedInternalFormat.Rgba8, FramebufferWidth, FramebufferHeight, 1); _framebuffer.Attach(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, _texture); Framebuffer.Unbind(FramebufferTarget.Framebuffer); // initialize demonstration geometry _cube = new ColorCube(); _cube.UpdateBuffers(); _quad = new TexturedQuad(); _quad.UpdateBuffers(); // initialize shaders _colorProgram = ProgramFactory.Create <SimpleColorProgram>(); _textureProgram = ProgramFactory.Create <SimpleTextureProgram>(); // set up vertex attributes for the cube _cubeVao = new VertexArray(); _cubeVao.Bind(); _cubeVao.BindAttribute(_colorProgram.InPosition, _cube.VertexBuffer); _cubeVao.BindAttribute(_colorProgram.InColor, _cube.ColorBuffer); _cubeVao.BindElementBuffer(_cube.IndexBuffer); // set up vertex attributes for the quad _quadVao = new VertexArray(); _quadVao.Bind(); _quadVao.BindAttribute(_textureProgram.InPosition, _quad.VertexBuffer); _quadVao.BindAttribute(_textureProgram.InTexCoord, _quad.TexCoordBuffer); // set camera position Camera.DefaultState.Position = new Vector3(0, 0, 3); Camera.ResetToDefault(); // enable depth testing GL.Enable(EnableCap.DepthTest); }
public override void OnLoad() { base.OnLoad(); m_background = new TexturedQuad(new Vector2(3600, 2800), m_clientControllers.GetTextureManager().GetOrCreateTexture("sand", "Textures/sand.jpg"), m_clientControllers.GetShaderManager().GetDefaultShader()); m_background.SetRepeating(10.0f); m_clientControllers.GetSSBBRenderPipeline().AddRenderable(m_background, Implementations.SSBBRenderPipeline.LayerIdentifiers.LI_Background, 0); i_createDirtPatch(new Vector2(-400, 300), new Vector2(400, 400)); i_createDirtPatch(new Vector2(0, -100), new Vector2(1200, 32)); i_createDirtPatch(new Vector2(0, -200), new Vector2(1200, 32)); i_createDirtPatch(new Vector2(0, -300), new Vector2(1200, 32)); var dirtPatch = new TexturedQuad(new Vector2(450, 450), m_clientControllers.GetTextureManager().GetOrCreateTexture("dirtCircle", "Textures/DirtCircle.png"), m_clientControllers.GetShaderManager().GetDefaultShader()); dirtPatch.SetPosition(new Vector2(100, 300)); m_clientControllers.GetSSBBRenderPipeline().AddRenderable(dirtPatch, Implementations.SSBBRenderPipeline.LayerIdentifiers.LI_Background, 1); m_clientControllers.GetNetClient().SendRPC(new Networking.ClientServer.NetPackets.RequestPlayerCharacterClientPacket() { aiType = m_aiType, position = MathHelpers.SytemVecToOpenTkVec(new Vector2()) }); }
public ModelBox(ModelRenderer modelrenderer, string name, int i, int j, float f, float f1, float f2, int k, int l, int i1, float f3) { sizeOfs = f3; texX = i; texY = j; Name = name; x = f; y = f1; z = f2; xMax = f + k; yMax = f1 + l; zMax = f2 + i1; field_40679_h = new PositionTextureVertex[8]; field_40680_i = new TexturedQuad[6]; float f4 = f + k; float f5 = f1 + l; float f6 = f2 + i1; f -= f3; f1 -= f3; f2 -= f3; f4 += f3; f5 += f3; f6 += f3; if (modelrenderer.mirror) { float f7 = f4; f4 = f; f = f7; } var positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F); var positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8F); var positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8F, 8F); var positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8F, 0.0F); var positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F); var positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8F); var positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8F, 8F); var positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8F, 0.0F); field_40679_h[0] = positiontexturevertex; field_40679_h[1] = positiontexturevertex1; field_40679_h[2] = positiontexturevertex2; field_40679_h[3] = positiontexturevertex3; field_40679_h[4] = positiontexturevertex4; field_40679_h[5] = positiontexturevertex5; field_40679_h[6] = positiontexturevertex6; field_40679_h[7] = positiontexturevertex7; field_40680_i[0] = new TexturedQuad(new[] { positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6 }, i + i1 + k, j + i1, i + i1 + k + i1, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[1] = new TexturedQuad(new[] { positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3 }, i + 0, j + i1, i + i1, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[2] = new TexturedQuad(new[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, i + i1, j + 0, i + i1 + k, j + i1, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[3] = new TexturedQuad(new[] { positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6 }, i + i1 + k, j + i1, i + i1 + k + k, j + 0, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[4] = new TexturedQuad(new[] { positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2 }, i + i1, j + i1, i + i1 + k, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[5] = new TexturedQuad(new[] { positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7 }, i + i1 + k + i1, j + i1, i + i1 + k + i1 + k, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); if (modelrenderer.mirror) { for (int j1 = 0; j1 < field_40680_i.Length; j1++) { field_40680_i[j1].flipFace(); } } }
public void addTopPlane(float f, float f1, float f2, int i, int j, int k, float f3) { Side = 2; Offset = f3; x = f; y = f1; z = f2; xMax = (f + i); yMax = (f1 + j); zMax = (f2 + k); corners = new PositionTextureVertex[8]; faces = new TexturedQuad[1]; float f4 = f + i; float f5 = f1 + j; float f6 = f2 + k; f -= f3; f1 -= f3; f2 -= f3; f4 += f3; f5 += f3; f6 += f3; if (mirror) { float f7 = f4; f4 = f; f = f7; } var positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F); var positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8.0F); var positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8.0F, 8.0F); var positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8.0F, 0.0F); var positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F); var positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8.0F); var positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F); var positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8.0F, 0.0F); corners[0] = positiontexturevertex; corners[1] = positiontexturevertex1; corners[2] = positiontexturevertex2; corners[3] = positiontexturevertex3; corners[4] = positiontexturevertex4; corners[5] = positiontexturevertex5; corners[6] = positiontexturevertex6; corners[7] = positiontexturevertex7; faces[0] = new TexturedQuad( new[] {positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1}, textureOffsetX, textureOffsetY, textureOffsetX + i, textureOffsetY + k, textureWidth, textureHeight); if (mirror) faces[0].flipFace(); }
public ModelBox(ModelRenderer modelrenderer, string name, int i, int j, float f, float f1, float f2, int k, int l, int i1, float f3) { sizeOfs = f3; texX = i; texY = j; Name = name; x = f; y = f1; z = f2; xMax = f + k; yMax = f1 + l; zMax = f2 + i1; field_40679_h = new PositionTextureVertex[8]; field_40680_i = new TexturedQuad[6]; float f4 = f + k; float f5 = f1 + l; float f6 = f2 + i1; f -= f3; f1 -= f3; f2 -= f3; f4 += f3; f5 += f3; f6 += f3; if (modelrenderer.mirror) { float f7 = f4; f4 = f; f = f7; } var positiontexturevertex = new PositionTextureVertex(f, f1, f2, 0.0F, 0.0F); var positiontexturevertex1 = new PositionTextureVertex(f4, f1, f2, 0.0F, 8F); var positiontexturevertex2 = new PositionTextureVertex(f4, f5, f2, 8F, 8F); var positiontexturevertex3 = new PositionTextureVertex(f, f5, f2, 8F, 0.0F); var positiontexturevertex4 = new PositionTextureVertex(f, f1, f6, 0.0F, 0.0F); var positiontexturevertex5 = new PositionTextureVertex(f4, f1, f6, 0.0F, 8F); var positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8F, 8F); var positiontexturevertex7 = new PositionTextureVertex(f, f5, f6, 8F, 0.0F); field_40679_h[0] = positiontexturevertex; field_40679_h[1] = positiontexturevertex1; field_40679_h[2] = positiontexturevertex2; field_40679_h[3] = positiontexturevertex3; field_40679_h[4] = positiontexturevertex4; field_40679_h[5] = positiontexturevertex5; field_40679_h[6] = positiontexturevertex6; field_40679_h[7] = positiontexturevertex7; field_40680_i[0] = new TexturedQuad(new[] { positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6 }, i + i1 + k, j + i1, i + i1 + k + i1, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[1] = new TexturedQuad(new[] { positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3 }, i + 0, j + i1, i + i1, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[2] = new TexturedQuad(new[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, i + i1, j + 0, i + i1 + k, j + i1, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[3] = new TexturedQuad(new[] { positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6 }, i + i1 + k, j + i1, i + i1 + k + k, j + 0, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[4] = new TexturedQuad(new[] { positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2 }, i + i1, j + i1, i + i1 + k, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); field_40680_i[5] = new TexturedQuad(new[] { positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7 }, i + i1 + k + i1, j + i1, i + i1 + k + i1 + k, j + i1 + l, modelrenderer.textureWidth, modelrenderer.textureHeight); if (modelrenderer.mirror) { for (int j1 = 0; j1 < field_40680_i.Length; j1++) field_40680_i[j1].flipFace(); } }