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 - EgonOlsen

Pages: 1 ... 779 780 [781] 782 783 ... 788
Support / Orbiting camera
« on: August 27, 2003, 05:29:07 pm »
Fixed it...try the updated version using the same link as above. I was mixing up the coordinates in the method, so the results were totally wrong *most* of the time, but somehow not in my test-case...
Anyway, it should work now. I got it working like this:

Code: [Select]


       dummy.setCenter(new SimpleVector(0,-40,-100));
       dummy.setRotationPivot(new SimpleVector(0,0,0));

The thing is, that it works this way, but without any other objects in the scene, you won't notice it (except for the fact that the lighting will change).
Anyway, what i basically did was to offset the center of the dummy so that it starts at the point where the camera should be placed in the beginning. You have to make sure, that the RotationPivots of the dummy and the player are describing the same position in WORLDSPACE after doing the transformation (despite the rotation pivot never actually get transformed...). This can be tricky if they differ in OBJECTSPACE...which they don't in this example (they are both placed at the origin). However, maybe drawing this on a piece of paper least it helped me. There may be other options to get the same effect, but this should work. Then again, i haven't stressed this method very much, so i'm not sure which fancy tricks it will allow for and which not.
I hope it was somehow understandable what i tried to explain...

Support / Orbiting camera
« on: August 27, 2003, 02:23:11 pm »
First, you can't do that:

Code: [Select]

because you are mixing worldspace and object-space coordinates here, which isn't what you want.
Second, it seems to be my fault...the getTransformedCenter() seems to be fishy. I'm at work, so i could only do some small tests and don't have the source available, but the returned center seems to be a screwed up variant of the actual center. I really wonder why it worked in my short test yesterday... :?:
I got the thing you want working even with the buggy method, but i had to swap coordinates in the SimpleVector and rotate the dummy object around x instead of y....strange...
I'll have a look at the problem, but i'm not sure if i manage to do so today.

News / LWJGL 0.7 is out!
« on: August 26, 2003, 07:52:52 pm »
Get it here:

Anyway, jPCT won't support it until 0.93 or 0.94. I'll wait some days before starting to port jPCT to 0.7, because quite a lot has changed and i want to see how things go first (well, that and i'm lazy... :D )

Support / Orbiting camera
« on: August 26, 2003, 07:33:05 pm »
The beta of the new version available for download here:

EDIT: Removed the link. This version is now official.

The docs and the manual are still in need of some work and that's why this is not an "official" release, but this way you can already test the features you requested. This version is a major update, because some internals have changed and some obsolete stuff from Config has been removed. So in case of problems, please let me know.
Here's a list of the changes until now:

0.92 - Extended matrix-locking to cover the camera too (if locking is used). Worked on Matrix and SimpleVector to increase performance of some methods slightly. Removed unused transparency constants from Object3D. Added support for tiled textures (i.e. texture coordinates below zero and larger than 1) for the SoftGL-renderer. This requires that even the textures used for software-rendering only have to have a height of a power of 2 (jPCT will convert non-power-of-2-textures). Added some methods to SimpleVector, Camera and World to support first-person-shooter-like navigation better. Fixed a bug in the OcTree that caused collisions detection to fail in multi-threaded applications in some rare cases. Fixed a bug in the ray/polygon-collision detection in combination with octrees. Added an algorithm to automatically speed-up collision detection. Modified z-Sorting to ensure a defined sorting order (per frame) even for polygons with equal depth. Removed some unused or now useless configuration variables from Config (public and non-public ones). Reworked both software-renderers to be more pixel-perfect. Removed artifacts from the OptiZ-algorithm. It should work flawless in every situation now. Added the possibility to retrieve an object's center in worldspace.

Oh, and thanx for trying to call calcCenter() on a dummy-object... :lol:  It was bugged because it caused a division by zero in this case. Why the VM thinks that setting it to NaN instead is a better idea than throwing the exception, is still beyond my understanding. But it sometimes does this and after it, floating point code slows down to a crawl... :?

Support / Orbiting camera
« on: August 26, 2003, 06:47:51 am »
I see...the problem is, that getCenter() returns you the center in object-space while you want to get the center transformed into world-space. It should be possible to emulate this behaviour somehow, but i think it's better to add a new method like getTransformedCenter() to Object3D and maybe a convenience method to do the camera placement using this value to Camera too.
I'll add this to the next release, which should be out in the next 48h (i'll try to get things sorted today) and YOU will have to play beta-tester for this method  :lol:
I'll let you know...
BTW.: I'll document this behaviour of getCenter() in the docs, because it seems to be misleading the way it is documented now.

Support / source
« on: August 19, 2003, 11:51:42 pm »
Quote from: "Koroljov"
It is very interesting. It is much faster than using
u =  (i*(Vz*Oy-Vy*Oz) + j*(Vx*Oz-Vz*Ox)+(Vy*Ox-Vx*Oy))/(i*(Vy*Uz-Vz*Uy)+j*(Vz*Ux-Vx*Uz) + (Vx*Uy-Vy*Ux))
v = ( i*(Uy*Oz-Uz*Oy) + j*(Uz*Ox-Ux*Oz) + (Ux*Oy-Uy*Ox))/( i*(Vy*Uz-Vz*Uy) + j*(Vz*Ux-Vx*Uz) + (Vx*Uy-Vy*Ux))
Obviously... :wink:

Support / source
« on: August 17, 2003, 12:55:43 pm »
Quote from: "koroljov"
Can't you tell some names of the used algorithms so I can seek them on the internet? How can it work so quick in full screen? How many divisions are there in the inner loop of the application? How is it clipped? How can you make a color lighter or darker? Do you really have to get the r g b -values, edit them and put them in 1 int again with lots of << and >> operators?
Sorry for the late reply, but i was on a trip to sweden for two weeks. The inner loop for a point-sampled pixel looks like this

Code: [Select]
for (int tx=x+yPos; tx<=end; tx++) {

   if (zbuffer[tx]>iz) {


      if ((r&0xffffff00)!=0) { r=(255>>(byte) (r>>28&8)); }
      if ((g&0xffffff00)!=0) { g=(255>>(byte) (g>>28&8)); }
      if ((b&0xffffff00)!=0) { b=(255>>(byte) (b>>28&8)); }




In the inner loop, the subspans are linear interpolated, so no division is needed here. In the loop that does the subdivision, no division is needed too because it has all been replaced by multiplying with 1/(whatever).
I don't know where to look on the net for a better description, because it's simply the way i'm doing these things for ages now.
Please note that this is the inner loop of the SoftGL-Renderer which requires some multiplications and supports texture-wrapping from version 0.92 (to be released...) on, so it's a bit slower than the Legacy-Renderer, but not much.

Support / Disable Lighting
« on: July 16, 2003, 10:00:51 pm »
The new version is out and has this option included. Have a look and see, if this is what you need...

News / Version 0.91 has been released!
« on: July 16, 2003, 09:22:07 pm »
0.91 is out! It features an enhanced documentation (i started to write a kind of "manual" which can be found online too: kind, it's still in its infancy.), a new method to disable lightsources for an object and a refactored Loader-class (i hope it still works). The Loader supports loading a XML based format now (the format itself is subject to change a little bit in the future though).
A DTD for the XML can be found in the docs, an example XML file can be found here:
For this, a small XML-Parser has been added to the package and because it has absolutely nothing to do with jPCT itself, it has been placed in a new "util"-package.
Have fun!

Support / Disable Lighting
« on: July 08, 2003, 07:32:09 pm »
No. I never thought of this... :oops: But i'll add it. Would it be satisfying to disable influence of the lightsources on an object and to leave ambient light and additional color active in the calculation? The problem with disabling ambient lighting is, that it doesn't work on a per-object base and that it requires a different treatment if the renderer is in OpenGL mode or not.
I've already added this option to 0.91 and you'll get it with the next release. The question remains, if this is enough or if it's needed for your application to disable ambient on a per-object base too. In that case, i'll have to think about the topic once again...please let me know.

Support / Rotation Point
« on: July 08, 2003, 03:50:03 pm »

Support / Reset Transform
« on: July 06, 2003, 02:51:14 pm »
You may set the rotation- and translation-matrix to whatever instance of Matrix you wish. To reset them, just do:

Code: [Select]

Object3D obj=....
Matrix mat=obj.getRotationMatrix();


Code: [Select]

Matrix mat=new Matrix();

The later way involves a creation of a new Matrix object, which may be little slower, but depending on what you want to do, more appropriate.
Because getRotationMatrix() returns the reference to the rotation matrix, an obj.getRotationMatrix().setIdentity() should do the trick too, but i simply don't like to rely on such a behaviour because it may (most likely won't, but anyway...) change in the future.
Setting the translation matrix works the same way.

Support / Nonuniform Scaling
« on: July 04, 2003, 12:15:45 am »
No...and yes...jPCT's standard scaling behaviour doesn't allow this. The reason for this is, that jPCT doesn't really use a scaling matrix but a virtual scaling matrix with sx=sy=sz=s. The easiest way to explain this quite strange behaviour is: "historical reasons"... :D
This may not satisfy you and i understand that. But i don't think that i'll break the current implementation to add support for non-uniform scaling.
However, jPCT 0.90 features support for what i've called "VertexController"s. So you may write yourself a VertexController that does the non-uniform scaling for you...should be quite easy to do once you got the concept of the VertexControllers. This is NOT an ideal solution...i know that. Anyway, it's the only way to do it ATM. Maybe i'll think about adding a real non-uniform scaling later if it's really important to you and you can't live with the "Controller-solution".

News / Version 0.90 has been released!
« on: July 01, 2003, 11:20:27 pm »
Some minor things like an improved collision detection performance for ray-polygon collisions and some cleanup work. A major addition is the possibility to now build yourself a VertexController to modify vertices of already constructed objects. This is something that wasn't possible in jPCT before. The usage of the VertexController may not be very intuitive, but i'm planning to add a demo of that. For now, look at this source code to see a sample implementation:

Code: [Select]
public class DemoVertexController extends GenericVertexController {

     int count;

     DemoVertexController() {

     public void apply() {
       SimpleVector[] srcMesh=this.getSourceMesh();
       SimpleVector[] dstMesh=this.getDestinationMesh();

       int size=this.getMeshSize();

       for (int i=0; i<size; i++) {
         float z=srcMesh[i].z;
         float x=0.25f*(srcMesh[i].x+count);
         float sin=(float) Math.sin(x);


Yeah right! The VertexController stuff may sound more complicated than it really is when it comes to implementing one (note that this implementation skips updating the vertex normals, which is not quite correct).

Use your new controller like this:

Code: [Select]

      IVertexController demoControl=new DemoVertexController();
      Object3D obj=Primitives.getPlane(20,5);
      obj.getMesh().setVertexController(demoControl, IVertexController.PRESERVE_SOURCE_MESH);

Note that the call to build() has to be placed before the getMesh() to make sure that the normals are calculated. This isn't mentioned in the current docs, so i'm mentioning it here.

The result will be a plane whose vertices are being modified by the VertexController in realtime. Can't show it in motion ATM, so here's a quick and dirty picture of it (not that it's very impressive but it may help to understand what a VertexController is supposed to do):

Support / skeleton control
« on: June 30, 2003, 01:23:22 am »
I guess you are talking about skeletal animation like Half-Life uses it (just to name one)? I'm not too sure that this will make its way into jPCT in the near future...I know that it would be a nice to have feature though. Please don't count on it...but then again, i once said the same about OpenGL and MD2 support.. :) I know that this isn't a very satisfying answer, but it's all i can say about this topic ATM.
I don't quite understand the second question...why do you want to call LWJGL directly?
To explain how jPCT makes use of LWJGL: The one and only class that knows something about LWJGL is the GLRenderer (as an implementation of the IRenderer-interface). No other class know a single bit about LWJGL (or any other renderer implementation).

Pages: 1 ... 779 780 [781] 782 783 ... 788