<p dir="auto">Could anyone help me with the following please?</p>
<p dir="auto">I'm unable to light custom geometries, even just a single triangle.</p>
<p dir="auto">I made the following "as-simple-as-possible" demo: <a href="http://gnitsuk.leadhoster.com/ThreeTest/Test.html" rel="nofollow">http://gnitsuk.leadhoster.com/ThreeTest/Test.html</a></p>
<p dir="auto">The scene shows a cube and a triangle. Notice that only the cube is responding to the PointLIght, the triangle is dark. It makes no difference if I change the winding of the traingle in the call triangleGeometry.faces.push.</p>
<p dir="auto">If you left click on the page the pointlight is alternately removed and added to the scene. The source code is viewable from the browser.</p>
<p dir="auto">Can anyone see what I've done wrongly that prevents the triangle from responding to the lighting?</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Mitch.</p>
<p dir="auto">When trying to add object loaded with ObjectLoader that has a BufferGeometry and materials I'm getting an error (r65):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: material is undefined
if ( material.transparent ) {
three.js (line 23305)"><pre class="notranslate"><code class="notranslate">TypeError: material is undefined
if ( material.transparent ) {
three.js (line 23305)
</code></pre></div>
<p dir="auto">I'm using the ObjectExporter to save a file with BufferGeometry and materials.<br>
Object file:<br>
<a href="https://drive.google.com/file/d/0B12AhxvnYHrAUlpBSFhyUUNTLUE/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B12AhxvnYHrAUlpBSFhyUUNTLUE/edit?usp=sharing</a></p>
<p dir="auto">JSON model:<br>
<a href="https://drive.google.com/file/d/0B12AhxvnYHrAU0ZxT0M0NzYtd28/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B12AhxvnYHrAU0ZxT0M0NzYtd28/edit?usp=sharing</a></p>
<p dir="auto">Original collada model:<br>
<a href="https://github.com/KhronosGroup/glTF/blob/master/model/duck/duck.dae">https://github.com/KhronosGroup/glTF/blob/master/model/duck/duck.dae</a></p>
<p dir="auto">Exporter:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var loader = new THREE.JSONLoader();
loader.load('model/model.js', function(geometry, materials) {
    var bufferGeometry = THREE.BufferGeometryUtils.fromGeometry(geometry);
    var mesh = new THREE.Mesh(bufferGeometry, new THREE.MeshFaceMaterial(materials));
    var exporter = new THREE.ObjectExporter();
    var output = JSON.stringify( exporter.parse(mesh), null, '\t' );
    output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
    var blob = new Blob( [ output ], { type: 'text/plain' } );
    //window.navigator.msSaveBlob(blob, 'model.js');

    var a = document.querySelector(&quot;#a&quot;);
    a.href = window.URL.createObjectURL(blob);
    a.download = &quot;model.js&quot;;
});"><pre class="notranslate"><code class="notranslate">var loader = new THREE.JSONLoader();
loader.load('model/model.js', function(geometry, materials) {
    var bufferGeometry = THREE.BufferGeometryUtils.fromGeometry(geometry);
    var mesh = new THREE.Mesh(bufferGeometry, new THREE.MeshFaceMaterial(materials));
    var exporter = new THREE.ObjectExporter();
    var output = JSON.stringify( exporter.parse(mesh), null, '\t' );
    output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
    var blob = new Blob( [ output ], { type: 'text/plain' } );
    //window.navigator.msSaveBlob(blob, 'model.js');

    var a = document.querySelector("#a");
    a.href = window.URL.createObjectURL(blob);
    a.download = "model.js";
});
</code></pre></div>
<p dir="auto">Trying to load the obkect:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var loader = new THREE.ObjectLoader();
loader.load('model.js', function(object) {
  scene.add(object);
});"><pre class="notranslate"><code class="notranslate">var loader = new THREE.ObjectLoader();
loader.load('model.js', function(object) {
  scene.add(object);
});
</code></pre></div>
<p dir="auto">By the way, using a with a download attribute might be nicer than opening a new browser window in the editor.<br>
<a href="https://github.com/mrdoob/three.js/blob/master/editor/js/Menubar.File.js#L168">https://github.com/mrdoob/three.js/blob/master/editor/js/Menubar.File.js#L168</a></p>
<p dir="auto">Thanks</p>