Hi,
At the moment im trying to figure out how to correctly implement some stuff and was hoping for a little bit of help.
At the moment I have a textured corridor made out of 4 quads. Plain and simple. What I want to do is make them really dark. In order to do so I've used the lighting function from the Flagrush tutorial
private void buildLighting() {
/** Set up a basic, default light. */
DirectionalLight light = new DirectionalLight();
light.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, .5f));
light.setDirection(new Vector3f(1,100,0));
light.setShadowCaster(true);
light.setEnabled(true);
/** Attach the light to a lightState and the lightState to rootNode. */
LightState lightState = display.getRenderer().createLightState();
lightState.setEnabled(true);
lightState.setGlobalAmbient(new ColorRGBA(.2f, .2f, .2f, 1f));
lightState.attach(light);
scene.setRenderState(lightState);
}
Notice the light.setDirection(new Vector3f(1,100,0));
I've put the light way up high above my corridor. Now whenever I am actually -in- my corridor I see the "roof" lit up by the light and the sides and floor being dark.
I thought, for some strange reason, the light was shining trough the "roof" so I placed a even bigger quad between the light source and the corridor, hoping it would block off. This didnt work. Apparantly, the top-side of every item gets lit up by the light source. I was wondering what I should be looking for if i want it to be changed.
About the particle stuff:
I've also checked the tutorial and tried to implement it correctly. However for some strange reason my particles don't move! :'(
The lazy buggers just sit there being all sphere-like. It's hard to explain but the screenshots should be enough. I wanted to make a box with particles coming out of it.
this is my code
package com.techdemo;
import java.io.IOException;
import java.net.URL;
import java.nio.FloatBuffer;
import java.util.HashMap;
import javax.swing.ImageIcon;
import com.jmex.effects.ParticleManager;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.math.Quaternion;
import jmetest.TutorialGuide.HelloStates;
import jmetest.effects.TestParticleSystem;
import jmetest.renderer.ShadowTweaker;
import jmetest.renderer.TestAnisotropic;
import jmetest.renderer.TestSkybox;
import jmetest.terrain.TestTerrain;
import com.jme.app.SimpleGame;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Quad;
import com.jme.scene.shape.Sphere;
import com.jme.math.Vector3f;
import com.jme.app.BaseGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.bounding.BoundingVolume;
import com.jme.image.Texture;
import com.jme.scene.state.LightState;
import com.jme.input.ChaseCamera;
import com.jme.input.FirstPersonHandler;
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.joystick.JoystickInput;
import com.jme.input.thirdperson.ThirdPersonMouseLook;
import com.jme.light.DirectionalLight;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.app.SimpleGame;
import com.jme.app.BaseGame;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.SharedMesh;
import com.jme.scene.Text;
import com.jme.scene.shape.Box;
import com.jme.scene.state.*;
import com.jme.input.*;
import com.jme.util.Timer;
import com.jme.util.TextureManager;
import com.jme.util.LoggingSystem;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.math.Vector3f;
import com.jme.image.Texture;
import com.jme.light.PointLight;
import java.util.logging.Level;
import com.jmex.awt.JMECanvas;
import com.jmex.awt.SimpleCanvasImpl;
import com.jme.input.MouseInput;
public class techDemoTorchParticles extends BaseGame
{
private int width, height, depth, freq;
private boolean fullscreen;
private Camera cam;
protected Timer timer;
private Node scene;
private Node torchNode;
private Node partNode;
protected InputHandler input;
protected float interpolation;
private ParticleManager manager;
private Quad wall;
//private Vector3f axis = new Vector3f(0f, 0f, 1f);
//public URL monkeyLoc=techDemoTest3.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg");
public static void main(String[] args)
{
techDemoTorchParticles app = new techDemoTorchParticles();
app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG, techDemoTorchParticles.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg"));
app.start();
}
protected void update(float interpolation)
{
timer.update();
interpolation = timer.getTimePerFrame();
input.update(interpolation);
if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
{
finished = true;
}
}
protected void render(float interpolation)
{
display.getRenderer().clearBuffers();
display.getRenderer().draw(scene);
}
protected void initSystem()
{
//store the properties information
width = properties.getWidth();
height = properties.getHeight();
depth = properties.getDepth();
freq = properties.getFreq();
fullscreen = properties.getFullscreen();
try {
display = DisplaySystem.getDisplaySystem(properties.getRenderer());
display.createWindow(width, height, depth, freq, fullscreen);
cam = display.getRenderer().createCamera(width, height);
} catch (JmeException e) {
e.printStackTrace();
System.exit(1);
}
//set the background to black
display.getRenderer().setBackgroundColor(ColorRGBA.black);
//initialize the camera
cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
// Move our camera to a correct place and orientation.
cam.setFrame(loc, left, up, dir);
/** Signal that we've changed our camera's location/frustum. */
cam.update();
/** Create a basic input controller. */
FirstPersonHandler firstPersonHandler = new FirstPersonHandler( cam, properties.getRenderer() );
/** Signal to all key inputs they should work 10x faster. */
firstPersonHandler.getKeyboardLookHandler().setActionSpeed(5f);
firstPersonHandler.getMouseLookHandler().setActionSpeed(2f);
input = firstPersonHandler;
/** Get a high resolution timer for FPS updates. */
timer = Timer.getTimer(properties.getRenderer());
display.getRenderer().setCamera(cam);
KeyBindingManager.getKeyBindingManager().set("exit", KeyInput.KEY_ESCAPE);
}
protected void initGame()
{
scene = new Node("Scene graph node");
//Set the Z-buffer up correctly
ZBufferState buf = display.getRenderer().createZBufferState();
buf.setEnabled(true);
buf.setFunction(ZBufferState.CF_LEQUAL);
scene.setRenderState(buf);
//Implementation of "Culling"; render only objects visible.
CullState cs = display.getRenderer().createCullState();
cs.setCullMode(CullState.CS_BACK);
scene.setRenderState(cs);
//Initialization time!
// buildTorch();
buildFlame();
scene.updateGeometricState(0.0f, true);
scene.updateRenderState();
}
protected void reinit()
{
display.recreateWindow(width, height, depth, freq, fullscreen);
}
protected void cleanup()
{
LoggingSystem.getLogger().log(Level.INFO, "Cleaning up resources.");
KeyInput.destroyIfInitalized();
MouseInput.destroyIfInitalized();
JoystickInput.destroyIfInitalized();
}
private void buildTorch()
{
Box b=new Box("My box",new Vector3f(0,0,0),new Vector3f(1,1,1)); // Make a box
b.setModelBound(new BoundingBox());
b.updateModelBound();
scene.attachChild(b);
}
private void buildFlame()
{
AlphaState as1 = display.getRenderer().createAlphaState();
as1.setBlendEnabled(true);
as1.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as1.setDstFunction(AlphaState.DB_ONE);
as1.setTestEnabled(true);
as1.setTestFunction(AlphaState.TF_GREATER);
as1.setEnabled(true);
TextureState ts = display.getRenderer().createTextureState();
ts.setTexture(
TextureManager.loadTexture(
TestParticleSystem.class.getClassLoader().getResource(
"jmetest/data/texture/flaresmall.jpg"),
Texture.MM_LINEAR_LINEAR,
Texture.FM_LINEAR));
ts.setEnabled(true);
manager = new ParticleManager(300);
manager.setGravityForce(new Vector3f(0.0f, 0.0f, 0.0f));
manager.setEmissionDirection(new Vector3f(0,1,0));
manager.setParticlesOrigin(new Vector3f(0,0,0));
manager.setInitialVelocity(.006f);
manager.setStartSize(2.5f);
manager.setEndSize(.5f);
manager.setParticlesMinimumLifeTime(1200f);
manager.setStartColor(new ColorRGBA(1, 0, 0, 1));
manager.setEndColor(new ColorRGBA(0, 1, 0, 0));
manager.setEmissionMaximumAngle(360f * FastMath.DEG_TO_RAD);
manager.setControlFlow(false);
manager.setRandomMod(0f);
manager.warmUp(60);
scene.setRenderState(ts);
scene.setRenderState(as1);
manager.getParticles().addController(manager);
manager.getParticles().setModelBound(new BoundingSphere());
manager.getParticles().updateModelBound();
scene.attachChild(manager.getParticles());
}
}

Finally, I want to fly arround the corridor allong a predetermined path, give the watcher a demonstration so to speak. What is the best way to achieve this?
Thanks in advance!