public void Invoke() { MethodInfo methodInfo = APICommandBuffer.GetAPIMethod(methodName); if (methodInfo == null) { return; } methodInfo.Invoke(null, arguments); }
public bool AddCommand(string methodName, params object[] arguments) { if (APICommandBuffer.GetAPIMethod(methodName) == null) { return(false); } APICommand command = new APICommand(methodName, arguments); _Commands.Add(command); return(true); }
public void TestCommandBuffer() { Vector3[] positions = { new Vector3(0.2f, 0.4f, 0.1f), new Vector3(0.5f, 0.8f, 0.5f), new Vector3(0.8f, 0.2f, 0.5f), }; Vector3[] normals = { new Vector3(1f, 0, 0f), new Vector3(0f, -1f, 0f), new Vector3(-1f, 0, 0f), }; Vector4[] colors = { Color.red, Color.blue, Color.green, }; Vector2[] uvs = { new Vector2(0f, 0f), new Vector2(0.5f, 1f), new Vector2(1f, 0f), }; _CommandBuffer = new APICommandBuffer(); _CommandBuffer.AddCommand("SetShader", _LambertShader); _CommandBuffer.AddCommand("AntiAliasing", APIAntiAliasing.None); _CommandBuffer.AddCommand("SetPositions", positions); _CommandBuffer.AddCommand("SetColors", colors); _CommandBuffer.AddCommand("SetNormals", normals); _CommandBuffer.AddCommand("SetUVs", uvs); _CommandBuffer.AddCommand("Draw", APIDraw.TRIANGLES, 3, 0); }