Crystal Space
Welcome, Guest. Please login or register.
November 29, 2014, 07:36:04 am

Login with username, password and session length
Search:     Advanced search
9026 Posts in 2046 Topics by 9160 Members
Latest Member: Bradburke
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  How to use Emitter Mesh Object?
« previous next »
Pages: [1] Print
Author Topic: How to use Emitter Mesh Object?  (Read 3149 times)
kornerr
Full Member
***
Posts: 101


347968356
View Profile WWW Email
« on: March 28, 2006, 07:16:07 am »

So far I have this:
Code:
    emitter_fact = engine->CreateMeshFactory ("crystalspace.mesh.object.emit",
            "emitter_fact");
    csRef<iEmitFactoryState> emitter_fact_state = SCF_QUERY_INTERFACE (
            emitter_fact->GetMeshObjectFactory (), iEmitFactoryState);
    emitter_fact_state->CreateSphere ();
    csRef<iMeshWrapper> emitter = engine->CreateMeshWrapper (emitter_fact, "emitter",
            room, csVector3 (0, 5, 0));
    csRef<iEmitState> emitter_state = SCF_QUERY_INTERFACE (emitter->GetMeshObject (),
            iEmitState);
    emitter_state->AddAge (1000, csColor (255, 0, 0), 0, 0.1, 0.1, 1);
    emitter_state->SetLighting (true);
    emitter_state->SetParticleCount (30);
    emitter_state->SetRegularParticles (3, 0.5);
The app SegFaults at engine->Prepare ()
What's wrong here?

Thanks.
Logged

jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: March 28, 2006, 08:04:20 am »

Why do you think it has something to do with the emitter?

Greetings,
Logged
kornerr
Full Member
***
Posts: 101


347968356
View Profile WWW Email
« Reply #2 on: March 28, 2006, 08:30:26 am »

Because without these lines everything works ok.
So where am I doing wrong?

Thanks.
Logged

jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: March 28, 2006, 08:45:41 am »

Because without these lines everything works ok.
So where am I doing wrong?

Thanks.

I need to see the entire code.

Greetings,
Logged
kornerr
Full Member
***
Posts: 101


347968356
View Profile WWW Email
« Reply #4 on: March 28, 2006, 08:55:15 am »

http://kornerr.users.kemcity.ru/download/simple_without_pics.tar.bz2 [4K]
Logged

kornerr
Full Member
***
Posts: 101


347968356
View Profile WWW Email
« Reply #5 on: March 29, 2006, 09:34:52 am »

Any suggestions?
Logged

kornerr
Full Member
***
Posts: 101


347968356
View Profile WWW Email
« Reply #6 on: March 31, 2006, 10:30:09 am »

Now I use the following code, but still only SegFault when engine->Prepare ():
Code:
bool Simple::Application () {
- - - -
    csRef<iMeshObjectType> emit_type = CS_LOAD_PLUGIN (plugin_mgr,
            "crystalspace.mesh.object.emit", iMeshObjectType);
    emit_fact = emit_type->NewFactory ();
- - - -
}

void Simple::CreateRoom () {
- - - -
    csRef<iMeshObject> emit_obj = emit_fact->NewInstance ();
    csRef<iMeshWrapper> emitter = engine->CreateMeshWrapper (emit_obj, "emitter",
            room, csVector3 (0, 5, 0));
    csRef<iEmitFactoryState> emitter_fact_state = SCF_QUERY_INTERFACE (
            emit_fact, iEmitFactoryState);
    emitter_fact_state->CreateSphere ();
    csRef<iEmitState> emitter_state = SCF_QUERY_INTERFACE (emit_obj,
            iEmitState);
    emitter_state->AddAge (1000, csColor (255, 0, 0), 0, 0.1, 0.1, 1);
    emitter_state->SetLighting (true);
    emitter_state->SetParticleCount (30);
    emitter_state->SetRegularParticles (3, 0.5);
- - - -
}
What am I doing wrong?
Logged

jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #7 on: March 31, 2006, 10:34:42 am »

Check in a debugger to see where exactly it crashes and why. i.e. examine the stack backtrace to see what it is trying to do.

Greetings,
Logged
kornerr
Full Member
***
Posts: 101


347968356
View Profile WWW Email
« Reply #8 on: March 31, 2006, 10:37:45 am »

backtrace: http://www.everfall.com/paste/id.php?i9mqcni711w3

can YOU explain what it's trying to do? i can't get any clue.
Logged

jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #9 on: March 31, 2006, 10:45:38 am »

You'll have to recompile CS and your application in debug mode (for cs configure with --enable-debug). Otherwise this is not useful.

Greetings,
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.181 seconds with 15 queries.