Skip to content

Conversation

@mikepiecuch
Copy link

This is my first contribution to three.js. I think this library is amazing and I want to give back.

This is an example of fire and smoke based on the research paper:

"Real-Time Fluid Dynamics for Games" by Jos Stam
http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf

@looeee
Copy link
Collaborator

looeee commented Dec 4, 2018

camera.add( pointLight );
scene.add( camera );

var plane = new THREE.PlaneGeometry( 20, 20 );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use BufferGeometry at all places. So in this case PlaneBufferGeometry.

renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.autoClear = false;
renderer.antialias = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems redundant to me.

this.orthoCamera = new THREE.OrthographicCamera( textureWidth / - 2, textureWidth / 2, textureHeight / 2, textureHeight / - 2, 1, 2 );
this.orthoCamera.position.z = 1;

this.fieldGeometry = new THREE.PlaneGeometry( textureWidth, textureHeight );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PlaneBufferGeometry.

this.field0.background = new THREE.Color( 0x000000 );

this.field1 = new THREE.WebGLRenderTarget( textureWidth,
textureHeight,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some formatting issues.

var parameters = {
minFilter: THREE.NearestFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is already THREE.RGBAFormat.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 4, 2018

A better place for Fire.js might be examples/js/objects/.

@mikepiecuch
Copy link
Author

Review comments fixed.

@mrdoob mrdoob added this to the r100 milestone Dec 31, 2018
@mrdoob mrdoob merged commit 356d25c into mrdoob:dev Dec 31, 2018
@mrdoob
Copy link
Owner

mrdoob commented Dec 31, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants