cs567.smoke
Class Smoke

java.lang.Object
  extended by cs567.smoke.Smoke
All Implemented Interfaces:
java.util.EventListener, javax.media.opengl.GLEventListener

public class Smoke
extends java.lang.Object
implements javax.media.opengl.GLEventListener

CS567: Assignment #4 "Interactive Smoke Control" main class. Modify as needed.


Nested Class Summary
(package private)  class Smoke.MyMouseHandler
          Modify this class to improve mouse interaction.
 
Field Summary
(package private)  SmokeControlForces control
           
(package private) static int dim
          Frame dimensions.
(package private)  boolean drawWireframe
          Draws wireframe if true, and pixel blocks if false.
 float dt
          Size of time step (in seconds).
(package private)  javax.swing.JFrame frame
          Main window frame.
(package private)  cs567.smoke.Smoke.FrameExporter frameExporter
          Reference to current FrameExporter, or null if no frames being dumped.
(package private)  FluidSolver fs
           
(package private)  SmokeKeyframe[] keyframes
           
(package private)  Smoke.MyMouseHandler mouseHandler
           
(package private)  int N_STEPS_PER_FRAME
           
(package private)  boolean simulate
          Toggle to advance simulation.
 
Constructor Summary
Smoke(java.lang.String[] imageKeyframes)
          Main constructor.
 
Method Summary
 void dispatchKey(char key, java.awt.event.KeyEvent e)
          Handles keyboard events, e.g., spacebar toggles simulation/pausing, and escape resets the current Task.
 void display(javax.media.opengl.GLAutoDrawable drawable)
          Main event loop: OpenGL display + simulation advance.
 void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged)
          GLEventListener implementation
 javax.vecmath.Point2d getPoint2d(java.awt.event.MouseEvent e)
          Maps mouse event into computational cell using OrthoMap.
 void init(javax.media.opengl.GLAutoDrawable drawable)
          GLEventListener implementation: Initializes JOGL renderer.
static void main(java.lang.String[] args)
          ### Ready.
 void reshape(javax.media.opengl.GLAutoDrawable drawable, int x, int y, int width, int height)
          GLEventListener implementation
(package private)  void simulateAndDisplayScene(javax.media.opengl.GL gl)
          Simulate then display particle system and any builder adornments.
 void start()
          Builds/shows window, and starts simulator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dim

static final int dim
Frame dimensions.

See Also:
Constant Field Values

frameExporter

cs567.smoke.Smoke.FrameExporter frameExporter
Reference to current FrameExporter, or null if no frames being dumped.


N_STEPS_PER_FRAME

int N_STEPS_PER_FRAME

dt

public float dt
Size of time step (in seconds).


frame

javax.swing.JFrame frame
Main window frame.


simulate

boolean simulate
Toggle to advance simulation.


drawWireframe

boolean drawWireframe
Draws wireframe if true, and pixel blocks if false.


fs

FluidSolver fs

mouseHandler

Smoke.MyMouseHandler mouseHandler

control

SmokeControlForces control

keyframes

SmokeKeyframe[] keyframes
Constructor Detail

Smoke

Smoke(java.lang.String[] imageKeyframes)
throws java.io.IOException
Main constructor. Call start() to begin simulation.

Parameters:
imageKeyframes - Image keyframes to use as smoke targets.
Throws:
java.io.IOException
Method Detail

start

public void start()
Builds/shows window, and starts simulator.


getPoint2d

public javax.vecmath.Point2d getPoint2d(java.awt.event.MouseEvent e)
Maps mouse event into computational cell using OrthoMap.


init

public void init(javax.media.opengl.GLAutoDrawable drawable)
GLEventListener implementation: Initializes JOGL renderer.

Specified by:
init in interface javax.media.opengl.GLEventListener

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
GLEventListener implementation

Specified by:
displayChanged in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height)
GLEventListener implementation

Specified by:
reshape in interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable drawable)
Main event loop: OpenGL display + simulation advance. GLEventListener implementation.

Specified by:
display in interface javax.media.opengl.GLEventListener

simulateAndDisplayScene

void simulateAndDisplayScene(javax.media.opengl.GL gl)
Simulate then display particle system and any builder adornments.


dispatchKey

public void dispatchKey(char key,
                        java.awt.event.KeyEvent e)
Handles keyboard events, e.g., spacebar toggles simulation/pausing, and escape resets the current Task.


main

public static void main(java.lang.String[] args)
### Ready. Set. Starting Smoking! ... Control! Control! ###