Crystal Space
Welcome, Guest. Please login or register.
November 21, 2014, 07:21:54 pm

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2046 Topics by 9089 Members
Latest Member: Dariurm
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  Manipulating CS "world"
« previous next »
Pages: [1] Print
Author Topic: Manipulating CS "world"  (Read 3114 times)
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« on: February 02, 2006, 11:32:02 pm »

I interested in: How can I manipulate the wolds things? For exapmle: I got a blend2cs export .zip in "world" file. I loaded it. This is simple scene: a room a box and a light.
I want to delete the box from scene and on/off light when the program running. It is possible?
Logged
rvl_
Newbie
*
Posts: 27


View Profile
« Reply #1 on: February 03, 2006, 12:29:44 am »

Somehing like this:

//to remove box
iMeshWrapper* box = engine->FindMeshObject("name of box in map file");
if (box) engine->RemoveObject(box);

//to turn off/on light
iLight* light = engine->FindLight ("name of light in map file", false);
float initial_cutoff = light -> GetCutoffDistance();

//turn off
if (light) light->SetCutoffDistance(0.0f);

//turn on
if (light) light->SetCutoffDistance(initial_cutoff);

For more info you can see API documentation of iEngine, iLight interfaces
http://crystalspace3d.org/docs/online/api/classes.php
Logged
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« Reply #2 on: February 03, 2006, 04:11:11 pm »

Now I loaded the empty room and cube from different "world" files. The progam displayed the cube but I dont  want it. If I remove the cube I see it and I can't call it and clone later.

//-----------------------------------------------------------------------------
bool Simple::CreateRoom1()
{
    room = engine->CreateSector ("room");

    //map toltese
    csRef<iVFS> VFS (CS_QUERY_REGISTRY (GetObjectRegistry (), iVFS));
    //VFS->Mount("test", "data/tetrisTestNoCube1.zip");
    VFS->Mount("test", "data/tetrisTestNoCube1.zip");
    VFS->ChDir ("test");                //a jelenet eleresenek megadasa VFS-ben
    if (!loader->LoadMapFile ("world")) //a .zip ben a world file a map file
    ReportError("Error couldn't load level!");

    return false;
}



//-----------------------------------------------------------------------------
bool Simple::LoadModel()
{
    csRef<iVFS> VFS (CS_QUERY_REGISTRY (GetObjectRegistry (), iVFS));
    VFS->Mount("model", "data/tetrisTestCube1.zip");
    VFS->ChDir ("model");               //a jelenet eleresenek megadasa VFS-ben
    loader->Load ("world", model);

    iMeshFactoryWrapper* factory = engine->FindMeshFactory ("thingmetalFrame1");
    if (factory) engine->RemoveObject(factory);

    return false;
}



//-----------------------------------------------------------------------------
void Simple::CreateSprites ()
{
    iMeshFactoryWrapper* factory = engine->FindMeshFactory ("thingmetalFrame1");

    mesh[modells] = engine->CreateMeshWrapper (factory, "MySprite", room,
    move_down(0));
    csMatrix3 m; m.Identity();
    mesh[modells]->GetMovable()->SetTransform (m);
    mesh[modells]->GetMovable()->UpdateMove ();
}
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: February 03, 2006, 04:13:31 pm »

I don't understand your question. What is the problem?

Greetings,
Logged
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« Reply #4 on: February 03, 2006, 04:24:35 pm »

Well this is may test scene. I want to create cube modells. But it show the cube on the floor unfortunately. If I removed the cube I can't create it never.
« Last Edit: February 03, 2006, 04:46:24 pm by [SOM]Roberto » Logged
rvl_
Newbie
*
Posts: 27


View Profile
« Reply #5 on: February 03, 2006, 06:56:15 pm »

to Roberto
Delete MeshObject, not MeshFactory. Then you can create new object from the factory.
Logged
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« Reply #6 on: February 03, 2006, 07:25:04 pm »

to Roberto
Delete MeshObject, not MeshFactory. Then you can create new object from the factory.

If I deleting the mesh object I can see the cube on the floor.

//-----------------------------------------------------------------------------
bool Simple::LoadModel()
{
    csRef<iVFS> VFS (CS_QUERY_REGISTRY (GetObjectRegistry (), iVFS));
    VFS->Mount("model", "data/tetrisTestCube1.zip");
    VFS->ChDir ("model");
    loader->Load ("world", model);
   
    iMeshWrapper* box = engine->FindMeshObject("thingmetalFrame1");
    if (box) engine->RemoveObject(box);

    return false;
}
Logged
[SOM]Roberto
Jr. Member
**
Posts: 79


View Profile Email
« Reply #7 on: February 03, 2006, 08:18:32 pm »

Okay. My modeller maked a hide cube. If I loaded it I can't see. If I make sprite I can see cubes. Tongue
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 7.428 seconds with 17 queries.