Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  SDK Support    Using Multiple Scenes
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Is it possible to use multiple scenes that all use the same repository? I want to load some instances and geometries into the repository and then use them in multiple scenes.

The problem I am seeing is that when the first scene is destroyed it seems to unconditionally remove the objects from the repository (specifically, the geometries are removed). At that point, I cannot then reference those things correctly in the other scene.

Here's the code that causes the removal:

. ipMTSScene->Terminate();
. ipMTSScene = 0;

This is the sequence that I follow:

1. Create scene1
2. Load objects into scene1/repository
3. Create scene2
4. Do something for a bit
5. Delete scene2

6. Objects are removed even though they are still referenced in scene1

I see from the example that multiple scenes are supported, but I don't know if I can share objects between them (I only want to load these objects once).

TIA, Loz.
 
Posts: 13 | Location: Abingdon, Oxfordshire, UK | Registered: March 26, 2003Reply With QuoteEdit or Delete MessageReport This Post
<Niko>
Posted
You're right.
it looks like we have a bug here.
what i propose to you, is to remove from the tree, manually, all the instances/geometries you want to keep in the repository.
 
Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
I tried that and it *nearly* fixed the problem. When I issue the ipMTSScene->Terminate() call, *all* the geometries still disappear, even if they were never used in scene2. So I tried:

ipMTSScene->RemoveInstance(0);
ipMTSScene->SetSceneRepository(NULL);
ipMTSScene->Terminate();
ipMTSScene = 0;

Which works with one exception. ipMTSRepository->GetActiveCount(1) goes up and up and up (once for each time I recreate scene2). What is table 1 used for and how do I get the scene to release its reference to this object before calling Terminate(). Leaving things as they are gives me a memory leak.

TIA, Loz.
 
Posts: 13 | Location: Abingdon, Oxfordshire, UK | Registered: March 26, 2003Reply With QuoteEdit or Delete MessageReport This Post
<Niko>
Posted
LozCool, actually it works as expected....
i explain:
the instance itself can NOT be shared by multiple scene, because the instance store a pointer on the scene to be able to do some operation on it (Like invalidating some flags)
However the geometry (like any assets) do not needs the scene to work and can be used in multiple scenes.
so what you need to do is to share the geometries but NOT the instances.
it will fix your problem.
 
Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thanks Niko, I will look into changing how it works.

When you mentioned flags I think this might also explain another problem I was seeing where a shadow on the same instance in two scenes was being displayed sometimes but not others. Obviously, the shared instances are affecting things that they shouldn't.

Loz.
 
Posts: 13 | Location: Abingdon, Oxfordshire, UK | Registered: March 26, 2003Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  SDK Support    Using Multiple Scenes