MCPcopy Create free account
hub / github.com/BerkeleyAutomation/meshrender / MaterialProperties

Class MaterialProperties

meshrender/material.py:3–89  ·  view source on GitHub ↗

A set of material properties describing how an object will look.

Source from the content-addressed store, hash-verified

1import numpy as np
2
3class MaterialProperties(object):
4 """A set of material properties describing how an object will look.
5 """
6
7 def __init__(self, color=np.array([0.5, 0.5, 0.5]),
8 k_a=1.0, k_d=1.0, k_s = 1.0, alpha=1.0,
9 smooth=False, wireframe=False):
10 """Initialize a set of material properties.
11
12 Parameters
13 ----------
14 color : (3,) float
15 The RGB color of the object in (0,1).
16 k_a : float
17 A multiplier for ambient lighting.
18 k_d : float
19 A multiplier for diffuse lighting.
20 k_s : float
21 A multiplier for specular lighting.
22 alpha : float
23 A multiplier for shininess (higher values indicate
24 more reflectivity and smaller highlights).
25 smooth : bool
26 If True, normals will be interpolated to smooth the mesh.
27 wireframe : bool
28 If True, the mesh will be rendered as a wireframe.
29 """
30 self._color = color
31 self._k_a = k_a
32 self._k_d = k_d
33 self._k_s = k_s
34 self._alpha = alpha
35 self._smooth = smooth
36 self._wireframe = wireframe
37
38 @property
39 def color(self):
40 """(3,) float: The RGB color of the object in (0,1).
41 """
42 return self._color
43
44 @property
45 def k_a(self):
46 """float: A multiplier for ambient lighting.
47 """
48 return self._k_a
49
50 @property
51 def k_d(self):
52 """float: A multiplier for diffuse lighting.
53 """
54 return self._k_d
55
56 @property
57 def k_s(self):
58 """float: A multiplier for specular lighting.
59 """
60 return self._k_s

Callers 3

test_viewer.pyFile · 0.90
__init__Method · 0.85
copyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected