mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Added a fast function to obtain the default material
This commit is contained in:
parent
a9ade97ed0
commit
7625c2cfa2
@ -51,6 +51,19 @@ INLINE Material::
|
|||||||
~Material() {
|
~Material() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Material::get_default
|
||||||
|
// Access: Published, Static
|
||||||
|
// Description: Returns the default material.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Material *Material::
|
||||||
|
get_default() {
|
||||||
|
if (_default == 0) {
|
||||||
|
_default = new Material("default");
|
||||||
|
}
|
||||||
|
return _default;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Material::has_ambient
|
// Function: Material::has_ambient
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "bamWriter.h"
|
#include "bamWriter.h"
|
||||||
|
|
||||||
TypeHandle Material::_type_handle;
|
TypeHandle Material::_type_handle;
|
||||||
|
PT(Material) Material::_default;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Material::Copy Assignment Operator
|
// Function: Material::Copy Assignment Operator
|
||||||
|
@ -40,6 +40,8 @@ PUBLISHED:
|
|||||||
void operator = (const Material ©);
|
void operator = (const Material ©);
|
||||||
INLINE ~Material();
|
INLINE ~Material();
|
||||||
|
|
||||||
|
INLINE static Material *get_default();
|
||||||
|
|
||||||
INLINE bool has_ambient() const;
|
INLINE bool has_ambient() const;
|
||||||
INLINE const Colorf &get_ambient() const;
|
INLINE const Colorf &get_ambient() const;
|
||||||
void set_ambient(const Colorf &color);
|
void set_ambient(const Colorf &color);
|
||||||
@ -84,6 +86,8 @@ private:
|
|||||||
Colorf _emission;
|
Colorf _emission;
|
||||||
float _shininess;
|
float _shininess;
|
||||||
|
|
||||||
|
static PT(Material) _default;
|
||||||
|
|
||||||
enum Flags {
|
enum Flags {
|
||||||
F_ambient = 0x001,
|
F_ambient = 0x001,
|
||||||
F_diffuse = 0x002,
|
F_diffuse = 0x002,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user