Class: Mittsu::ShaderMaterial
- Defined in:
- lib/mittsu/materials/shader_material.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#defines ⇒ Object
Returns the value of attribute defines.
-
#fog ⇒ Object
Returns the value of attribute fog.
-
#fragment_shader ⇒ Object
Returns the value of attribute fragment_shader.
-
#lights ⇒ Object
Returns the value of attribute lights.
-
#morph_normals ⇒ Object
Returns the value of attribute morph_normals.
-
#morph_targets ⇒ Object
Returns the value of attribute morph_targets.
-
#shading ⇒ Object
Returns the value of attribute shading.
-
#skinning ⇒ Object
Returns the value of attribute skinning.
-
#vertex_colors ⇒ Object
Returns the value of attribute vertex_colors.
-
#vertex_shader ⇒ Object
Returns the value of attribute vertex_shader.
-
#wireframe ⇒ Object
Returns the value of attribute wireframe.
-
#wireframe_linewidth ⇒ Object
Returns the value of attribute wireframe_linewidth.
Attributes inherited from Material
#alpha_map, #alpha_test, #blend_dst, #blend_dst_alpha, #blend_equation, #blend_equation_alpha, #blend_src, #blend_src_alpha, #blending, #bump_map, #color, #color_write, #combine, #default_attribute_values, #depth_test, #depth_write, #env_map, #id, #light_map, #map, #metal, #name, #normal_map, #opacity, #overdraw, #polygon_offset, #polygon_offset_factor, #polygon_offset_units, #program, #reflectivity, #refraction_ratio, #side, #size_attenuation, #specular_map, #transparent, #type, #uniforms, #uuid, #visible, #wrap_around
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(parameters = {}) ⇒ ShaderMaterial
constructor
A new instance of ShaderMaterial.
Methods inherited from Material
#dispose, #needs_update=, #needs_update?, #set_values, #to_json, #update
Methods included from EventDispatcher
#add_event_listener, #dispatch_event, #has_event_listener, #remove_event_listener
Constructor Details
#initialize(parameters = {}) ⇒ ShaderMaterial
Returns a new instance of ShaderMaterial.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/mittsu/materials/shader_material.rb', line 33 def initialize(parameters = {}) super() @type = 'ShaderMaterial' @defines = {} @uniforms = {} @attributes = nil @vertex_shader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}' @fragment_shader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}' @shading = SmoothShading @line_width = 1 @wireframe = false @wireframe_linewidth = 1 @fog = false # set to use scene fog @lights = false # set to use scene lights @vertex_colors = NoColors # set to use "color" attribute stream @skinning = false # set to use skinning attribute streams @morph_targets = false # set to use morph targets @morph_normals = false # set to use morph normals # When rendered geometry doesn't include these attributes but the material does, # use these default values in WebGL. This avoids errors when buffer data is missing. @default_attributes_values = { 'color' => [1.0, 1.0, 1.0], 'uv' => [0, 0], 'uv2' => [0, 0] } # TODO: necessary? # this.index0AttributeName = undefined; self.set_values(parameters) end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def attributes @attributes end |
#defines ⇒ Object
Returns the value of attribute defines.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def defines @defines end |
#fog ⇒ Object
Returns the value of attribute fog.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def fog @fog end |
#fragment_shader ⇒ Object
Returns the value of attribute fragment_shader.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def fragment_shader @fragment_shader end |
#lights ⇒ Object
Returns the value of attribute lights.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def lights @lights end |
#morph_normals ⇒ Object
Returns the value of attribute morph_normals.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def morph_normals @morph_normals end |
#morph_targets ⇒ Object
Returns the value of attribute morph_targets.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def morph_targets @morph_targets end |
#shading ⇒ Object
Returns the value of attribute shading.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def shading @shading end |
#skinning ⇒ Object
Returns the value of attribute skinning.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def skinning @skinning end |
#vertex_colors ⇒ Object
Returns the value of attribute vertex_colors.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def vertex_colors @vertex_colors end |
#vertex_shader ⇒ Object
Returns the value of attribute vertex_shader.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def vertex_shader @vertex_shader end |
#wireframe ⇒ Object
Returns the value of attribute wireframe.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def wireframe @wireframe end |
#wireframe_linewidth ⇒ Object
Returns the value of attribute wireframe_linewidth.
31 32 33 |
# File 'lib/mittsu/materials/shader_material.rb', line 31 def wireframe_linewidth @wireframe_linewidth end |
Instance Method Details
#clone ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/mittsu/materials/shader_material.rb', line 76 def clone material = ShaderMaterial.new super.clone(material) material.fragment_shader = @fragment_shader material.vertex_shader = @vertex_shader material.uniforms = UniformsUtils.clone(@uniforms) material.attributes = @attributes material.defines = @defines material.shading = @shading material.wireframe = @wireframe material.wireframe_linewidth = @wireframe_linewidth material.fog = @fog material.lights = @lights material.vertex_colors = @vertex_colors material.skinning = @skinning material.morph_targets = @morph_targets material.morph_normals = @morph_normals material end |