Crystal Space
Welcome, Guest. Please login or register.
October 24, 2017, 01:09:44 am

Login with username, password and session length
Search:     Advanced search
9063 Posts in 2051 Topics by 77921 Members
Latest Member: Adisonashlin324
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  iHaze trouble
« previous next »
Pages: [1] Print
Author Topic: iHaze trouble  (Read 2004 times)

« on: April 01, 2006, 03:23:55 pm »

Hi I am trying to code a haze, but I cant seem to find it anywhere in my application Smiley

Can some of you see why my code wont display my haze? (the code doesnt generate any errors):

void Avatar::SetGlow(void) {

   // get engine, loader and sector
   csRef<iObjectRegistry> objReg = csApplicationFramework::GetObjectRegistry();

   csRef<iEngine> engine = CS_QUERY_REGISTRY (objReg, iEngine);
   csRef<iLoader> loader = CS_QUERY_REGISTRY (objReg, iLoader);
   csRef<iSector> sector = engine->GetSectors()->Get(0);

   // create mesh factory
   csRef<iMeshFactoryWrapper> haloFactory = engine->CreateMeshFactory("crystalspace.mesh.object.haze", "haze");

   // Load a texture for our haze.
   csRef<iTextureWrapper> txt = loader->LoadTexture ("spiff", "/lib/emergent/vir_textures/hazebasic.png");

   csRef<iMaterialWrapper> mat = engine->FindMaterial("spiff");

   // create iMeshWrapper
   csRef<iMeshWrapper> halo_sprite = engine->CreateMeshWrapper(haloFactory, "halo", sector, csVector3(0,0,0) );

   // create iHazeFactoryState
   csRef<iHazeFactoryState> haze_state ( SCF_QUERY_INTERFACE (haloFactory->GetMeshObjectFactory(), iHazeFactoryState) );

   // set material to iHazeFactoryState

   // create a hull for the haze
   csRef<iHazeHullCreation> hullcreate ( SCF_QUERY_INTERFACE (haze_state, iHazeHullCreation ));

   csRef<iHazeHullCone> cone = hullcreate->CreateCone(8, csVector3(0,0,0), csVector3(0,100,0), 10.0, 10.0);
   csRef<iHazeHull> result = SCF_QUERY_INTERFACE (cone, iHazeHull);

   haze_state->AddLayer( result, 1.0 );
   haze_state->SetLayerScale(0, 20.0);

Hero Member
Posts: 1706

View Profile
« Reply #1 on: April 01, 2006, 03:34:03 pm »

You are putting the haze at position 0,0,0. You are aware that hazes are not visible from the inside? Is the camera outside the area of the haze? I see you are using a big SetOrigin() for the haze. I think that's not a good idea. I would use a SetOrigin() of 0,0,0 and make sure the object is at the correct spot instead.


« Reply #2 on: April 01, 2006, 03:59:58 pm »

Hi Jorrit

Thanks for the fast reply Smiley

When I am putting my haze at position 0,0,0 are you referring to this line:

// create iMeshWrapper
csRef<iMeshWrapper> halo_sprite = engine->CreateMeshWrapper(haloFactory, "halo", sector, csVector3(0,0,0) );

or this one:

csRef<iHazeHullCone> cone = hullcreate->CreateCone(8, csVector3(0,0,0), csVector3(0,100,0), 10.0, 10.0);

I am not really sure which positions the haze?

I can move my camera around so I should be able to get outside the haze.

I have corrected the SetOrigin to 0,0,0

But you see no real reason why the haze wouldnt display, other than me having put it in som strange place?


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 3.175 seconds with 13 queries.