PageRenderTime 434ms CodeModel.GetById 282ms app.highlight 5ms RepoModel.GetById 145ms app.codeStats 0ms

/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
27#include "llviewerprecompiledheaders.h"
28
29#include "llcylinder.h"
30
31#include "llerror.h"
32#include "math.h"
33#include "llmath.h"
34#include "noise.h"
35#include "v3math.h"
36#include "llvertexbuffer.h"
37#include "llgl.h"
38#include "llglheaders.h"
39
40LLCone		gCone;
41
42//
43// Cones
44//
45
46void LLCone::render(S32 sides)
47{
48	gGL.begin(LLRender::TRIANGLE_FAN);
49	gGL.vertex3f(0,0,0);
50
51	for (U32 i = 0; i < sides; i++)
52	{
53		F32 a = (F32) i/sides * F_PI*2.f;
54		F32 x = cosf(a)*0.5f;
55		F32 y = sinf(a)*0.5f;
56		gGL.vertex3f(x,y,-.5f);
57	}
58	gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
59
60	gGL.end();
61
62	gGL.begin(LLRender::TRIANGLE_FAN);
63	gGL.vertex3f(0.f, 0.f, 0.5f);
64	for (U32 i = 0; i < sides; i++)
65	{
66		F32 a = (F32) i/sides * F_PI*2.f;
67		F32 x = cosf(a)*0.5f;
68		F32 y = sinf(a)*0.5f;
69		gGL.vertex3f(x,y,-0.5f);
70	}
71	gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, -0.5f);
72
73	gGL.end();
74}
75