| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#ifndef BALL_VIEW_RENDERING_RENDERERS_XML3DRENDERER_H |
| 6 |
#define BALL_VIEW_RENDERING_RENDERERS_XML3DRENDERER_H |
| 7 |
|
| 8 |
#ifndef BALL_VIEW_RENDERING_RENDERERS_RENDERER_H |
| 9 |
# include <BALL/VIEW/RENDERING/RENDERERS/renderer.h> |
| 10 |
#endif |
| 11 |
|
| 12 |
#ifndef BALL_SYSTEM_FILE_H |
| 13 |
# include <BALL/SYSTEM/file.h> |
| 14 |
#endif |
| 15 |
|
| 16 |
#ifndef BALL_MATHS_VECTOR3_H |
| 17 |
# include <BALL/MATHS/vector3.h> |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifndef BALL_MATHS_MATRIX44_H |
| 21 |
# include <BALL/MATHS/matrix44.h> |
| 22 |
#endif |
| 23 |
|
| 24 |
#ifndef BALL_MATHS_SURFACE_H |
| 25 |
# include <BALL/MATHS/surface.h> |
| 26 |
#endif |
| 27 |
|
| 28 |
namespace BALL |
| 29 |
{ |
| 30 |
namespace VIEW |
| 31 |
{ |
| 32 |
class ColorRGBA; |
| 33 |
class ClippingPlane; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
class BALL_DEPRECATED BALL_VIEW_EXPORT XML3DRenderer : public Renderer |
| 44 |
{ |
| 45 |
public: |
| 46 |
|
| 47 |
BALL_CREATE(XML3DRenderer) |
| 48 |
|
| 49 |
struct XML3DRendererClippingPlane |
| 50 |
{ |
| 51 |
public: |
| 52 |
Vector3 normal; |
| 53 |
float translation; |
| 54 |
|
| 55 |
}; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
XML3DRenderer(); |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
XML3DRenderer(const String& name); |
| 69 |
|
| 70 |
XML3DRenderer(std::ostream& name); |
| 71 |
|
| 72 |
|
| 73 |
XML3DRenderer(const XML3DRenderer& renderer); |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
virtual ~XML3DRenderer(); |
| 78 |
|
| 79 |
|
| 80 |
virtual void clear(); |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
virtual void setSize(float width, float height); |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
void setFileName(const String& name); |
| 94 |
|
| 95 |
|
| 96 |
void setOstream(std::ostream& out_stream); |
| 97 |
|
| 98 |
|
| 99 |
void setHumanReadable(bool state) |
| 100 |
{ human_readable_ = state;} |
| 101 |
|
| 102 |
|
| 103 |
bool isHumanReadable() const |
| 104 |
{ return human_readable_;} |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
String XML3DColorRGBA(const ColorRGBA& input, const String& name); |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
String XML3DFinish(const String& object, const ColorRGBA& input); |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
String XML3DRaytracingMaterial(const Stage::Material& ); |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
String XML3DVector3(Vector3 input); |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
String XML3DString(const String& input); |
| 125 |
|
| 126 |
virtual bool renderOneRepresentation(const Representation& representation); |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
virtual bool init(Scene& scene); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
virtual bool init(const Stage& stage, float width, float height); |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
virtual bool finish(); |
| 147 |
|
| 148 |
void createXHTMLHeader(); |
| 149 |
|
| 150 |
void createXHTMLFooter(); |
| 151 |
|
| 152 |
void renderSphere_(const Sphere& sphere); |
| 153 |
|
| 154 |
void renderDisc_(const Disc& ); |
| 155 |
|
| 156 |
void renderTube_(const Tube& ); |
| 157 |
|
| 158 |
void renderTwoColoredTube_(const TwoColoredTube& tube); |
| 159 |
|
| 160 |
void renderMesh_(const Mesh& mesh); |
| 161 |
|
| 162 |
void renderTwoColoredLine_(const TwoColoredLine& ); |
| 163 |
|
| 164 |
void renderLine_(const Line& ); |
| 165 |
|
| 166 |
void renderPoint_(const Point& ); |
| 167 |
|
| 168 |
|
| 169 |
void renderLabel_(const Label&); |
| 170 |
|
| 171 |
|
| 172 |
virtual void renderMultiLine_(const MultiLine& line); |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
protected: |
| 177 |
|
| 178 |
const ColorRGBA& getColor_(const GeometricObject& object); |
| 179 |
|
| 180 |
std::ostream* outfile_; |
| 181 |
String trimFloatValue_(float value); |
| 182 |
void storeColor_(const GeometricObject& object); |
| 183 |
String getColorIndex_(const ColorRGBA& color); |
| 184 |
void createTubeTransform_(const TwoColoredTube& tube); |
| 185 |
void createSphereTemplate_(); |
| 186 |
|
| 187 |
|
| 188 |
Vector3 origin_; |
| 189 |
Matrix4x4 rotation_; |
| 190 |
vector<ClippingPlane*> clipping_planes_; |
| 191 |
bool human_readable_; |
| 192 |
|
| 193 |
typedef HashMap<String, Size> ColorMap; |
| 194 |
ColorMap color_map_; |
| 195 |
vector<const Representation*> representations_; |
| 196 |
HashSet<const Mesh*> wireframes_; |
| 197 |
HashSet<String> color_strings_; |
| 198 |
double m_[12]; |
| 199 |
Position color_index_; |
| 200 |
bool create_XHTML_; |
| 201 |
|
| 202 |
Surface sphere_template_; |
| 203 |
Surface tube_template_; |
| 204 |
|
| 205 |
Stage::Material rt_material_; |
| 206 |
|
| 207 |
Index current_sphere_number_; |
| 208 |
Index current_tube_number_; |
| 209 |
|
| 210 |
float fov_x_; |
| 211 |
float fov_y_; |
| 212 |
}; |
| 213 |
|
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
#endif |