core/vgui/vgui_easy3D_tableau.cxx
Go to the documentation of this file.
00001 // This is core/vgui/vgui_easy3D_tableau.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author Philip C. Pritchett, RRG, University of Oxford
00008 // \date   24 Sep 99
00009 // \brief  See vgui_easy3D_tableau.h for a description of this file.
00010 
00011 #include "vgui_easy3D_tableau.h"
00012 
00013 #include <vgui/vgui_soview3D.h>
00014 #include <vgui/vgui_displaylist3D_tableau.h>
00015 #include <vgui/vgui_style.h>
00016 
00017 vgui_easy3D_tableau::
00018 vgui_easy3D_tableau() : style_(vgui_style::new_style())
00019 {
00020   style_->rgba[0] = 0.0f;
00021   style_->rgba[1] = 1.0f;
00022   style_->rgba[2] = 0.0f;
00023 
00024   style_->line_width = 1;
00025   style_->point_size = 3;
00026 }
00027 
00028 
00029 void
00030 vgui_easy3D_tableau::
00031 add(vgui_soview3D* object)
00032 {
00033   object->set_style(style_);
00034   vgui_displaylist3D_tableau::add(object);
00035 }
00036 
00037 
00038 vgui_point3D*
00039 vgui_easy3D_tableau::
00040 add_point(float x, float y, float z)
00041 {
00042   vgui_point3D *obj
00043     = new vgui_point3D( x,y,z );
00044 
00045   add(obj);
00046   return obj;
00047 }
00048 
00049 
00050 vgui_lineseg3D*
00051 vgui_easy3D_tableau::
00052 add_line( float x0, float y0, float z0,
00053           float x1, float y1, float z1 )
00054 {
00055   vgui_lineseg3D *obj
00056     = new vgui_lineseg3D( x0,y0,z0, x1,y1,z1 );
00057 
00058   add(obj);
00059   return obj;
00060 }
00061 
00062 vgui_triangle3D*
00063 vgui_easy3D_tableau::
00064 add_triangle( float x0, float y0, float z0,
00065               float x1, float y1, float z1,
00066               float x2, float y2, float z2 )
00067 {
00068   vgui_triangle3D *obj = 
00069     new vgui_triangle3D( x0,y0,z0, x1,y1,z1, x2,y2,z2 );
00070 
00071   add(obj);
00072   return obj;
00073 }
00074 
00075 
00076 void
00077 vgui_easy3D_tableau::
00078 set_foreground(float r, float g, float b)
00079 {
00080   // create a new style object so that already added objects don't
00081   // suddenly change
00082   style_ = vgui_style::new_style( style_ );
00083   style_->rgba[0] = r;
00084   style_->rgba[1] = g;
00085   style_->rgba[2] = b;
00086 }
00087 
00088 void
00089 vgui_easy3D_tableau::
00090 set_line_width(float w)
00091 {
00092   // create a new style object so that already added objects don't
00093   // suddenly change
00094   style_ = vgui_style::new_style( style_ );
00095   style_->line_width = w;
00096 }
00097 
00098 void
00099 vgui_easy3D_tableau::
00100 set_point_radius(float r)
00101 {
00102   // create a new style object so that already added objects don't
00103   // suddenly change
00104   style_ = vgui_style::new_style( style_ );
00105   style_->point_size = r;
00106 }
00107