Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  .obj loading in java3d...  (Read 2219 times)
0 Members and 1 Guest are viewing this topic.
Offline jiapei100

Junior Member





« Posted 2009-12-22 08:19:53 »

I did notice my .obj file, which must have the true coordinate values like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
g main
# 75972 vertices.
v -58.1117 -49.4189 -12.242
v -58.0527 -50.0355 -11.9883
v -58.1128 -50.6568 -11.8222
v -58.1629 -51.2563 -11.7768
v -58.2183 -51.8611 -11.7323
v -58.2231 -52.4784 -11.7214
v -58.259 -53.0993 -11.7188
v -58.3331 -53.7061 -11.7407
v -58.3663 -54.309 -11.7328
v -58.3955 -54.9136 -11.7015
v -58.4142 -55.526 -11.6696
v -58.4299 -56.1264 -11.6939
v -58.427 -56.7551 -11.8301
v -58.4213 -57.3728 -12.0565
v -58.8783 -29.3341 -12.3035
v -58.8634 -29.9544 -12.0902
v -58.8288 -30.5471 -11.949
v -58.7427 -31.1332 -11.886
v -58.6354 -31.7285 -11.9012
v -58.5571 -32.331 -11.9593
...
v 55.3262 -54.4387 -11.2943
v 55.3417 -55.068 -11.3683
v 55.3343 -55.6911 -11.5067
v 55.3041 -56.3406 -11.6606
mtllib /.../filename.mtl
usemtl default
vt 0 0.198847 0.0
vt 0 0.195965 0.0
vt 0 0.193084 0.0
vt 0 0.190202 0.0
vt 0 0.18732 0.0
vt 0 0.184438 0.0
vt 0 0.181556 0.0
vt 0 0.178674 0.0
...



I read this ".obj" manually in C/C++. However, now, I've got to display this .obj object in java3D.
And, I did it successfully !!

However, my current code looks like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
int flags = ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY | ObjectFile.RESIZE;
ObjectFile f = new ObjectFile(flags, 0.0f);
m_S = null;
try {
   m_S = f.load(fname);
} catch (FileNotFoundException e)
{
        ...
}
m_BGFace = m_S.getSceneGroup();
m_Object3d = (Shape3D)m_BGFace.getChild(0);
Bounds m_ObjBounds = m_Object3d.getBounds();


My question is, how can I retrieve values in "v" rather than values in "vt" from variable m_S?Huh?
How can I retrieve the values around tens, but not just retrieve those values between -1.0 and 1.0 ?

Thanks in advance and Merry XMas.
Seriously Urgent.

Please do help.

Best Regards
JIA



Welcome to Vision Open
http://www.visionopen.com
Offline jiapei100

Junior Member





« Reply #1 - Posted 2009-12-24 02:45:10 »


Please refer to http://forums.java.net/jive/thread.jspa?messageID=377273


I found the problem comes from
int flags = ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY | ObjectFile.RESIZE;

If I revised it to
int flags = ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY;

This might bring me a non-resize loading, but fail to show it in the screen.

I'm wondering whether I can load it like
int flags = ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY;

but afterwards, I may add "ObjectFile.RESIZE" back into the loaded Scene so that it should be able to display in the view directly?

Cheers
JIA






Welcome to Vision Open
http://www.visionopen.com
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (67 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!