Merge git+ssh://ares@repo.or.cz/srv/git/Procustean
[Procustean.git] / src / TextShape.cpp
blob952dbe8f168ae4cd4f5b5a2a2329f5283d140cbf
1 #include <G3D/G3DAll.h>
2 #include <GLG3D/GLG3D.h>
3 #include "TextShape.h"
5 using namespace G3D;
7 TextShape::TextShape(const std::string text, GFont::Ref font, float size) :
8 string_(text),
9 font_(font),
10 size_(size)
15 Shape::Type TextShape::type() const {
16 return NONE;
19 void TextShape::render(class RenderDevice* rd,
20 const CoordinateFrame& cframe,
21 Color4 solidColor,
22 Color4 wireColor)
24 font_->draw3D(rd, string_, cframe, size_, solidColor, wireColor);
27 float TextShape::area() const {
28 G3D::Vector2 bounds = font_->bounds(string_, size_);
29 return bounds.x * bounds.y;
32 float TextShape::volume() const {
33 G3D::Vector2 bounds = font_->bounds(string_, size_);
34 return bounds.x * bounds.y;
37 G3D::Vector3 TextShape::center() const {
38 return G3D::Vector3(0.0, 0.0, 0.0);
41 Sphere TextShape::boundingSphere() const {
42 G3D::Vector2 bounds = font_->bounds(string_, size_);
43 if (bounds.x > bounds.y)
44 return Sphere(G3D::Vector3::zero(), bounds.x);
45 else
46 return Sphere(G3D::Vector3::zero(), bounds.y);
50 AABox TextShape::boundingAABox() const
52 G3D::Vector2 bounds = font_->bounds(string_, size_);
53 return AABox(G3D::Vector3::zero(), G3D::Vector3::zero());
56 void TextShape::getRandomSurfacePoint(G3D::Vector3& P, G3D::Vector3& N) const
58 P = G3D::Vector3::zero();
59 N = G3D::Vector3::unitZ();
62 Vector3 TextShape::randomInteriorPoint() const
64 return G3D::Vector3::zero();