00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef PIGMENT3D_H
00022
#define PIGMENT3D_H
00023
00024
#include "vector.h"
00025
#include "function.h"
00026
#include "colour.h"
00027
#include "transparenttransformatable.h"
00028
#include "pattern.h"
00029
#include "intervalmap.h"
00030
00034 class Pigment3D:
public Function<Vector3, ColourA>,
public TransparentTransformatable {
00035
00036
public:
00037
Pigment3D() {}
00038
virtual ~
Pigment3D() {}
00039
00040
public:
00043
virtual Pigment3D*
copy()
const = 0;
00044
00045
protected:
00046
Pigment3D(
const Pigment3D& p):
Function<Vector3, ColourA>(),
TransparentTransformatable(p) {}
00047
00048
private:
00049
Pigment3D& operator=(
const Pigment3D&);
00050
00051 };
00052
00053
00057 class Pigment3DConstant:
public Pigment3D {
00058
00059
public:
00060
Pigment3DConstant(
const ColourA& c): colour(c) {}
00061 ~
Pigment3DConstant() {}
00062
00063
public:
00064
00065
00066 ColourA evaluateAt(
const Vector3&)
const {
return colour;}
00067 Pigment3D*
copy()
const {
return new Pigment3DConstant(colour);}
00068
00069
00070 void translate(
const Vector3&) {}
00071 void scale(
const Vector3&) {}
00072
void rotate(
const Vector3&) {}
00073 void applyOrthogonalMatrix(
const Matrix&) {}
00074
00075
private:
00076
ColourA colour;
00077
00078 };
00079
00080
00085 class Pigment3DMapped:
public Pigment3D,
public IntervalMap<Pigment3D, ColourA> {
00086
00087
public:
00088
Pigment3DMapped(
const pattern::Pattern* p):
00089
Pigment3D(),
IntervalMap<Pigment3D, ColourA>(), pattern(p) {};
00090
00093 Pigment3DMapped(
const Pigment3DMapped& p):
Pigment3D(p),
IntervalMap<
Pigment3D,
ColourA>(p),
00094 pattern(p.pattern->
copy()) {};
00095
00096 ~
Pigment3DMapped();
00097
00098
public:
00099
ColourA evaluateAt(
const Vector3&) const;
00100
Pigment3D* copy() const;
00101
00102
void insertCol(FLT value, const
ColourA& obj) {
00103
insert(value,
new Pigment3DConstant(obj));
00104 }
00105
00106
00107
private:
00108
const pattern::Pattern* pattern;
00109
00110 };
00111
00112
#endif