
// sg - A scene graph representation.

// Copyright (C) 2005-2006 Editopia Inc.
// Released under the LGPL.
// For more information, see http://www.openlibraries.org.

#ifndef APPEARANCE_INC_
#define APPEARANCE_INC_

#ifdef HAVE_CONFIG_H
#include <openlibraries_global_config.hpp>
#endif

#ifdef HAVE_OPENIMAGELIB
#include <openimagelib/il/il.hpp>
#endif

#include <openobjectlib/sg/core.hpp>

namespace olib { namespace openobjectlib { namespace sg {

// forward declaration
class renderer;

struct SG_DECLSPEC appearance : public node
{
	explicit appearance( );
	virtual ~appearance( );
};

struct SG_DECLSPEC material : public node
{
	explicit material( );
	virtual ~material( );
};

class SG_DECLSPEC texture : public node
{
public:
	explicit texture( );
	virtual ~texture( );
	
public:
	virtual bool update( );

#ifdef HAVE_OPENIMAGELIB
	openimagelib::il::image_type_ptr image( bool release = true );
#endif

private:
#ifdef HAVE_OPENIMAGELIB
	openimagelib::il::image_type_ptr im_;
#endif
	bool ml_;
};

struct SG_DECLSPEC texture_transform : public node
{
	explicit texture_transform( );
	virtual ~texture_transform( );
	
	IMPLEMENT_INDEXABLE_CLASS
};

struct SG_DECLSPEC blend : public node
{
	explicit blend( );
	virtual ~blend( );
	
	IMPLEMENT_INDEXABLE_CLASS
};

struct SG_DECLSPEC cull_mode : public node
{
	explicit cull_mode( );
	virtual ~cull_mode( );
	
	IMPLEMENT_INDEXABLE_CLASS
};

struct SG_DECLSPEC depth_test : public node
{
	explicit depth_test( );
	virtual ~depth_test( );
	
	IMPLEMENT_INDEXABLE_CLASS
};

struct SG_DECLSPEC front_face : public node
{
	explicit front_face( );
	virtual ~front_face( );
	
	IMPLEMENT_INDEXABLE_CLASS
};

typedef boost::shared_ptr<appearance>			appearance_ptr;
typedef boost::shared_ptr<material>				material_ptr;
typedef boost::shared_ptr<texture>				texture_ptr;
typedef boost::shared_ptr<texture_transform>	texture_transform_ptr;
typedef boost::shared_ptr<blend>				blend_ptr;
typedef boost::shared_ptr<cull_mode>			cull_mode_ptr;
typedef boost::shared_ptr<depth_test>			depth_test_ptr;
typedef boost::shared_ptr<front_face>			front_face_ptr;

typedef openpluginlib::value_property<appearance_ptr>			v_appearance_ptr;
typedef openpluginlib::value_property<material_ptr>				v_material_ptr;
typedef openpluginlib::value_property<texture_ptr>				v_texture_ptr;
typedef openpluginlib::value_property<texture_transform_ptr>	v_texture_transform_ptr;
typedef openpluginlib::value_property<blend_ptr>				v_blend_ptr;
typedef openpluginlib::value_property<cull_mode_ptr>			v_cull_mode_ptr;
typedef openpluginlib::value_property<depth_test_ptr>			v_depth_test_ptr;
typedef openpluginlib::value_property<front_face_ptr>			v_front_face_ptr;

typedef openpluginlib::multi_value_property<texture_ptr>			m_texture_ptr;
typedef openpluginlib::multi_value_property<texture_transform_ptr>  m_texture_transform_ptr;
typedef openpluginlib::multi_value_property<v_texture_ptr>			mv_texture_ptr;

} } }

#endif
