/indra/newview/llcylinder.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 75 lines · 36 code · 11 blank · 28 comment · 2 complexity · 1bef633c361d3d7b685dfec88a307de4 MD5 · raw file

  1. /**
  2. * @file llcylinder.cpp
  3. * @brief Draws a cylinder using display lists for speed.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llcylinder.h"
  28. #include "llerror.h"
  29. #include "math.h"
  30. #include "llmath.h"
  31. #include "noise.h"
  32. #include "v3math.h"
  33. #include "llvertexbuffer.h"
  34. #include "llgl.h"
  35. #include "llglheaders.h"
  36. LLCone gCone;
  37. //
  38. // Cones
  39. //
  40. void LLCone::render(S32 sides)
  41. {
  42. gGL.begin(LLRender::TRIANGLE_FAN);
  43. gGL.vertex3f(0,0,0);
  44. for (U32 i = 0; i < sides; i++)
  45. {
  46. F32 a = (F32) i/sides * F_PI*2.f;
  47. F32 x = cosf(a)*0.5f;
  48. F32 y = sinf(a)*0.5f;
  49. gGL.vertex3f(x,y,-.5f);
  50. }
  51. gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
  52. gGL.end();
  53. gGL.begin(LLRender::TRIANGLE_FAN);
  54. gGL.vertex3f(0.f, 0.f, 0.5f);
  55. for (U32 i = 0; i < sides; i++)
  56. {
  57. F32 a = (F32) i/sides * F_PI*2.f;
  58. F32 x = cosf(a)*0.5f;
  59. F32 y = sinf(a)*0.5f;
  60. gGL.vertex3f(x,y,-0.5f);
  61. }
  62. gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
  63. gGL.end();
  64. }