1

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
1
  getWhetherTileIncludeCamera(tile) {

        let cameras = this.cameras;

        let box = tile.cached.box;
        let sphere = tile.cached.sphere;
        let isInBox = false;

        /// Ignoring rotation and just considering translation
        let tileTransformElems = tile.cached.transform.elements;
        let tileWorldX = tileTransformElems[12],
            tileWorldY = tileTransformElems[13],
            tileWorldZ = tileTransformElems[14];

        if (box) {
            let worldBox = new Box3(
                new Vector3(
                    tileWorldX + box.min.x,
                    tileWorldY + box.min.y,
                    tileWorldZ + box.min.z
                ),
                new Vector3(
                    tileWorldX + box.max.x,
                    tileWorldY + box.max.y,
                    tileWorldZ + box.max.z
                )
            );

            for (let i = 0; i < cameras.length; i++) {
                let camera = cameras[i];
                if (worldBox.containsPoint(camera.position)) {
                    isInBox = true;
                    break;
                }
            }
        } else if (sphere) {
            for (let i = 0; i < cameras.length; i++) {
                let camera = cameras[i];
                if (sphere.containsPoint(camera.position)) {
                    isInBox = true;
                    break;
                }
            }
        }

        return isInBox;
    }
ready
2
  getWhetherTileIncludeCamera(tile) {

        let cameras = this.cameras;

        let box = tile.cached.box;
        let sphere = tile.cached.sphere;
        let isInBox = false;

        /// Ignoring rotation and just considering translation
        let tileTransformElems = tile.cached.transform.elements;
        let tileWorldX = tileTransformElems[12],
            tileWorldY = tileTransformElems[13],
            tileWorldZ = tileTransformElems[14];

        if (box) {
            let worldBox = new Box3(
                new Vector3(
                    tileWorldX + box.min.x,
                    tileWorldY + box.min.y,
                    tileWorldZ + box.min.z
                ),
                new Vector3(
                    tileWorldX + box.max.x,
                    tileWorldY + box.max.y,
                    tileWorldZ + box.max.z
                )
            );

            for (let i = 0; i < cameras.length; i++) {
                let camera = cameras[i];
                if (worldBox.containsPoint(camera.position)) {
                    isInBox = true;
                    break;
                }
            }
        } else if (sphere) {
            for (let i = 0; i < cameras.length; i++) {
                let camera = cameras[i];
                if (sphere.containsPoint(camera.position)) {
                    isInBox = true;
                    break;
                }
            }
        }

        return isInBox;
    }
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.