#ifndef _gpuCacheMaterialNodes_h_
#define _gpuCacheMaterialNodes_h_
#include "gpuCacheMaterial.h"
namespace GPUCache {
class SurfaceMaterial : public MaterialNode
{
public:
SurfaceMaterial(
const MString& name,
const MString& type =
"surfaceShader");
void accept(MaterialNodeVisitor& visitor) const override;
public:
MaterialPropertyRef OutColor;
MaterialPropertyRef OutTransparency;
};
class SurfaceMaterialVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const SurfaceMaterial& node) = 0;
};
class LambertMaterial : public SurfaceMaterial
{
public:
LambertMaterial(
const MString& name,
const MString& type =
"lambert");
void accept(MaterialNodeVisitor& visitor) const override;
public:
MaterialPropertyRef Color;
MaterialPropertyRef Transparency;
MaterialPropertyRef AmbientColor;
MaterialPropertyRef Incandescence;
MaterialPropertyRef Diffuse;
MaterialPropertyRef Translucence;
MaterialPropertyRef TranslucenceDepth;
MaterialPropertyRef TranslucenceFocus;
MaterialPropertyRef HideSource;
MaterialPropertyRef GlowIntensity;
};
class LambertMaterialVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const LambertMaterial& node) = 0;
};
class PhongMaterial : public LambertMaterial
{
public:
void accept(MaterialNodeVisitor& visitor) const override;
public:
MaterialPropertyRef CosinePower;
MaterialPropertyRef SpecularColor;
MaterialPropertyRef Reflectivity;
MaterialPropertyRef ReflectedColor;
};
class PhongMaterialVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const PhongMaterial& node) = 0;
};
class BlinnMaterial : public LambertMaterial
{
public:
void accept(MaterialNodeVisitor& visitor) const override;
public:
MaterialPropertyRef Eccentricity;
MaterialPropertyRef SpecularRollOff;
MaterialPropertyRef SpecularColor;
MaterialPropertyRef Reflectivity;
MaterialPropertyRef ReflectedColor;
};
class BlinnMaterialVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const BlinnMaterial& node) = 0;
};
class Texture2d : public MaterialNode
{
public:
void accept(MaterialNodeVisitor& visitor) const override;
public:
MaterialPropertyRef DefaultColor;
MaterialPropertyRef OutColor;
MaterialPropertyRef OutAlpha;
};
class Texture2dVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const Texture2d& node) = 0;
};
class FileTexture : public Texture2d
{
public:
void accept(MaterialNodeVisitor& visitor) const override;
public:
MaterialPropertyRef OutTransparency;
MaterialPropertyRef FileTextureName;
};
class FileTextureVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const FileTexture& node) = 0;
};
class UnknownTexture2d : public Texture2d
{
public:
UnknownTexture2d(
const MString& name,
const MString& type =
"unknownTexture2d");
void accept(MaterialNodeVisitor& visitor) const override;
};
class UnknownTexture2dVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const UnknownTexture2d& node) {}
};
class UnknownMaterialNode : public MaterialNode
{
public:
UnknownMaterialNode(
const MString& name,
const MString& type =
"unknown");
void accept(MaterialNodeVisitor& visitor) const override;
};
class UnknownMaterialNodeVisitor : public virtual MaterialNodeVisitor
{
public:
virtual void visit(const UnknownMaterialNode& node) {}
};
class ConcreteMaterialNodeVisitor :
public SurfaceMaterialVisitor,
public LambertMaterialVisitor,
public PhongMaterialVisitor,
public BlinnMaterialVisitor,
public Texture2dVisitor,
public FileTextureVisitor,
public UnknownTexture2dVisitor,
public UnknownMaterialNodeVisitor
{};
}
#endif