Source: raytracer/material3d.h
|
|
|
|
/* *************************************************************************
material3d.h - description
-------------------
begin : Wed Oct 16 2002
copyright : (C) 2002 by Micha Riser
email : mriser@gmx.net
************************************************************************* */
/* *************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
************************************************************************* */
#ifndef MATERIAL3D_H
#define MATERIAL3D_H
#include "types.h"
#include "transformatable.h"
#include "object3d.h"
#include "texture3d.h"
#include "interior.h"
/**Material. Material combines surface properties and interior properties
*of objects.
*@author Micha Riser
*/
class Material3D: public Transformatable {
public: // Public attributes
Texture3D* texture;
Interior* interior;
public: // Constructors and destructor
Material3D(): texture(0), interior(0) {}
Material3D(Texture3D* t, Interior* i): texture(t), interior(i) {}
Material3D(const Material3D& m): Transformatable(m) {
if (m.texture) texture = new Texture3D(*m.texture); else texture = 0;
if (m.interior) interior = new Interior(*m.interior); else texture = 0;
}
~Material3D() {
delete(texture);
delete(interior);
}
private:
Material3D& operator=(const Material3D&);
public: // Public methods
/**Set material properties by given Material3D if they are not already set.
*/
void overlay(const Material3D& m) {
if (!texture)
texture = new Texture3D(*m.texture);
else
texture->overlay(*m.texture);
if (!interior)
interior = new Interior(*m.interior);
else
interior->overlay(*m.interior);
}
};
#endif
| Generated by: micha@laptop on Thu Oct 24 20:25:24 2002, using kdoc 2.0a53. |