Crystal Space
Welcome, Guest. Please login or register.
October 23, 2014, 01:42:15 am

Login with username, password and session length
Search:     Advanced search
9010 Posts in 2044 Topics by 8794 Members
Latest Member: Mirroy65
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Project Development
| |-+  Bug Reports
| | |-+  CVS simple seg. fault
« previous next »
Pages: [1] Print
Author Topic: CVS simple seg. fault  (Read 6706 times)
Sl0w
Newbie
*
Posts: 7


View Profile Email
« on: July 21, 2005, 10:34:18 am »

Heyya, to reproduce it, modify the simple1.cpp so you replace the line

walls_state->AddInsideBox (csVector3 (-30, 0, -30), csVector3 (30, 20, 30));

with

 walls_state->AddQuad(csVector3(-15, -10, -5), csVector3(6, -10, -5), csVector3(6,10,-5), csVector3(-10,10, -5));
 walls_state->AddQuad(csVector3(-10, 10, 15), csVector3(6, 10, 15), csVector3(6,-10,15), csVector3(-15,-10, 15));
.
It works ok if you only add one mesh to the sector, if you add more it seg. faults, at least for me.
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: July 21, 2005, 07:01:01 pm »

Heyya, to reproduce it, modify the simple1.cpp so you replace the line

walls_state->AddInsideBox (csVector3 (-30, 0, -30), csVector3 (30, 20, 30));

with

 walls_state->AddQuad(csVector3(-15, -10, -5), csVector3(6, -10, -5), csVector3(6,10,-5), csVector3(-10,10, -5));
 walls_state->AddQuad(csVector3(-10, 10, 15), csVector3(6, 10, 15), csVector3(6,-10,15), csVector3(-15,-10, 15));
.
It works ok if you only add one mesh to the sector, if you add more it seg. faults, at least for me.

Can you show me the code that you use to add more meshes?

Greetings,
Logged
Sl0w
Newbie
*
Posts: 7


View Profile Email
« Reply #2 on: July 22, 2005, 10:39:01 am »

This is the relevant part:

void Simple::CreateRoom ()
{
  // Load the texture from the standard library.  This is located in
  // CS/data/standard.zip and mounted as /lib/std using the Virtual
  // File System (VFS) plugin.
  if (!loader->LoadTexture ("stone", "/lib/std/stone4.gif"))
    ReportError("Error loading 'stone4' texture!");

  iMaterialWrapper* tm = engine->GetMaterialList ()->FindByName ("stone");

  // We create a new sector called "room".
  room = engine->CreateSector ("room");

  // Creating the walls for our room.
  csRef<iMeshWrapper> walls (engine->CreateSectorWallsMesh (room, "walls"));
  csRef<iThingState> ws =
    SCF_QUERY_INTERFACE (walls->GetMeshObject (), iThingState);
  csRef<iThingFactoryState> walls_state = ws->GetFactory ();
   walls_state->AddQuad(csVector3(6, -10, 10), csVector3(6,10,10), csVector3(6,10,-5), csVector3(6,-10,-5));
    walls_state->AddQuad(csVector3(-15, -10, -5), csVector3(6, -10, -5), csVector3(6,10,-5), csVector3(-10,10, -5));
 
  walls_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
  walls_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3);
 
 
  // Now we need light to see something.
  csRef<iLight> light;
  iLightList* ll = room->GetLights ();

  light = engine->CreateLight(0, csVector3(-3, 5, 0), 10, csColor(1, 0, 0));
  ll->Add (light);

  light = engine->CreateLight(0, csVector3(3, 5,  0), 10, csColor(0, 0, 1));
  ll->Add (light);

  light = engine->CreateLight(0, csVector3(0, 5, -3), 10, csColor(0, 1, 0));
  ll->Add (light);
}

it seg. faults when I want to add more than one mesh to a sector. with or without lighting. The rest of the code is the same as in simple1.cpp
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: July 22, 2005, 10:40:43 am »

The problem is in these calls:

Code:
  walls_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
  walls_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3);

These will only set the material and texture mapping for the last added thing. In your case that is the last quad. You need to use CS_POLYRANGE_ALL instead of LAST.

Greetings,
Logged
Sl0w
Newbie
*
Posts: 7


View Profile Email
« Reply #4 on: July 22, 2005, 11:08:41 am »

Hmm, sorry 'bout that. workes sweet now.
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.153 seconds with 17 queries.