BUT due to a probably misuse of php script become quite slow for bigs objects. If a php specialist have an idea ?

Feedback welcomes.

BE REALLY CARREFULL: google sketchup file are very heavy, lot's of vertex sometime simple objects. Needed to be used with attention, Sofa resulting .tri file is for example 27Mbyte file (cocorobrix is less than 3Mbyte!!!!!).

Having a look at the code, it seems that kmz is some sort of archive with collada mesh inside ? Am I right ? Strange it's not a very known fact ...

Quick note : There's a few annoying windows only paths in the file ("\\") making that script failing here, should use good old sanitized standard polished stable recognized POSIX paths

About speed, the only thing I can say is that PHP isn't as good about memory management as a compiled language ... While working on DirectX-to-tri PHP script, I've seen incredible things ... For instance, on the first version of the script, I was using global variables and references (&), to simplify work for PHP (no need to copy parameter for functions). Even with this, the script was damn slow. Almost by error, I've moved to regular (copy) parameters for functions, and the script suddenly increased its speed by 10x ! The only thing I've learned then is not that you should use parameter by copy, but that PHP is simply out of any logic when it comes to (big) memory management.

What's the precise relation between Collada and Kmz ? I think this demo can be added in the "contrib/" directory, as an example about how importing .kmz files, more than some sort of "official support" for this format that may confuse users. Am I wrong ? (or even clear :)

Here's the point: IMHO, the "root" directory of the trunk is supposed to show demos, example, sample applications and official tools (JPGS generation, atm_gen.c, cam.c, ...)

If you think this code can fit in one of these categories, then let's add it to the trunk

To do so, here's what should be done IMHO:- comment at the top of test_kmz.c should be changed- comment at the top of collada_2_tri.php is missing (even a very simple one)- the application should be a little more explicit about its role, using a short text at the top, or a title somewhere, ...- needs error checking (giving a non-existing file shows no particular error, for instance. Same seems to apply when the file type is unknown.)- C and PHP files should share the same name, so the user understand the link between the two files- (remove GCC warning: ambiguous ‘else’ at line 43)- http://sketchup.google.com seems to provide mostly "skp" files. How should I do ?

I think you see my point: currently, this code is not easily usable to the user to be provided as a tool or a demo, so the two choices I see are :- we see this as a "proof-of-concept", and plance it in the contrib dir.- we upgrade this as a tool, polishing it and thinking about how the user will see it and use it.

- itoa() is not a standardized function, therefore not available on every platform. Linux does not provides it, for instance - gcc warning: kmz_2_tri.c:59: warning : suggest explicit braces to avoid ambiguous ‘else’- still a lot of missing error checking (about files at least) in the PHP file. Since I'm not able to get a proper kmz file (I think ... see the next point), I've still the console flooded by messages like:

Code:

Raydium: Warning: fgets(): supplied argument is not a valid stream resource in /home/xfennec/opengl/kmz_2_tri.php on line 588 Raydium: Warning: feof(): supplied argument is not a valid stream resource in /home/xfennec/opengl/kmz_2_tri.php on line 586

Same story when I try to open a non existing file, it leads to a crash.

While talking about this, I'm not sure to understand convert_xml_iso()'s goal. It does not sounds very XML, am I wrong

Last point, as said in my last post:

Quote:

http://sketchup.google.com seems to provide mostly "skp" files. How should I do ?

here is a newer version, most of corrections where dones, but i don't know why i forget to post results

- no more itoa- added braces- filename tests, one small correction in php. And error handling in raydium application. I hope it's enough.

- no more crash if file doesn't exist

-convert_iso_xml: it's really ennoying. If the xml header of the file, is type of utf8 it is not parsed correctly by xpath. I don't know why. I've searched why, and i still don't know. I propose this small "hack" it allow script to work. I hope next version of php handle this correctly, or some one help me to understand why.My sketchup generated kmz file are ok, but getting some file from internet raise the problem.

- skp file are sketchup files. kmz file can be generated by skectchup, in file->export.

Last but not least, this script is a collada parser. And collada file format is quite well supported now. So even if it is not used for sketchup it can be usefull for collada translation.

Here is the last version. Can you make some tests ... and if it's ok i'll like to add thoses files to raydium "official" directory.

- I'm unable to open kmz files (see below for verbose log)- Test for gd is wrong (generates an syntax error when extension is not present) . And we should perhaps include gd in our PHP distribution ?- You should rework a bit your (interesting) help message, in the application:"in Sketchup export file in .kmz format" -> ? "Are now in your writable directory" -> "are now created in your writable directory" ?remove obvious states: "Enter name and click Load" and "You can specify an output mesh scale", the application is self explaining on this.add the fact that it supports other file format ? (dae, for instance, no ?)

This is a tiny change, probably, but all this should be simple and clear for the newbie

Warning: fopen(C:\Users\Xfennec\AppData\Local\Temp/kmz/models/test.dae): failed to open stream: No such file or directory in C:\data\raydium_bordel\raydium_win32_ide_sdk_1025\bin\kmz_2_tri.php on line 586

Just a quick note on this subject (or I will forget it ) after talking with ouille on this point: we need to work a little bit on error checking: my kmz file is not correct, that why I had all these error lines I talk about in my last post, and the script should report this issue.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum