Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - samreid

Pages: [1]
1
Support / Re: shrinking jpct.jar
« on: October 14, 2009, 02:03:25 am »
Could I also have permission to use Proguard's shrinking feature on jpct.jar?  It's an essential part of our toolchain, and we need to minimize the size of our resulting jars.  I know others have reported some problems with using this (see above), but I didn't want to try without permission.

Thanks,
Sam Reid

2
Support / Re: Shading on a Cube with Software Renderer
« on: October 13, 2009, 05:32:49 pm »
Thanks for your quick response.  I tried using SHADING_FAKED_FLAT, and obtained the desired results.  It took a couple of tries to configure the light source so that it looked reasonable.  Here's a screenshot:



And the modified HelloWorldSoftware example code that was used to produce it:

Code: [Select]
package edu.colorado.phet.densityjava.view.jpct;

import java.awt.*;

import com.threed.jpct.*;
import javax.swing.*;

public class HelloJPCT {

private World world;
private FrameBuffer buffer;
private Object3D box;
private JFrame frame;

    public static void main(String[] args) throws Exception {
new HelloJPCT().loop();
}

public HelloJPCT() throws Exception {

frame=new JFrame("Hello world");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

world = new World();
world.addLight( new SimpleVector( -20,-5,-25),Color.gray );

TextureManager.getInstance().addTexture("box", new Texture(64,64, Color.red));

box = Primitives.getBox(1f, 2f);
box.setTexture("box");
box.setEnvmapped(Object3D.ENVMAP_ENABLED);
        box.setShadingMode( Object3D.SHADING_FAKED_FLAT );
box.build();
world.addObject(box);

world.getCamera().setPosition(5, -5, -2);
world.getCamera().lookAt(box.getTransformedCenter());
}

private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);

while (frame.isShowing()) {
box.rotateY(0.01f);
buffer.clear(java.awt.Color.BLUE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.display(frame.getGraphics());
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
frame.dispose();
System.exit(0);
}
}

Thanks again,
Sam Reid

3
Support / Shading on a Cube with Software Renderer
« on: October 13, 2009, 08:18:14 am »
Hi, it's my first 60 minutes with jPCT and I'm trying to use the software renderer to create a cube where each face has a different shade, like this (without the text)


But when I use the HelloWorldSoftware, with this new initialization:
Code: [Select]
                world = new World();
world.addLight( new SimpleVector( 30,30,30),Color.yellow );

TextureManager.getInstance().addTexture("box", new Texture(64,64, Color.red));

box = Primitives.getBox(13f, 2f);
box.setTexture("box");
box.setEnvmapped(Object3D.ENVMAP_ENABLED);
box.build();
world.addObject(box);

The object doesn't seem to have well defined edges, and comes out looking like this:


I also tried putting the light at (0,0,30), but that looked qualitatively similar.  What's the easiest/best way to do this?

Also, is there a way to highlight the edges of a cube; for example, to have them appear with a dark outline?

Thanks,
Sam Reid

Pages: [1]