FreshRSS

Zobrazení pro čtení

Jsou dostupné nové články, klikněte pro obnovení stránky.

Octree as struct not class

I was wondering (as I could not find any implementation online), if anyone here would have an idea of how to create an octree as a struct and not a class.

The problem is that Octrees are usually recursive, and structs cannot have auto-inheritance.

So, the code:

public struct MyOctree
{
    public MyNode RootNode;
}

public struct MyNode
{
    public MyNode[] SubNodes;
}

would cause a cyclic reference error (nodes contain nodes).

I'm trying to implement such a structure for GPU usage, and any Nullable data (e.g. a class) throw a not-supported exception on the GPU initializer.

Thanks.

❌