public static void ReleaseResources() { if (ColorShader != null) { ColorShader.Dispose(); ColorShader = null; } if (WireframeShader != null) { WireframeShader.Dispose(); WireframeShader = null; } if (WireframeShader2 != null) { WireframeShader2.Dispose(); WireframeShader2 = null; } if (ModelShader != null) { ModelShader.Dispose(); ModelShader = null; } if (BoundingBoxBufffer != null) { BoundingBoxBufffer.Dispose(); BoundingBoxBufffer = null; } if (StudConnectionShader != null) { StudConnectionShader.Dispose(); StudConnectionShader = null; } if (SimpleTextureShader != null) { SimpleTextureShader.Dispose(); SimpleTextureShader = null; } }
//public static Buffer<StudGridCell> StudGridBuffer { get; private set; } #endregion public static void InitializeResources() { ColorShader = ProgramFactory.Create <ColorShaderProgram>(); WireframeShader = ProgramFactory.Create <WireframeShaderProgram>(); ModelShader = ProgramFactory.Create <ModelShaderProgram>(); WireframeShader2 = ProgramFactory.Create <WireframeShader2Program>(); StudConnectionShader = ProgramFactory.Create <StudConnectionShaderProgram>(); SimpleTextureShader = ProgramFactory.Create <SimpleTextureShaderProgram>(); BoundingBoxBufffer = new IndexedVertexBuffer <Vector3>(); var box = BBox.FromCenterSize(Vector3.Zero, Vector3.One); BoundingBoxBufffer.SetVertices(box.GetCorners()); var bboxIndices = new List <int>(); for (int i = 0; i < 4; i++) { bboxIndices.Add((i * 2)); bboxIndices.Add((i * 2) + 1); bboxIndices.Add((i * 2)); bboxIndices.Add(((i + 1) * 2) % 8); bboxIndices.Add((i * 2) + 1); bboxIndices.Add((((i + 1) * 2) + 1) % 8); } BoundingBoxBufffer.SetIndices(bboxIndices); //StudGridBuffer = new Buffer<StudGridCell>(); CollisionMaterial = new MaterialInfo { Diffuse = new Vector4(1f, 0.05f, 0.05f, 1f), Specular = new Vector3(1f), Shininess = 2f }; ConnectionMaterial = new MaterialInfo { Diffuse = new Vector4(0.95f, 0.95f, 0.05f, 1f), Specular = new Vector3(1f), Shininess = 2f }; MaleConnectorMaterial = new MaterialInfo { Diffuse = new Vector4(0.05f, 0.05f, 0.95f, 1f), Specular = new Vector3(1f), Shininess = 2f }; FemaleConnectorMaterial = new MaterialInfo { Diffuse = new Vector4(0.05f, 0.95f, 0.05f, 1f), Specular = new Vector3(1f), Shininess = 2f }; WireframeColor = new Vector4(0, 0, 0, 1f); WireframeColorAlt = new Vector4(0.85f, 0.85f, 0.85f, 1f); SelectionOutlineColor = new Vector4(1f); }