ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator loading 3d model
person icon
samehhelaly
Registered User
Quote
2013-05-02 14:16:41

hi ,, i have read a lot of Discussions here about loading model from disk and i understand that you can only load from ccbjs and the question is if i want to load 3d model should i load it i n coppercube first and save it in ccbjs and then use it by loading it inside the main world ccbjs file ...i mean load ccbjs contain only 3d model inside main world ccbjs file ...am i right?

person icon
niko
Moderator
Quote
2013-05-03 06:13:02

Yes, that's right. The best way is to add all files into one ccbjs file. But you can also import other .ccbjs files during runtime using CopperLicht.

person icon
samehhelaly
Registered User
Quote
2013-05-03 20:26:44

can you give me example of two ccbjs one is 3d model and the other is the main scene

person icon
niko
Moderator
Quote
2013-05-05 08:40:01

You can just start up copperlicht and call
engine.load('yourfile.ccbjs');

To load another file. See this:
http://www.ambiera.com/copperlic...

person icon
sweaver
Registered User
Quote
2013-10-07 20:08:49

can you give me example of two ccbjs one is 3d model and the other is the main scene


I just had this same question in another topic. That link appears to be broken though, so can you post some sample code? Thanks.

EDIT: I tried the following, but none of them worked.

> Calling engine.load() once for the main one and once for the model I'm trying to load (engine.getScenes() still only returns the most recent one that was loaded and the other scene seems to get lost)
> Creating two engine instances bound to the same canvas (the canvas flickers between the two)
> Creating two engines and two canvases (I'm unable to move items from one context to the other)

person icon
niko
Moderator
Quote
2013-10-09 08:37:36

I'll look into this and see what can be done about it.

person icon
jquindlen
Registered User
Quote
2013-10-10 02:06:50

I haven't tested this code, but wouldn't something like this work:


var savedModel1 = null // Global var
engine = new CL3D.CopperLicht('3darea', true, 60, true);
engine.load('copperlichtdata/3dmodels.ccbjs');
engine.ingComplete = function() {
var scene = engine.getScene();
if (scene) {
savedModel1 = scene.getSceneNodeFromName('model1');
}
}

engine.load('copperlichtdata/mainscene.ccbjs');
engine.ingComplete = function() {
var scene = engine.getScene();
if (scene) {
scene.getRootSceneNode().addChild(savedModel1);
}
}



person icon
jquindlen
Registered User
Quote
2013-10-10 02:08:18

^ above should read: engine.ingComplete but the forum was stripping it out for some reason

person icon
jquindlen
Registered User
Quote
2013-10-10 02:08:42

e n g i n e . O n L o a d i n g C o m p l e t e

person icon
niko
Moderator
Quote
2013-10-10 12:22:46

yes, that should work.

person icon
madalin
Registered User
Quote
2015-05-25 02:35:55

The code doesn't work as it is. It need a delay because the second engine.OnLoa_dingComplete take the control before the first engine.OnLoa_dingComplete is finished completely.

Something like this:

var savedSphere = null;
engine.load('copperlichtdata/sphere.ccbjs');
engine.OnLoa_dingComplete = function() {
var scene = engine.getScene();
if (scene) {
savedSphere = scene.getSceneNodeFromName('sphereMesh1');
}
}

function callback(){
return function(){

engine.load('copperlichtdata/cube.ccbjs');
engine.OnLoa_dingComplete = function(){
var scene = engine.getScene();
if (scene) {
scene.getRootSceneNode().addChild(savedSphere);
}
}

}
}
setTimeout(callback(), 10);


This is a sample about how to load a sphere in a main scene (cube.ccbjs). First loading cube.ccbjs. Then loading sphere.ccbjs and get the savedSphere as javaScript object. Finaly reloading cube.ccbjs and adding savedSphere.

http://estudio3d.eu/coppercube/t...

But this is a little bit weird, loading and saving, than reloading (with the blinking delay). But only we can load objects in the same main scene. The loaded objects disappear on reloading the main scene.

How could I push ccbjs geometry (copperlicht SDK) without losing the previous added geometry?


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |