Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi, I noticed that there were many messages about importing models with Copperlicht and that you can only use ccbjs-models. However in tutorial 3 it says: Scene nodes can draw different things in CopperLicht, the most common thing is probably the MeshSceneNode, which draws a chunk of 3d geometry, for example an imported 3D Studio .3ds file. That kinda got me confused. Is it possible to import .3ds files without the Coppertube or not? |
||||
|
Yeah, the difference is that you can import some common formats like 3ds, dae, obj etc.. Easy! But if you want to load objects (or scenes) at runtime - than you have no other option than loading ccbjs-files. Means you load a model while playing your app. It depends on what you are trying to do: importing or loading stuff. Reg Kk |
||||
|
Thanks. Got any tips for the syntax of importing .3ds-models? I'm kinda new to WebGL and Copperlicht. Should I use the .3ds-model's file path as setMesh()-function's parameter? Or should I use it in some CL3D.MeshBuffer function? |
||||
|
I mean, is there a simple function for the buffers which takes my .3ds-file's filepath as parameter and that's it? |
||||
|
No |
||||
|
So the only way to use .3ds-files is to parse them to arrays of ints some how and then just give the indices/vertices to the buffers? Yeah, the difference is that you can import some common formats like 3ds, dae, obj etc.. Easy! Just wondering what KK meant with this comment. What's the difference between importing and loading? Importing is parsing the file yourself and loading is to use the Copperlicht ccbjs-loader? |
||||
|
Oic.. Sorry man I thought you are mentioning "Coppertube " > actually "CopperCube".. Its the framework-program of the CopperLicht engine In this framework you can import several formats (3ds, dae etc..). You can import them into CopperCube and publish the whole scene at the target of your choice.. Using CopperLicht engine only requires you to load stuff as ccbjs-format.. You could not "import" (better say load) anything else with this engine. If you want to use Copperlicht engine only - means dealing with code only.. But to get the format which the engine can handle you got to IMPORT your objects into CopperCube and publish them as ccbjs.. You can now LOAD this file via the Copperlicht engine.. Bam! Also: there is a batch-converter which converts all this into ccbjs. Never tried it, yet though. Hope that helps KK |
||||
|
Initialising the main-scene via Copperlicht - See here: var engine = startCopperLichtFromFile('3darea', 'copperlichtdata/TestScene.ccbjs'); Means you are loading the main sceneYou can additionally load other objects (or scenes) at any point later.. Using ccbjs-files only |
||||
|
Thanks. Yeah I meant CopperCube when I said 'Coppertube'. But anyways everything is clear now :) |
||||
|
Thanks to liberal code reuse and a study of tutorial 3, here's the start of a 3ds mesh loader. I included a XMLHttpRequest wrapper function and the createVertex function from the tutorial:
In addition to copperlicht.js, lib3s.js and binary-parser.js are required; the associated source urls are in the comments. It only loads meshes, no materials... |
||||
|
Hi G, does that mean you actually are able to externally load .3ds-files via Copperlicht engine?!?!? |
||||
|
KK wrote: Hi G, does that mean you actually are able to externally load .3ds-files via Copperlicht engine?!?!? Uh, yes. You call load load3dsMesh("http://some.site/some-3ds.3ds"), and it'll return a Copperlicht Mesh made of the points, indices, and texels of the meshes from the .3ds file. You can then put that Mesh in a MeshSceneNode with its setMesh() method. Purely a demonstration of layered reuse, it uses lib3ds.js, written by a guy named Tim Knip, who in turn uses binary-parser.js, written by a guy named Jonas Raoni Soares Silva. My code simply takes the read-in mesh values and stuffs them in to the Copperlicht Mesh variables. I didn't know anything about the .3ds format, but Tim did. He didn't have a grasp of parsing binary data in javascript, but Jonas did. So, I'm not really smart, just clever... :D All, note that I have used this code to successfully load a MIG-21 model containing 5 meshes, but I have not actually used the function itself, that being a quick cut-n-paste into a form suitable for posting here. If you find bugs, let me know... |
||||
|
|