import { SceneNode } from './scene_node.js';

/**
 * Graph scene node
 *
 * @remarks
 * Graph node is the base class of any kind of scene node that will be placed into the octree
 *
 * @public
 */ class GraphNode extends SceneNode {
    _octreeNode;
    /**
   * Creates a graph node
   * @param scene - The scene to which the node belongs
   */ constructor(scene){
        super(scene);
        this._octreeNode = null;
    }
    /** @internal */ get octreeNode() {
        return this._octreeNode;
    }
    /** @internal */ set octreeNode(node) {
        this._octreeNode = node;
    }
    /** Gets the name */ getName() {
        return this._name;
    }
    /**
   * {@inheritDoc SceneNode.isGraphNode}
   * @override
   */ isGraphNode() {
        return true;
    }
    /**
   * {@inheritDoc Drawable.getNode}
   */ getNode() {
        return this;
    }
    /**
   * {@inheritDoc Drawable.getBoneMatrices}
   */ getBoneMatrices() {
        return null;
    }
    /**
   * {@inheritDoc Drawable.getSortDistance}
   */ getSortDistance(camera) {
        const cameraWorldMatrix = camera.worldMatrix;
        const objectWorldMatrix = this.worldMatrix;
        const dx = cameraWorldMatrix.m03 - objectWorldMatrix.m03;
        const dy = cameraWorldMatrix.m13 - objectWorldMatrix.m13;
        const dz = cameraWorldMatrix.m23 - objectWorldMatrix.m23;
        return dx * dx + dy * dy * dz * dz;
    }
    /**
   * {@inheritDoc Drawable.isBatchable}
   */ isBatchable() {
        return false;
    }
    /** @internal */ _visibleChanged() {
        this._scene?.invalidateNodePlacement(this);
    }
}

export { GraphNode };
//# sourceMappingURL=graph_node.js.map
