14#ifndef MATERIALATTRIB_H
15#define MATERIALATTRIB_H
27class EXPCL_PANDA_PGRAPH MaterialAttrib :
public RenderAttrib {
29 INLINE MaterialAttrib();
36 INLINE
bool is_off()
const;
43 virtual void output(std::ostream &out)
const;
46 virtual int compare_to_impl(
const RenderAttrib *other)
const;
47 virtual size_t get_hash_impl()
const;
53 static int get_class_slot() {
56 virtual int get_slot()
const {
57 return get_class_slot();
59 MAKE_PROPERTY(class_slot, get_class_slot);
62 static void register_with_read_factory();
67 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
68 void fillin(DatagramIterator &scan, BamReader *manager);
71 static TypeHandle get_class_type() {
74 static void init_type() {
75 RenderAttrib::init_type();
77 RenderAttrib::get_class_type());
78 _attrib_slot =
register_slot(_type_handle, 100,
new MaterialAttrib);
80 virtual TypeHandle get_type()
const {
81 return get_class_type();
83 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
86 static TypeHandle _type_handle;
87 static int _attrib_slot;
bool is_off() const
Returns true if the MaterialAttrib is an 'off' MaterialAttrib, indicating that it should disable the ...
static ConstPointerTo< RenderAttrib > make_off()
Constructs a new MaterialAttrib object suitable for rendering unmateriald geometry.
static ConstPointerTo< RenderAttrib > make(Material *material)
Constructs a new MaterialAttrib object suitable for rendering the indicated material onto geometry.
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
get_material
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated.
Defines the way an object appears in the presence of lighting.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static int register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.