// // Copyright 2015 Pixar // // Licensed under the terms set forth in the LICENSE.txt file available at // https://opensubdiv.org/license. // #ifndef OPENSUBDIV_EXAMPLES_MTL_CONTROL_MESH_DISPLAY_H #define OPENSUBDIV_EXAMPLES_MTL_CONTROL_MESH_DISPLAY_H #include #include class MTLControlMeshDisplay { public: MTLControlMeshDisplay(id device, MTLRenderPipelineDescriptor* pipelineDescriptor); ~MTLControlMeshDisplay() = default; void Draw(id encoder, id vertexBuffer, const float *modelViewProjectionMatrix); void SetTopology(OpenSubdiv::Far::TopologyLevel const &level); bool GetEdgesDisplay() const { return _displayEdges; } void SetEdgesDisplay(bool display) { _displayEdges = display; } bool GetVerticesDisplay() const { return _displayVertices; } void SetVerticesDisplay(bool display) { _displayVertices = display; } private: bool createProgram(MTLRenderPipelineDescriptor* pipelineDescriptor); id _device; bool _displayEdges; bool _displayVertices; int _numEdges, _numPoints; id _renderPipelineState; id _vertexSharpnessBuffer; id _edgeSharpnessBuffer; id _edgeIndicesBuffer; }; #endif // OPENSUBDIV_EXAMPLES_MTL_CONTROL_MESH_DISPLAY_H