public void LoadScene(int sceneId) { SceneData db = GameDataManage.Instance.GetDBScene(sceneId); Debug.Log(db.SceneName); switch (db.SceneType) { case ESceneType.Init: { this.NextState = GameState.Init; } break; case ESceneType.Login: { this.NextState = GameState.Login; } break; case ESceneType.Battle: { this.NextState = GameState.Battle; } break; } CurMapID = db.Id; GLCommand ev = new GLCommand(sceneId); ChangeState(GameState.Loading, ev); }
public void End() { var command = new GLCommand { Type = CommandType.End }; _commandList.Add(command); }
public void SetDepthStencilState(IDepthStencilState depthStencilState) { var command = new GLCommand { Type = CommandType.SetDepthStencilState, }; _commandList.Add(command); }
public void SetBlendState(IBlendState blendState) { var command = new GLCommand { Type = CommandType.SetBlendState, }; _commandList.Add(command); }
private void SetProgramPipeline(GL46Pipeline pipeline) { var command = new GLCommand { Type = CommandType.SetPipeline, Pipeline = pipeline }; _commandList.Add(command); }
public void SetInputLayout(IInputLayout inputLayout) { var command = new GLCommand { Type = CommandType.SetInputLayout, InputLayout = (GL46InputLayout)inputLayout }; _commandList.Add(command); }
public void SetIndexBuffer(IIndexBuffer indexBuffer) { var command = new GLCommand { Type = CommandType.SetIndexBuffer, IndexBuffer = (GL46IndexBuffer)indexBuffer }; _commandList.Add(command); }
public void SetConstantBuffer(IConstantBuffer buffer, BufferScope bufferScope) { var command = new GLCommand { Type = CommandType.SetConstantBuffers, ConstantBuffer = (GL46ConstantBuffer)buffer }; _commandList.Add(command); }
public void SetPrimitiveTopology(PrimitiveTopology primitiveTopology) { var command = new GLCommand { Type = CommandType.SetPrimitiveTopology, PrimitiveType = primitiveTopology.ToOpenTK() }; _commandList.Add(command); }
public void SetScissorRectangle(Rectangle rectangle) { var command = new GLCommand { Type = CommandType.SetScissor, ScissorRectangle = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height) }; _commandList.Add(command); }
public void ClearRenderTarget(TextureView renderTarget, Vector4 clearColor) { var command = new GLCommand { Type = CommandType.ClearRenderTarget, ClearColor = new OpenTK.Graphics.Color4(clearColor.X, clearColor.Y, clearColor.Z, clearColor.W) }; _commandList.Add(command); }
public override void Enter() { base.Enter(); GLCommand ev = Cmd as GLCommand; mLoadingSceneId = ev.SceneID; UIManage.Instance.Clear(); UIManage.Instance.OpenWindow(WindowID.UI_LOADING); mLoadingWindow = (UILoading)UIManage.Instance.GetWindow(WindowID.UI_LOADING); }
public void Draw(int vertexCount) { var command = new GLCommand { Type = CommandType.Draw, DrawVertexCount = vertexCount }; _commandList.Add(command); }
public void SetViewport(Viewport viewport) { var command = new GLCommand { Type = CommandType.SetViewport, Viewport = viewport.ToOpenTK() }; _commandList.Add(command); }
public void SetTexture(TextureView textureView) { var command = new GLCommand { Type = CommandType.SetTextures, TextureView = ((GL46TextureView)textureView) }; _commandList.Add(command); }
public void ClearDepthStencil(TextureView depthStencil, float clearDepth, byte stencilDepth) { var command = new GLCommand { Type = CommandType.ClearDepthStencil, ClearStencil = stencilDepth, ClearDepth = clearDepth }; _commandList.Add(command); }
public void DrawIndexed(int indexCount, int indexOffset, int vertexOffset) { var command = new GLCommand { Type = CommandType.DrawIndexed, DrawIndexCount = indexCount, DrawIndexOffset = indexOffset, DrawVertexOffset = vertexOffset, }; _commandList.Add(command); }
public void SetVertexBuffer(IVertexBuffer vertexBuffer) { var command = new GLCommand { Type = CommandType.SetVertexBuffer, InputLayout = _currentInputLayout, VertexBuffer = (GL46VertexBuffer)vertexBuffer, VertexStride = vertexBuffer.VertexStride }; _commandList.Add(command); }
public void Begin(string passName, IPipeline pipeline) { var command = new GLCommand { Type = CommandType.Begin, Name = passName }; _commandList.Add(command); if (pipeline != null) { SetViewport(pipeline.Viewport); SetProgramPipeline((GL46Pipeline)pipeline); SetInputLayout(pipeline.InputLayout); } }
public static GLParser FromFile(string xmlFile, params string[] Api) { XDocument file = XDocument.Load(xmlFile); GLParser spec = new GLParser(); spec.HeaderComment = file.Root.Element("comment").Value; foreach (var feature in file.Root.Elements("feature")) { var apiName = feature.Attribute("api").Value; if (Api.Contains(apiName)) { var version = new GLVersion { Api = feature.Attribute("api").Value.ToUpper(), Number = feature.Attribute("number").Value, }; version.Name = version.Api + version.Number.Replace(".", ""); // Add all enums and commands from previus versions int i = spec.Versions.Count - 1; if (i >= 0) { var previousVersion = spec.Versions[i]; foreach (var g in previousVersion.Groups) { version.Groups.Add(g.Clone()); } foreach (var c in previousVersion.Commands) { version.Commands.Add(c.Clone()); } } // Include all new enums and commands foreach (var require in feature.Elements("require")) { foreach (var enumElem in require.Elements("enum")) { var enumName = enumElem.Attribute("name").Value; // if enum doesn't exists bool exists = version.Groups.Exists(g => g.Enums.Exists(e => e.Name == enumName)); if (!exists) { // Find group string groupFound = FindGroupInXML(file, enumName); // The group already exists GlGroup glgroup = version.Groups.Find(g => g.Name == groupFound); if (glgroup == null) { glgroup = new GlGroup() { Name = groupFound }; version.Groups.Add(glgroup); } // Create new Enum var glEnum = new GLEnum(); glEnum.Initialize(file, enumName); glgroup.Enums.Add(glEnum); } } foreach (var commandElem in require.Elements("command")) { var glCommand = new GLCommand() { Name = commandElem.Attribute("name").Value }; if (version.Commands.Find(c => c.Name == glCommand.Name) == null) { // Create new command glCommand.Initialize(commandElem.Document); version.Commands.Add(glCommand); } } } // Add enum from commands foreach (var commandElem in version.Commands) { // Return Type if (commandElem.ReturnType.Type == "GLenum") { var selectedGroup = commandElem.ReturnType.Group; bool groupExists = version.Groups.Exists(g => g.Name == selectedGroup); if (!groupExists) { foreach (var group in file.Root.Element("groups").Elements("group")) { string groupName = group.Attribute("name").Value; if (groupName == selectedGroup) { GlGroup glgroup = new GlGroup() { Name = selectedGroup }; foreach (var e in group.Elements("enum")) { GLEnum glEnum = new GLEnum(); var enumName = e.Attribute("name").Value; glEnum.Initialize(file, enumName); glgroup.Enums.Add(glEnum); } version.Groups.Add(glgroup); } } } } // Parameters foreach (var param in commandElem.Parameters) { if (param.Type == "GLenum") { bool groupExists = version.Groups.Exists(g => g.Name == param.Group); if (!groupExists) { foreach (var group in file.Root.Element("groups").Elements("group")) { string groupName = group.Attribute("name").Value; if (groupName == param.Group) { GlGroup glgroup = new GlGroup() { Name = param.Group }; foreach (var e in group.Elements("enum")) { GLEnum glEnum = new GLEnum(); var enumName = e.Attribute("name").Value; glEnum.Initialize(file, enumName); glgroup.Enums.Add(glEnum); } version.Groups.Add(glgroup); } } } } } } // Remove any anums and commands foreach (var remove in feature.Elements("remove")) { foreach (var e in remove.Elements("enum")) { foreach (var group in version.Groups) { var glenum = group.Enums.Find(n => n.Name == e.Attribute("name").Value); if (glenum != null) { group.Enums.Remove(glenum); } } } foreach (var c in remove.Elements("command")) { version.Commands.RemoveAll(command => command.Name == c.Attribute("name").Value); } } // Remove all group with 0 enums version.Groups.RemoveAll(g => g.Enums.Count == 0); // Remove GLBoolean type version.Groups.RemoveAll(g => g.Name == "Boolean"); spec.Versions.Add(version); } } return(spec); }
private static void BuildParameterList(GLCommand c, StringBuilder builder) { if (c.Parameters.Count > 0) { foreach (var p in c.Parameters) { var name = p.Name; // Add @ to start of any names that are C# keywords to avoid conflict if (name == "params" || name == "string" || name == "ref" || name == "base") { name = "@" + name; } builder.AppendFormat("{0} {1}, ", ConvertGLType(p.Type), name); } builder.Length -= 2; } }