summaryrefslogtreecommitdiff
path: root/graphics/asymptote/abs3doutfile.h
blob: 2871320952a20c17206afb24411a91489200f8c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef ABS3DOUTFILE_H
#define ABS3DOUTFILE_H

#include "common.h"
#include "triple.h"
#include "prcfile.h"
#include "material.h"

namespace camp
{

inline bool distinct(const uint32_t *I, const uint32_t *J)
{
  return I[0] != J[0] || I[1] != J[1] || I[2] != J[2];
}

class abs3Doutfile : public gc {
protected:
  bool singleprecision;
public:
  abs3Doutfile(bool singleprecision=false) : singleprecision(singleprecision) {}
  virtual ~abs3Doutfile() = default;

  virtual void close()=0;

  virtual void addPatch(triple const* controls, triple const& Min, triple const& Max, prc::RGBAColour const* c) = 0;

  virtual void addStraightPatch(
          triple const* controls, triple const& Min, triple const& Max, prc::RGBAColour const* c) = 0;

  virtual void addBezierTriangle(
          triple const* controls, triple const& Min, triple const& Max, prc::RGBAColour const* c) = 0;

  virtual void addStraightBezierTriangle(
          triple const* controls, triple const& Min, triple const& Max, prc::RGBAColour const* c) = 0;

  virtual void addMaterial(Material const& mat) = 0;

  virtual void addSphere(triple const& center, double radius) = 0;

  virtual void addHemisphere(triple const& center, double radius, double const& polar, double const& azimuth) = 0;

  virtual void addCylinder(triple const& center, double radius, double height,
                           double const& polar, const double& azimuth,
                           bool core) = 0;

  virtual void addDisk(triple const& center, double radius,
                       double const& polar, const double& azimuth) = 0;

  virtual void addTube(const triple* g, double width,
                       const triple& Min, const triple& Max, bool core) = 0;

  virtual void addTriangles(size_t nP, const triple* P, size_t nN,
                            const triple* N, size_t nC, const prc::RGBAColour* C,
                            size_t nI, const uint32_t (* PI)[3],
                            const uint32_t (* NI)[3], const uint32_t (* CI)[3],
                            const triple& Min, const triple& Max) = 0;

  virtual void addCurve(const triple& z0, const triple& c0,
                const triple& c1, const triple& z1,
                const triple& Min, const triple& Max) = 0;

  virtual void addCurve(const triple& z0, const triple& z1,
                const triple& Min, const triple& Max) = 0;

  virtual void addPixel(const triple& z0, double width,
                const triple& Min, const triple& Max) = 0;

  virtual void precision(int digits) = 0;

};

}

#endif