Skip to content

Commit

Permalink
Added support for textureMaps on models
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwidlund committed May 9, 2018
1 parent 0ec9079 commit 4bb9b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion debug/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ scene = new Scene
width: Screen.width
height: Screen.height


new Model
path: './models/flamingo/flamingo.json'
parent: scene
Expand Down
6 changes: 6 additions & 0 deletions form/Model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class exports.Model extends BaseClass
if properties.material
@applyMaterial properties.material

if properties.map
new THREE.TextureLoader().load properties.map, (map) =>
@mesh.material.map = map
@mesh.material.needsUpdate = true

@setupShadowSettings properties

if properties.smoothShading
Expand Down Expand Up @@ -110,6 +115,7 @@ class exports.Model extends BaseClass
if c instanceof THREE.Mesh
c.material = material


setupShadowSettings: (properties) ->
@mesh.traverse (c) ->
if c instanceof THREE.Mesh
Expand Down

0 comments on commit 4bb9b0e

Please sign in to comment.