Author Topic: "Visual" JPCT  (Read 14715 times)

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« on: March 04, 2006, 02:42:14 am »
Here is a little project I'm working on. I've called it "Visual JPCT" for lack of a better name. (I hope you don't mind, Egon.)

It's basically a small swing frontend for the jpct engine. I was tired of having to recompile every time I fiddled with my models  :wink: And it is a great way to learn the engine!



Features

I've mapped the following jpct functions to the gui:

    importing md2/3ds models
    adding objects to world
    setting objects origin
    moving camera
    rendering solid/wireframe


Things to be done (some ideas):

    manipulating objects
    adding/changing lights
    saving/loading scenes (xml)
    adding primitive objects
    adding triangles
    animation (yeah, right)
    scripting (yeah, right!)
    ...


I hope you like it so far. If it gets to some sort of solid state, I will release it.

Greetings!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
"Visual" JPCT
« Reply #1 on: March 05, 2006, 06:31:13 pm »
That's a great idea! I really like it and i think that it will help the engine to get more popular. Is this based on the software renderer only or will you add support for the AWTGLRenderer as well?

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #2 on: March 05, 2006, 06:35:51 pm »
I've done some changes to the gui, it now uses JDesktopPane so that I can move and scale windows as needed. Also made some icons  :wink:


Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #3 on: March 05, 2006, 06:37:47 pm »
thats a good question egon, I'll look into it  :wink:

Edit: Currently I'm using only the software renderer. It does what I need and adding more functionality to manipulate the scene is top on my list. But support for the awtGl canvas would be cool, so it may come a little later.  :wink:

Offline OHgaming

  • byte
  • *
  • Posts: 4
    • View Profile
    • http://projecttyr.ohgaming.com
"Visual" JPCT
« Reply #4 on: March 19, 2006, 10:31:08 am »
Hey Crate I think this is a great idea! I've been fiddling around with jPCT as my team and I have been trying to decide what graphic engine to use for our project. I have to say an interface just to add and remove lights and objects from the world would be really useful IMO. I was actually thinking of taking a swing at doing something like this, but now I guess I don't have to  :wink: .

Anyways if you need any help or whatever I'd be gald to help and my team will be very grateful if you get a working version going at all.

Offline quixote_arg

  • byte
  • *
  • Posts: 9
    • View Profile
"Visual" JPCT
« Reply #5 on: March 20, 2006, 01:21:39 pm »
No need to wait for a solid state! You can release it and we can all contribute to it

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #6 on: March 20, 2006, 06:58:43 pm »
:) thx for the feedback. First release is coming up. There are still some bugs to fix and I want to finish saving scenes, so that it hase some use...

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #7 on: March 24, 2006, 09:35:30 pm »
I don't know if anyone cares, but here goes... ;)

Egon asked about the AWTGLRenderer and there is a problem for you, because it uses a heavy weight canvas (lwjgl does, not his fault). Those really don't mix well with Swing.  Look at this: http://java.sun.com/products/jfc/tsc/articles/mixing/ (Guideline  No. 3, for example)

Well, I thought, what else is out there? SWT/JFace.  I found this http://www.eclipse.org/swt/opengl/ and it seems promising, since swt is "completely heavy weight" . You can use lwgjl in swt/jface, so it should work well with jpct - although I haven't tried it. Besides, I like eclipse.

Now I find out SWT doesn't support MDI! Bugger. I like MDI, especially for this application, because it has a lot of different objects to be manipulated and the user could place and size them as he wants.

Now what? If every object gets its own window, the desktop will clutter. Using a big tabbed interface would be very silly for small objects. If each object does get its very own app window, I might as well use MDI and swing again and only pop up the AWTGL in its own window.

I need to sleep over this. If anyone has a sugestion, I'm all ears.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
"Visual" JPCT
« Reply #8 on: March 24, 2006, 11:23:16 pm »
IIRC, it is possible to mix the AWTGLCanvas with Swing components, i just don't know how. I think that i've seen some info about it in lwjgl forums, but i'm not quite sure where to look for it. Isn't there a kind of "workaround" or "trick" to use heavy weight components in combination with swing!? I've seen some screenshots or "before" and "after"...i just can't remember where it was... :oops:

Edit: Here's something about making lightweight components heavyweight...don't know, if it helps: http://www.javagaming.org/forums/index.php?topic=10697.0

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
"Visual" JPCT
« Reply #9 on: March 25, 2006, 12:16:56 am »
Crate, why do you plan to use swt instead of awt ? you're true for mixing awt and swing has some problems, but if necessary you can stick to awt. it will run well with AWTGLRenderer as the name implies. life is easier with pure java components.

as you know, the major problem with awt swing combination is awt components are drawn on top swing ones regardless of their z-order. but this doesnt mean you can not use swing features: JLayeredPane (and hence JDesktopPane) effectively layouts and z-orders awt components, which means you can still use JDesktopPane and JInternalFrames for MDI. only titles bars and borders of internal frames will be hidden below awt components. you're working on a helper application, not a commercial one that will go to customer so it doesnt matter so much IMHO. if you care you can still implement your own internal frames on top of awt: basicly they're nothing but dragable and click sensitive components

this is what a thought at a glance

Code: [Select]
r a f t

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #10 on: March 25, 2006, 02:08:52 am »
Hi, thx for the replies. I don't want to use only awt because well it does look horrible. And it takes LOTS of work to implement things like a proper tree view without Swing. So its swing or a suitable replacement (like swt/jface).

Yes, it is possible to use heavy weight components with swing. But the options are very limited, especially when the two cross on the z-axis – basically heavy weight will always lie above light weight components. (As an example, the awt canvas will be drawn above the scroll bars of its container, which breaks the whole concept of containers (or JDesktopPane for that matter))

As opposed to swing, swt/jface doesn’t have those problems because all components are drawn by the operating system anyway, so all components are “heavy weight”, in the awt/swing sense. Since opengl works like that anyway (machine not java drawn), one seems to be predestined to combine  swt/jface and lwjgl (for rich gui stuff). But then I really wanted to use MDIs, which swt/jface don’t handle at all. (And the swing implementation is very limited.)

On a whole I tend to discard the whole MDI concept (read a lot of criticism) but still stick to swing because I’m used to it. I will use the software renderer as a preview and popup an awtcanvas in a new window when the user wants one. Then Windows can sort out the problem and not me :)  It seems like the best trade-off to me at the moment, I’ll show you how it goes ;)

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #11 on: March 26, 2006, 05:45:42 pm »
If you’d like to have a look at the work in progress, here is a first early beta.

VisualJPCTv0.1Beta.zip


You can’t do much, but I am very proud of the undo/redo :)
Unzip and it should run. All apis are included in the zip. (oh, and its jave 5 stuff)

Features

import md2s
move/rotate camera
move objects
load/save scene
undo/redo object opperations

have fun  :P

Offline OHgaming

  • byte
  • *
  • Posts: 4
    • View Profile
    • http://projecttyr.ohgaming.com
"Visual" JPCT
« Reply #12 on: March 27, 2006, 05:19:15 pm »
Hey nice work so far!

I would suggest making it so 3ds files can be imported since that is what I use for the most part. I would also include a demo map or something with the release, but that's not a big deal. I can just go download some md2 files.

Also I would suggest adding shortcuts for the undo/redo functions. Again, not a big deal though and you might have already done it, but as I'm typing this I haven't had a chance to mess with a scene on this program yet.

Anyways this is looking very nice, espcially for a first release. Good luck, and I can't wait to see the next release.  :D

Offline Crate

  • byte
  • *
  • Posts: 25
    • View Profile
"Visual" JPCT
« Reply #13 on: March 28, 2006, 05:54:28 pm »
Thx for trying it out! I've just finished a new version. You can get the new jar here:

VisualJPCT.jar

Just copy it over the jar from the zip posted above. The external apis remain the same, but are needed - so get the above zip if you don't have it yet.

New features:

Import .3ds files
Changed scene save/load to enable saving/loading objects based on .3ds
Object rotation is in
Added menu mnemonics and accelerators for the guys at OHgaming :wink:

Again - if you have any suggestions, they are very welcome.
Have fun!

Offline Remo

  • int
  • **
  • Posts: 64
    • View Profile
    • http://www.opsdirector.com/3dart
"Visual" JPCT
« Reply #14 on: March 28, 2006, 07:34:12 pm »
Nice work on that :D.

Will it come with an animation window also?