initData.SetBackgroundColor(CGColor(0.8f, 0.8f, 0.8f));
- Code for drawing a line
void CGSampleView::OnButtonDrawLine()
{
// Creates a new line object
CGObjectLine2D *pObjLine2D = new CGObjectLine2D;
// Defines a line data
CGLine2D line;
line.SetPoint(CGPoint2D(100, 100), true);
line.SetPoint(CGPoint2D(200, 300), false);
// Set the line data to the line object
pObjLine2D->SetLine2D(line);
// Adds the line object to the DB
m_3DDB.AddObject(pObjLine2D);
// Renders all object in the GVIEWLAYER_MAIN DB
m_3DView.Render(GVIEWLAYER_MAIN);
// Just redraws rendered all object in view;
m_3DView.Redraw();
}
- Runs a code for drawing a line
- Code for drawing a circle
void CGSampleView::OnButtonDrawCircle()
{
// Creates a new circle object
CGObjectCircle3D *pObCircle3D = new CGObjectCircle3D;
// Defines a circle data
CGCircle3D circle3D;
{
// center position
circle3D.SetCenterPos(CGPoint3D(100, 100, 10));
// radius
circle3D.SetRadius(30);
}
// Sets the circle data to the circle object
pObCircle3D->SetCircle3D(circle3D);
// Adds the circle object to the DB
m_3DDB.AddObject(pObCircle3D);
// Renders all object in the GVIEWLAYER_MAIN DB
m_3DView.Render(GVIEWLAYER_MAIN);
// Just redraws rendered all object in view.
m_3DView.Redraw();
}
- Runs a code for drawing a circle
- Code for drawing a box
void CGSampleView::OnButtonDrawBox()
{
// Creates a new box object.
CGObjectBox *pObBox = new CGObjectBox;
// Defines a box data
CGBox box;
{
// Position of the box bottom center.
box.SetPos(CGPoint3D(-100, -100, 0), true);
// Position of the box top center.
box.SetPos(CGPoint3D(-100, -100, 100), false);
// Height of the box
box.SetHeight(50.0f);
// Width of the box;
box.SetWidth(50.0f);
}
// Sets the box data to the box object
pObBox->SetBox(box);
// Adds a box object in the DB
m_3DDB.AddObject(pObBox);
// Renders all object in the GVIEWLAYER_MAIN DB;
m_3DView.Render(GVIEWLAYER_MAIN);
// Just redraws rendered all object in view.
m_3DView.Redraw();
}
- Runs a code for drawing a box
It's too simple and bored.
Next time, I will make a code for mouse control.
It's a zoom all, zoom rotate, zoom pan.
댓글 없음:
댓글 쓰기