-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridNode.cpp
More file actions
18 lines (16 loc) · 854 Bytes
/
GridNode.cpp
File metadata and controls
18 lines (16 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "GridNode.h"
GridNode::GridNode(float numberOfLinesPerAxis,
float spaceBetweenLines, Math::Vector<3,float> color) {
this->numberOfLinesPerAxis = numberOfLinesPerAxis;
this->spaceBetweenLines = spaceBetweenLines;
this->color = color;
}
void GridNode::Apply(Renderers::RenderingEventArg arg, Scene::ISceneNodeVisitor& v) {
// draw xz plane as grid
for (float i= -numberOfLinesPerAxis; i<numberOfLinesPerAxis;
i+=spaceBetweenLines) {
if (i == 0.0) continue;
arg.renderer.DrawLine( Geometry::Line(Math::Vector<3,float>(-numberOfLinesPerAxis,0.0,i), Math::Vector<3,float>(numberOfLinesPerAxis,0.0,i) ), color);
arg.renderer.DrawLine( Geometry::Line(Math::Vector<3,float>(i, 0.0, -numberOfLinesPerAxis), Math::Vector<3,float>(i, 0.0, numberOfLinesPerAxis) ), color);
}
}