Crystal Space
Welcome,
Guest
. Please
login
or
register
.
June 20, 2013, 01:37:28 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
9262
Posts in
2263
Topics by
5444
Members
Latest Member:
Summonermw2
Crystal Space
Crystal Space Development
General Crystal Space Discussion
Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
« previous
next »
Pages:
[
1
]
Author
Topic: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects? (Read 3918 times)
kornerr
Full Member
Posts: 101
Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
on:
March 31, 2006, 10:18:57 am »
How should I modify "simple" to create any of these mesh objects?
I can't get any of them working. I'm sure the problem is due to incorrect initializaion. But the manual provides NO example how to do it.
Can anyone help me?
Thanks.
Logged
OSRPG (Open Source RPG)
CS Manual in Ru (will not be continued)
Open Source all the way, baby
jorrit
Administrator
Hero Member
Posts: 1703
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #1 on:
March 31, 2006, 10:33:54 am »
Quote from: kornerr on March 31, 2006, 10:18:57 am
How should I modify "simple" to create any of these mesh objects?
I can't get any of them working. I'm sure the problem is due to incorrect initializaion. But the manual provides NO example how to do it.
Can anyone help me?
Thanks.
Did you check the mazetut tutorial in the manual? It gives an example on how to make a particles mesh object.
Greetings,
Logged
kornerr
Full Member
Posts: 101
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #2 on:
March 31, 2006, 10:52:13 am »
Can you please point me to the neccessary chapter in the manual?
Thanks.
Logged
OSRPG (Open Source RPG)
CS Manual in Ru (will not be continued)
Open Source all the way, baby
jorrit
Administrator
Hero Member
Posts: 1703
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #3 on:
March 31, 2006, 10:53:45 am »
Quote from: kornerr on March 31, 2006, 10:52:13 am
Can you please point me to the neccessary chapter in the manual?
Thanks.
Section 4.2.4. It is the 'Mazing' tutorial.
Greetings,
Logged
kornerr
Full Member
Posts: 101
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #4 on:
March 31, 2006, 02:59:29 pm »
Thanks, it works fine. But I can't create, e.g., snow. Can you give an example of how to create snow? There's no iSnowFactoryState or anything, so I'm at a loss (
Thanks.
Logged
OSRPG (Open Source RPG)
CS Manual in Ru (will not be continued)
Open Source all the way, baby
jorrit
Administrator
Hero Member
Posts: 1703
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #5 on:
April 01, 2006, 02:30:54 pm »
Snow is one of the old particle systems and it works a bit differently. You have to create an empty snow factory and set the snow parameters (using iSnowState) on the mesh object.
Greetings,
Logged
kornerr
Full Member
Posts: 101
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #6 on:
April 16, 2006, 08:45:23 am »
Code:
- - - -
if (!loader->LoadTexture ("rain_tex", "/lib/std/spark.png"))
ReportError ("Failed to load \"rain\" texture");
csRef<iMaterialWrapper> rain_tex_mw = engine->GetMaterialList ()->FindByName (
"rain_tex");
csRef<iMeshFactoryWrapper> rain_mfw = engine->CreateMeshFactory (
"crystalspace.mesh.object.rain", "rain");
if (!rain_mfw)
cout << "no rain_mfw initialized!\n";
csRef<iMeshWrapper> rain_itself = engine->CreateMeshWrapper (rain_mfw, "rain_itself",
0, csVector3 (0, 0, 0));
rain_itself->SetZBufMode (CS_ZBUF_TEST);
cout << "aaa\n";
csRef<iRainState> rain_state = csQueryRegistry<iRainState> (GetObjectRegistry ());
if (!rain_state)
cout << "no rain_state!\n";
rain_itself->GetMeshObject ()->SetMaterialWrapper (rain_tex_mw);
rain_state->SetMixMode (CS_FX_ADD);
rain_itself->GetMeshObject ()->SetColor (csColor (0.5, 0.5, 0.8));
rain_state->SetParticleCount (100);
rain_state->SetDropSize (1, 1);
rain_state->SetLighting (false);
rain_state->SetBox (csVector3 (-5, 0, -5), csVector3 (5, 10, 5));
rain_state->SetFallSpeed (csVector3 (0, -1, 0));
- - - -
So the app does say "no rain_state!". Why no rain_state? What am I missing?
Thanks.
Logged
OSRPG (Open Source RPG)
CS Manual in Ru (will not be continued)
Open Source all the way, baby
jorrit
Administrator
Hero Member
Posts: 1703
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #7 on:
April 18, 2006, 07:46:38 am »
You are trying to get rain state from the object registry. That's wrong. You must get it from the mesh object using scfQueryInterface.
Greetings,
Logged
kornerr
Full Member
Posts: 101
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #8 on:
April 18, 2006, 10:13:05 am »
Thanks, I've made:
Code:
csRef<iRainState> rain_state = scfQueryInterface<iRainState> (rain_itself->GetMeshObject ());
all compiles ok, but I can't see any rain (
What's wrong?
Thanks.
Logged
OSRPG (Open Source RPG)
CS Manual in Ru (will not be continued)
Open Source all the way, baby
jorrit
Administrator
Hero Member
Posts: 1703
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #9 on:
April 18, 2006, 10:19:01 am »
Try:
rain_state->SetMaterialWrapper (rain_tex_mw);
instead of:
rain_itself->GetMeshObject ()->SetMaterialWrapper (rain_tex_mw);
Greetings,
Logged
kornerr
Full Member
Posts: 101
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #10 on:
April 18, 2006, 11:34:19 am »
I've made
Code:
rain_state->SetMaterialWrapper (rain_tex_mw);
and even tried
Code:
rain_state->SetColor (csColor (0.5, 0.5, 0.8));
but still no rain (
Logged
OSRPG (Open Source RPG)
CS Manual in Ru (will not be continued)
Open Source all the way, baby
jorrit
Administrator
Hero Member
Posts: 1703
Re: Minimal code to use Emitter, Fountain, Fire, Snow, Rain, etc. mesh objects?
«
Reply #11 on:
April 18, 2006, 11:36:34 am »
Sorry, no idea then. Check the code in apps/walktest/walkdemo.cpp. There is code there to create rain. Perhaps you can see what you did wrong there.
Greetings,
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Crystal Space Development
-----------------------------
=> General Crystal Space Discussion
=> Support
-----------------------------
Crystal Space Project Development
-----------------------------
=> Feature Requests
=> Plugins
=> Bug Reports
-----------------------------
Crystal Space Development
-----------------------------
=> Game Content Creation
-----------------------------
Miscellaneous
-----------------------------
=> Article/Tutorial Requests
=> Article/Tutorial Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Development Discussion
-----------------------------
Crystal Space Projects
-----------------------------
=> Project Discussion
=> WIP Projects
=> Finished Projects
-----------------------------
Associate Projects
-----------------------------
=> CEL Discussion
=> Crystal Core Discussion
=> CrystalBlend Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Google Summer of Code
-----------------------------
Associate Projects
-----------------------------
=> Apricot (Open Game)
=> Ares Project
Loading...