Crystal Space
Welcome, Guest. Please login or register.
December 19, 2014, 04:23:32 am

Login with username, password and session length
Search:     Advanced search
9032 Posts in 2046 Topics by 9288 Members
Latest Member: Lorrainewhite
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  frustvis plugin
« previous next »
Pages: [1] 2 Print
Author Topic: frustvis plugin  (Read 4634 times)
Luca
Guest


Email
« on: February 09, 2006, 05:02:00 pm »

Hi Guys,
i'm writing you because i have a problem using the frustvis plugin at these conditions:
-unstable debian, g++-4.0
-libc6.2.3.5
-ati card and fglx driver or i845 using xorg drivers
-last snapshot of CS, using gl3d plugin
-application screen 1024x768
-4 view port inside the main screen( i think the ploblem is connected to 4 viewport)

the problem is:
if i compile CS with --enable-debug i get this assert:
csFrustumVis::RegisterVisOgbject (iVisibilityObject* visobj)
{
#ifdef CS_DEBUG
for (i =0; i<visobj_vector.Lenght();i++)
{
if (visobj_vector->visobj == visobj)
CS_ASSERT (false)
}
#endif

Note:
on a computer with ati x300 in release mode my application run,
on a computer with ati x330 and cs in debug mode i get the above assert.
on a computer with i845 and cs in release mode my application break
on a computer with i845 and cs in debug mode i get the above assert.

could some one help me? any ideas?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: February 09, 2006, 06:50:41 pm »

With what application do you have this problem?

Greetings,
Logged
Luca
Guest


Email
« Reply #2 on: February 09, 2006, 08:16:04 pm »

i have this problem using my application.
I understand this is not an ideal situation for you to debug or to understand what is happening, but perhaps the manteiner of this plugin can deduct something.

Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: February 09, 2006, 08:25:47 pm »

i have this problem using my application.
I understand this is not an ideal situation for you to debug or to understand what is happening, but perhaps the manteiner of this plugin can deduct something.



Well that would be me smiley

Can you tell me a bit about what kind of objects you have in your world and what you're doing with them? This kind of error is usually caused by some kind of bad object manipulation or objects that are not well-formed. It would of course be very nice if you could make a small version of your program that can also reproduce this problem.

Greetings,
Logged
Luca
Guest


Email
« Reply #4 on: February 10, 2006, 11:27:50 am »

i arrive to undestand that deleting the follow Parent row the problem disappear

iMeshWrapper *pm;
iMeshWrapper *UnitMesh;
.
.
   if (UnitMesh && pm)
      UnitMesh->QuerySceneNode()->SetParent(pm->QuerySceneNode());
.
.

i remember i changed it passing from 98 to current cvs version.
is it wrong? any idea? or it's needed a deeper debug?
many thanks
Logged
Luca
Guest


Email
« Reply #5 on: February 10, 2006, 12:38:00 pm »

sorry jorrit i fotgot to tell you the kinds of meshes that i used:
the parent is a thing and the children is a sp3d but i have the same trouble with spr3d vs spr3d.
it's a little bit difficut to make a small version to test but tonight i'll try to make it.
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #6 on: February 10, 2006, 12:46:37 pm »

sorry jorrit i fotgot to tell you the kinds of meshes that i used:
the parent is a thing and the children is a sp3d but i have the same trouble with spr3d vs spr3d.
it's a little bit difficut to make a small version to test but tonight i'll try to make it.


I would REALLY appreciate that. Would make it a lot easier to debug this for me.

Greetings,
Logged
Luca
Guest


Email
« Reply #7 on: February 10, 2006, 05:07:06 pm »

I found the origin of the problem and i propose you a small patch.
there is a recursive function inside the csSector::SetVisibilityCullerPlugin, this function is:
void csSector::RegisterEntireMeshToCuller (iMeshWrapper* mesh)
{
  csMeshWrapper* cmesh = (csMeshWrapper*)mesh;
  if (cmesh->SomeParentHasStaticLOD ()) return;

  csRef<iVisibilityObject> vo = SCF_QUERY_INTERFACE (mesh,
        iVisibilityObject);
  culler->RegisterVisObject (vo);

  if (cmesh->GetStaticLODMesh ()) return;
  size_t i;
  const csRefArray<iSceneNode>& ml = cmesh->GetChildren ();
  for (i = 0 ; i < ml.Length () ; i++)
  {
    iMeshWrapper* child = ml->QueryMesh ();
    if (child)
      RegisterEntireMeshToCuller (child);
  }
}

you can see this function register children of a mesh to the culler plugin, but if two mesh has the same parent the registration of the second parent fail. cause the the follow code:

void csFrustumVis::RegisterVisObject (iVisibilityObject* visobj)
{
#ifdef CS_DEBUG
  size_t i;
  for (i = 0 ; i < visobj_vector.Length () ; i++)
  {
    if (visobj_vector->visobj == visobj)
    {
      CS_ASSERT (false);
    }
  }
#endif

in debug mode there is an assert but in release nothing happen and only for lucky my system has sometimes worked.
to preserve a multiple registration to the culler i modified the previus code like that:

void csFrustumVis::RegisterVisObject (iVisibilityObject* visobj)
{
#ifdef CS_DEBUG
  size_t i;
  for (i = 0 ; i < visobj_vector.Length () ; i++)
  {
    if (visobj_vector->visobj == visobj)
    {
      return;
    }
  }
#endif

what do you think?
now my game work well.
please let me know.
Luca
Logged
Luca
Guest


Email
« Reply #8 on: February 10, 2006, 05:11:06 pm »

sorry again but i think this patch is needed in release mode too.
ciao
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #9 on: February 10, 2006, 08:40:58 pm »

sorry again but i think this patch is needed in release mode too.
ciao

Hmm... I think the patch only addresses the symptom and not the real problem. I will try to find the real problem.

Greetings,
Logged
Luca
Guest


Email
« Reply #10 on: February 10, 2006, 08:49:21 pm »

I think too. i wrote something wrong.
if you need other information i'll debug my code another time.

let me know.
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #11 on: February 10, 2006, 08:54:30 pm »

I think too. i wrote something wrong.
if you need other information i'll debug my code another time.

let me know.


If you manage to find the time a nice and simple example demonstrating this problem would still be appreciated.

Thanks for the help on debugging this issue btw,

Greetings,
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #12 on: February 11, 2006, 07:17:10 am »

Ok, I can now reproduce this problem easily. I will work on a fix this weekend. Thanks for finding this.

Greetings,
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #13 on: February 11, 2006, 07:45:29 am »

I fixed the bug. The problem was that CS didn't cope well when adding a mesh to another mesh if that child mesh was already linked to a sector. That's also why the cases in CS where hierarchies were used didn't have this problem. They didn't put the children in a sector before calling SetParent(). This is now fixed by letting SetParent() clear the sector list first.

Greetings,
Logged
Luca
Guest


Email
« Reply #14 on: February 11, 2006, 08:16:59 am »

Good!
i'll update my cvs tree and i'll study your fix.
ciao
Logged
Pages: [1] 2 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 4.406 seconds with 13 queries.