Java Code Examples for com.jme3.renderer.Camera#FrustumIntersect

The following examples show how to use com.jme3.renderer.Camera#FrustumIntersect . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Octnode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void generateRenderSet(Set<Geometry> renderSet, Camera cam){
//        generateRenderSetNoCheck(renderSet, cam);

        bbox.setCheckPlane(0);
        cam.setPlaneState(0);
        Camera.FrustumIntersect result = cam.contains(bbox);
        if (result != Camera.FrustumIntersect.Outside){
            if (geoms != null){
                renderSet.addAll(Arrays.asList(geoms));
            }
            for (int i = 0; i < 8; i++){
                if (children[i] != null){
                    if (result == Camera.FrustumIntersect.Inside){
                        children[i].generateRenderSetNoCheck(renderSet, cam);
                    }else{
                        children[i].generateRenderSet(renderSet, cam);
                    }
                }
            }
        }
    }
 
Example 2
Source File: FastOctnode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void generateRenderSet(Geometry[] globalGeomList, Set<Geometry> renderSet, Camera cam, BoundingBox parentBox, boolean isRoot){
    tempBox.setCenter(parentBox.getCenter());
    tempBox.setXExtent(parentBox.getXExtent());
    tempBox.setYExtent(parentBox.getYExtent());
    tempBox.setZExtent(parentBox.getZExtent());

    if (!isRoot){
        findChildBound(tempBox, getSide());
    }
    
    tempBox.setCheckPlane(0);
    cam.setPlaneState(0);
    Camera.FrustumIntersect result = cam.contains(tempBox);
    if (result != Camera.FrustumIntersect.Outside){
        if (length != 0){
            int start = getOffset();
            int end   = start + length;
            for (int i = start; i < end; i++){
                renderSet.add(globalGeomList[i]);
            }
        }

        if (child == null)
            return;

        FastOctnode node = child;

        float x = tempBox.getCenter().x;
        float y = tempBox.getCenter().y;
        float z = tempBox.getCenter().z;
        float ext = tempBox.getXExtent();

        while (node != null){
            if (result == Camera.FrustumIntersect.Inside){
                node.generateRenderSetNoCheck(globalGeomList, renderSet, cam);
            }else{
                node.generateRenderSet(globalGeomList, renderSet, cam, tempBox, false);
            }

            tempBox.getCenter().set(x,y,z);
            tempBox.setXExtent(ext);
            tempBox.setYExtent(ext);
            tempBox.setZExtent(ext);

            node = node.next;
        }
    }
}
 
Example 3
Source File: Spatial.java    From jmonkeybuilder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns this spatial's last frustum intersection result. This int is set
 * when a check is made to determine if the bounds of the object fall inside
 * a camera's frustum. If a parent is found to fall outside the frustum, the
 * value for this spatial will not be updated.
 *
 * @return The spatial's last frustum intersection result.
 */
public Camera.FrustumIntersect getLastFrustumIntersection() {
    return frustrumIntersects;
}
 
Example 4
Source File: Spatial.java    From jmonkeybuilder with Apache License 2.0 2 votes vote down vote up
/**
 * Overrides the last intersection result. This is useful for operations
 * that want to start rendering at the middle of a scene tree and don't want
 * the parent of that node to influence culling.
 *
 * @param intersects
 *            the new value
 */
public void setLastFrustumIntersection(Camera.FrustumIntersect intersects) {
    frustrumIntersects = intersects;
}
 
Example 5
Source File: Spatial.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns this spatial's last frustum intersection result. This int is set
 * when a check is made to determine if the bounds of the object fall inside
 * a camera's frustum. If a parent is found to fall outside the frustum, the
 * value for this spatial will not be updated.
 *
 * @return The spatial's last frustum intersection result.
 */
public Camera.FrustumIntersect getLastFrustumIntersection() {
    return frustrumIntersects;
}
 
Example 6
Source File: Spatial.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Overrides the last intersection result. This is useful for operations
 * that want to start rendering at the middle of a scene tree and don't want
 * the parent of that node to influence culling.
 *
 * @param intersects
 *            the new value
 */
public void setLastFrustumIntersection(Camera.FrustumIntersect intersects) {
    frustrumIntersects = intersects;
}
 
Example 7
Source File: Spatial.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Returns this spatial's last frustum intersection result. This int is set
 * when a check is made to determine if the bounds of the object fall inside
 * a camera's frustum. If a parent is found to fall outside the frustum, the
 * value for this spatial will not be updated.
 *
 * @return The spatial's last frustum intersection result.
 */
public Camera.FrustumIntersect getLastFrustumIntersection() {
    return frustrumIntersects;
}
 
Example 8
Source File: Spatial.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Overrides the last intersection result. This is useful for operations
 * that want to start rendering at the middle of a scene tree and don't want
 * the parent of that node to influence culling.
 *
 * @param intersects
 *            the new value
 */
public void setLastFrustumIntersection(Camera.FrustumIntersect intersects) {
    frustrumIntersects = intersects;
}