Main Page | Class Hierarchy | Class List | File List | Class Members

pigment3d.h

00001 /* ************************************************************************* 00002 pigment3d.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: pigment3d_8h-source.html,v 1.1 2005/02/04 21:02:27 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 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: // Constructors and destructor 00037 Pigment3D() {} 00038 virtual ~Pigment3D() {} 00039 00040 public: // Public pure virtual methods 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: // Constructors and destructor 00060 Pigment3DConstant(const ColourA& c): colour(c) {} 00061 ~Pigment3DConstant() {} 00062 00063 public: // Public methods 00064 00065 // Inherited from Pigment3D 00066 ColourA evaluateAt(const Vector3&) const {return colour;} 00067 Pigment3D* copy() const {return new Pigment3DConstant(colour);} 00068 00069 // Inherited from Transformatable 00070 void translate(const Vector3&) {} 00071 void scale(const Vector3&) {} 00072 void rotate(const Vector3&) {} 00073 void applyOrthogonalMatrix(const Matrix&) {} 00074 00075 private: // Private attributes 00076 ColourA colour; 00077 00078 }; 00079 00080 00085 class Pigment3DMapped: public Pigment3D, public IntervalMap<Pigment3D, ColourA> { 00086 00087 public: // Constructor and destructor 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: // Public methods 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

Generated on Thu Jan 27 12:16:06 2005 for raytracer.kdevelop by doxygen 1.3.8