Creating my own SUN!!!!!!!!! SUNGOD!!! urg---!
Oops, didn't quite work out.
An error message appeared on the console:
// Uncaught TypeError: Cannot read property 'position' of undefined;
Here is the source code:
// Building * The Solar *
var shape = new THREE.BufferGeometry();
shape.addAttribute('position', new THREE.Float32Attribute(6,3));
// The issue seems to be here but I'm not sure where
shape.addAttribute('textureOrder', new THREE.Int8Attribute(6,1));
for(var i=0; i<6; i++) {
shape.attribute.position.setXYZ(i, 0, 0, 0);
shape.attribute.textureOrder.setX(i, i);
};
var d = new Date();
var material = new THREE.ShaderMaterial({
uniforms: {
time: { type: 'f', value: d.getTime() },
tsun_core: { type: 't', value: loadTexture('./sun_core.png') },
tsun_innerglow: { type: 't', value: loadTexture('./sun_innerglow.png') },
tsun_starlight: { type: 't', value: loadTexture('./sun_starlight.png') },
tsun_outerglow: { type: 't', value: loadTexture('./sun_outerglow.png') },
tsun_shortjetlight: { type: 't', value: loadTexture('./sun_shortjetlight.png') },
tsun_longjetlight: { type: 't', value: loadTexture('./sun_longjetlight.png') }
},
vertexShader: document.getElementById('vs-sun').textContent,
fragmentShader: document.getElementById('fs-sun').textContent
});
material.depthTest = false;
material.vertexColor = true;
material.transparent = true;
material.blending = THREE.AdditiveBlending;
sun = new THREE.ParticleSystem(shape, material);
scene.add(sun);
My aim is to adjust gl_FragColor opacity using uniform time
in the fragment shader to make my sun(?) more dynamic...
In my opinion, the problem lies somewhere in the code above. Any guidance would be appreciated..