/* * DISTRHO Plugin Framework (DPF) * Copyright (C) 2012-2019 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this * permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "../Geometry.hpp" #include "../OpenGL.hpp" START_NAMESPACE_DGL // ----------------------------------------------------------------------- // Line template void Line::draw() { DISTRHO_SAFE_ASSERT_RETURN(fPosStart != fPosEnd,); glBegin(GL_LINES); { glVertex2d(fPosStart.fX, fPosStart.fY); glVertex2d(fPosEnd.fX, fPosEnd.fY); } glEnd(); } // ----------------------------------------------------------------------- // Circle template void Circle::_draw(const bool outline) { DISTRHO_SAFE_ASSERT_RETURN(fNumSegments >= 3 && fSize > 0.0f,); double t, x = fSize, y = 0.0; glBegin(outline ? GL_LINE_LOOP : GL_POLYGON); for (uint i=0; i void Triangle::_draw(const bool outline) { DISTRHO_SAFE_ASSERT_RETURN(fPos1 != fPos2 && fPos1 != fPos3,); glBegin(outline ? GL_LINE_LOOP : GL_TRIANGLES); { glVertex2d(fPos1.fX, fPos1.fY); glVertex2d(fPos2.fX, fPos2.fY); glVertex2d(fPos3.fX, fPos3.fY); } glEnd(); } // ----------------------------------------------------------------------- // Rectangle template void Rectangle::_draw(const bool outline) { DISTRHO_SAFE_ASSERT_RETURN(fSize.isValid(),); glBegin(outline ? GL_LINE_LOOP : GL_QUADS); { glTexCoord2f(0.0f, 0.0f); glVertex2d(fPos.fX, fPos.fY); glTexCoord2f(1.0f, 0.0f); glVertex2d(fPos.fX+fSize.fWidth, fPos.fY); glTexCoord2f(1.0f, 1.0f); glVertex2d(fPos.fX+fSize.fWidth, fPos.fY+fSize.fHeight); glTexCoord2f(0.0f, 1.0f); glVertex2d(fPos.fX, fPos.fY+fSize.fHeight); } glEnd(); } // ----------------------------------------------------------------------- // Possible template data types template class Point; template class Point; template class Point; template class Point; template class Point; template class Point; template class Size; template class Size; template class Size; template class Size; template class Size; template class Size; template class Line; template class Line; template class Line; template class Line; template class Line; template class Line; template class Circle; template class Circle; template class Circle; template class Circle; template class Circle; template class Circle; template class Triangle; template class Triangle; template class Triangle; template class Triangle; template class Triangle; template class Triangle; template class Rectangle; template class Rectangle; template class Rectangle; template class Rectangle; template class Rectangle; template class Rectangle; // ----------------------------------------------------------------------- END_NAMESPACE_DGL