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 - Mr.Marbles

Pages: 1 2 3 [4] 5 6
46
Support / Simulate "camera.lookAt(SimpleVector)" for an Obje
« on: April 27, 2006, 06:46:13 pm »
Melssj5,

Thanks for the reply. Maybe I wasn't clear enough in my question. I know how to rotate the objects, it's the angles I'm having a hard time with. As I mentioned my vector math is a little weak.

47
Support / Simulate "camera.lookAt(SimpleVector)" for an Obje
« on: April 27, 2006, 04:11:33 pm »
I have a gun turret in my application which is made up of two moving parts: 1) the base 2) the gun. The base rotates on the y-axis and the gun rotates on the x-axis. I have a flying target in my scene and I'd like the turret to track the target using the same principle of the camera "lookAt()" function. What's the simplest way to get this done keeping in mind that the base of the turrent and the gun on the turret rotate on two different axis. I've tried several methods involving vector math but my linear algebra is a little rusty  :oops: . That's why I was thinking of the camera "lookAt()" function.

48
Support / Sky
« on: April 11, 2006, 03:00:54 pm »
I've used the technique described in the following post and it works well. If you just want to use a solid color for the background then you can replace the buffer.clear() with buffer.clear(Color).

49
Support / Using Blender to create a 3ds file
« on: April 03, 2006, 03:59:22 pm »
I'm not really an expert in modeling but I know "3D Studio Max" can create .3ds files.

50
Support / Calculate distance to an object3D
« on: March 23, 2006, 07:39:21 pm »
Found the problem :!:  I was calling build() on the objects before setting their initial positions, like this:

Code: [Select]

// ---- BAD ----//
object.build();
object.translate(initialLocation);
object.translateMesh();
object.rotateMesh();
object.setTranslationMatrix(new Matrix());
object.setRotationMatrix(new Matrix());


And I changed it to this:

Code: [Select]

// ---- GOOD ----//
object.translate(initialLocation);
object.translateMesh();
object.rotateMesh();
object.setTranslationMatrix(new Matrix());
object.setRotationMatrix(new Matrix());
object.build();


Now the objects have the right positions. But I still don't understand why they were rendered properly before with the bad initialization  :?

51
Support / Calculate distance to an object3D
« on: March 23, 2006, 06:57:17 pm »
The problem is in fact the transformed centers of the objects, they're always reading (0,0,0)  :!:  Why would this be? The objects are in the right positions in the rendered scene. It's probably a timing issue. When should I be calling the code to calculate the distance?

52
Support / Calculate distance to an object3D
« on: March 23, 2006, 04:39:27 pm »
EgonOlsen,

Quote
Code: [Select]

dist=obj.getTransformedCenter().calcSub(camera.getPosition()).length();


This is returning the same values as the code that I was using. The reason why it doesn't seem to work right is because objects that are far return smaller values than closer objects. Is this correct?

53
Support / Calculate distance to an object3D
« on: March 23, 2006, 03:43:50 pm »
This my be a stupid question but does anyone know of a simple way to calculate the distance from the camera's position to an Object3D in the scene?

I've tried the following but the resulting values don't seem right:

Code: [Select]

SimpleVector v = object.getOrigin();
v.add(object.getTranslation());
distance = v.calcSub(camera.getPosition()).length();


Any suggestions :?:

54
Support / Dynamic brightness and contrast adjustment
« on: March 21, 2006, 06:44:59 pm »
Melssj5,

Thank-you for the suggestion. Your solution has much better performance, but does not visually give the same effect. However, considering this solution also works for hardware rendering I will surely be using it insted.

Now if I can only find a way to play with contrast  :?

55
Support / Dynamic brightness and contrast adjustment
« on: March 21, 2006, 05:12:03 pm »
I'm trying to implement a way of changing the brightness and contrast of the rendered image dynamically through user controls (GUI). This is proving to be a difficult task. It seems that the only way to post-process a rendered image is by using the getPixels() of the framebuffer and modifying those values. The problem is that this solution only works for software rendering, is there any way to do this for hardware rendering?

Here's the code which effectively plays with the brightness of the rendered framebuffer:

Code: [Select]

// this is in the rendering loop
Image image = frameBuffer.getOutputBuffer();
BufferedImage buffImage = new BufferedImage(image.getWidth(null),
                            image.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = buffImage.getGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();

// gainAdjustment is the brightness; where 1.0 is 100%            
RescaleOp op = new RescaleOp(gainAdjustment, 0, null);
buffImage = op.filter(buffImage, null);
           
int [] pixels = frameBuffer.getPixels();
buffImage.getRGB(0, 0, buffImage.getWidth(),
                       buffImage.getHeight(), pixels, 0,
                       buffImage.getWidth());
buffer.refresh();


I still haven't found a way to play with the contrast... but I think my biggest problem is that playing with the FrameBuffer's pixels has no effect in hardware mode :cry:

I'm opened to any suggestions

56
Support / Turn off jPCT output messages?
« on: February 16, 2006, 06:34:04 pm »
Thanks for the solution!

I don't see -1 as a constant in the Logger class though. I think I'll use Logger.LL_ONLY_ERRORS insted since I'd like to be notified of errors.

57
Support / Turn off jPCT output messages?
« on: February 16, 2006, 02:36:34 pm »
Is there any way to turn off the output that gets generated while jPCT is initializing :?:  My application also prints output and it's sometimes tough to see with all the jPCT output on the screen.

58
Support / Texture color inconsistent
« on: February 14, 2006, 03:29:14 pm »
Ok so 110pre5 then. In what time frame do you think v1.10 will be released?

59
Support / Texture color inconsistent
« on: February 14, 2006, 03:10:28 am »
Thanks for the fix  :D

About this new build you sent me, what version of jPCT is it? Is it an addon to the v1.10 pre4 or maybe pre5?? I'm assuming this fix will make it to the next official release but in the mean time I'd just like to track the versions I'm working with so far.

60
Support / Texture color inconsistent
« on: February 13, 2006, 08:02:39 pm »
EgonOlsen,

I've just put together a sample test case which shows this artifact and sent it to your email (hostmaster@jpct.net). Let me know what you think. Thanks.

Pages: 1 2 3 [4] 5 6