-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinePlaneModel.cpp
More file actions
executable file
·45 lines (34 loc) · 950 Bytes
/
LinePlaneModel.cpp
File metadata and controls
executable file
·45 lines (34 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// LineGridModel.cpp
// ogl4
//
// Created by Philipp Lensing on 19.09.16.
// Copyright © 2016 Philipp Lensing. All rights reserved.
//
#include "LinePlaneModel.h"
LinePlaneModel::LinePlaneModel( float DimX, float DimZ, int NumSegX, int NumSegZ )
{
VB.begin();
float StepX = DimX / (float)NumSegX;
float StepZ = DimZ / (float)NumSegZ;
float BeginX = -DimZ/2.0f;
float BeginZ = -DimX/2.0f;
for( int i=0; i<=NumSegX; ++i )
{
VB.addVertex( BeginZ + i*StepX, 0, BeginX );
VB.addVertex( BeginZ + i*StepX, 0, -BeginX );
}
for( int i=0; i<=NumSegZ; ++i )
{
VB.addVertex( BeginZ, 0, BeginX + i*StepZ );
VB.addVertex( -BeginZ, 0, BeginX + i*StepZ );
}
VB.end();
}
void LinePlaneModel::draw(const BaseCamera& Cam)
{
BaseModel::draw(Cam);
VB.activate();
glDrawArrays(GL_LINES, 0, VB.vertexCount());
VB.deactivate();
}