本文整理汇总了Java中rajawali.bounds.BoundingBox类的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox类的具体用法?Java BoundingBox怎么用?Java BoundingBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundingBox类属于rajawali.bounds包,在下文中一共展示了BoundingBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: boundsInFrustum
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public boolean boundsInFrustum(BoundingBox bounds) {
Number3D[] corners = mTmp;
bounds.copyPoints(mTmp);//copy transformed points and test
int isout;
for (int i = 0; i < 6; i++) {
isout = 0;
for (int j = 0; j < 8; j++)
if (planes[i].getPointSide(corners[j]) == PlaneSide.Back) {
isout++;
}
if (isout == 8) {
return false;
}
}
return true;
}
示例2: boundsInFrustum
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public boolean boundsInFrustum (BoundingBox bounds) {
Vector3[] corners = mTmp;
bounds.copyPoints(mTmp);//copy transformed points and test
int isout;
for (int i = 0; i < 6; i++) {
isout= 0;
for (int j = 0; j < 8; j++)
if (planes[i].getPointSide(corners[j]) == PlaneSide.Back){ isout++; }
if (isout == 8) {
return false;
}
}
return true;
}
示例3: boundsInFrustum
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public boolean boundsInFrustum (BoundingBox bounds) {
for(int i=0; i<6; i++) {
Plane p = planes[i];
mPoint1.x = p.getNormal().x > 0 ? bounds.getMin().x : bounds.getMax().x;
mPoint2.x = p.getNormal().x > 0 ? bounds.getMax().x : bounds.getMin().x;
mPoint1.y = p.getNormal().y > 0 ? bounds.getMin().y : bounds.getMax().y;
mPoint2.y = p.getNormal().y > 0 ? bounds.getMax().y : bounds.getMin().y;
mPoint1.z = p.getNormal().z > 0 ? bounds.getMin().z : bounds.getMax().z;
mPoint2.z = p.getNormal().z > 0 ? bounds.getMax().z : bounds.getMin().z;
double distance1 = p.distance(mPoint1);
double distance2 = p.distance(mPoint2);
if ( distance1 < 0 && distance2 < 0 )
return false;
}
return true;
}
示例4: apply
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public void apply(INode node) {
if (node instanceof BaseObject3D) {
BaseObject3D o = (BaseObject3D) node;
if (!o.isVisible() || !o.isInFrustum()) return;
//RajLog.d("VISITING " + o.getName());
if (o.getGeometry().hasBoundingSphere()) {
BoundingSphere bsphere = o.getGeometry().getBoundingSphere();
bsphere.calculateBounds(o.getGeometry());
bsphere.transform(o.getModelMatrix());
if (intersectsWith(bsphere)) {
if (mPickedObject == null ||
(mPickedObject != null && o.getPosition().z < mPickedObject.getPosition().z))
mPickedObject = o;
}
} else {
// Assume bounding box if no bounding sphere found.
BoundingBox bbox = o.getGeometry().getBoundingBox();
bbox.calculateBounds(o.getGeometry());
bbox.transform(o.getModelMatrix());
if (intersectsWith(bbox)) {
if (mPickedObject == null ||
(mPickedObject != null && o.getPosition().z < mPickedObject.getPosition().z))
mPickedObject = o;
}
}
}
}
示例5: intersectsWith
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
private boolean intersectsWith(BoundingBox bbox) {
Number3D raySta = mRayStart;
Number3D rayEnd = mRayEnd;
Number3D boxMin = bbox.getTransformedMin();
Number3D boxMax = bbox.getTransformedMax();
if (rayEnd.x < boxMin.x && raySta.x < boxMin.x) return false;
if (rayEnd.x > boxMax.x && raySta.x > boxMax.x) return false;
if (rayEnd.y < boxMin.y && raySta.y < boxMin.y) return false;
if (rayEnd.y > boxMax.y && raySta.y > boxMax.y) return false;
if (rayEnd.z < boxMin.z && raySta.z < boxMin.z) return false;
if (rayEnd.z > boxMax.z && raySta.z > boxMax.z) return false;
if (raySta.x > boxMin.x && raySta.x < boxMax.x &&
raySta.y > boxMin.y && raySta.y < boxMax.y &&
raySta.z > boxMin.z && raySta.z < boxMax.z) {
mHitPoint.setAllFrom(raySta);
return true;
}
if ((getIntersection(raySta.x - boxMin.x, rayEnd.x - boxMin.x, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.X))
|| (getIntersection(raySta.y - boxMin.y, rayEnd.y - boxMin.y, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Y))
|| (getIntersection(raySta.z - boxMin.z, rayEnd.z - boxMin.z, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Z))
|| (getIntersection(raySta.x - boxMax.x, rayEnd.x - boxMax.x, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.X))
|| (getIntersection(raySta.y - boxMax.y, rayEnd.y - boxMax.y, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Y))
|| (getIntersection(raySta.z - boxMax.z, rayEnd.z - boxMax.z, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Z)))
return true;
return false;
}
示例6: getBoundingBox
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
/**
* Returns a BoundingBox representative of this frustum.
* This will create the BoundingBox if necessary.
*
* @return BoundingBox which contains this frustum.
*/
public BoundingBox getBoundingBox() {
if (mBoundingBox == null) {
setBounds();
}
return mBoundingBox;
}
示例7: apply
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public void apply(INode node) {
if(node instanceof Object3D) {
Object3D o = (Object3D)node;
if(!o.isVisible() || !o.isInFrustum()) return;
//RajLog.d("VISITING " + o.getName());
if (o.getGeometry().hasBoundingSphere()) {
BoundingSphere bsphere = o.getGeometry().getBoundingSphere();
bsphere.calculateBounds(o.getGeometry());
bsphere.transform(o.getModelMatrix());
if(intersectsWith(bsphere)) {
if(mPickedObject == null ||
(mPickedObject != null && o.getPosition().z < mPickedObject.getPosition().z))
mPickedObject = o;
}
} else {
// Assume bounding box if no bounding sphere found.
BoundingBox bbox = o.getGeometry().getBoundingBox();
bbox.calculateBounds(o.getGeometry());
bbox.transform(o.getModelMatrix());
if(intersectsWith(bbox)) {
if(mPickedObject == null ||
(mPickedObject != null && o.getPosition().z < mPickedObject.getPosition().z))
mPickedObject = o;
}
}
}
}
示例8: intersectsWith
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
private boolean intersectsWith(BoundingBox bbox) {
Vector3 raySta = mRayStart;
Vector3 rayEnd = mRayEnd;
Vector3 boxMin = bbox.getTransformedMin();
Vector3 boxMax = bbox.getTransformedMax();
if (rayEnd.x < boxMin.x && raySta.x < boxMin.x) return false;
if (rayEnd.x > boxMax.x && raySta.x > boxMax.x) return false;
if (rayEnd.y < boxMin.y && raySta.y < boxMin.y) return false;
if (rayEnd.y > boxMax.y && raySta.y > boxMax.y) return false;
if (rayEnd.z < boxMin.z && raySta.z < boxMin.z) return false;
if (rayEnd.z > boxMax.z && raySta.z > boxMax.z) return false;
if (raySta.x > boxMin.x && raySta.x < boxMax.x &&
raySta.y > boxMin.y && raySta.y < boxMax.y &&
raySta.z > boxMin.z && raySta.z < boxMax.z)
{mHitPoint.setAll(raySta);
return true;}
if ( (getIntersection(raySta.x-boxMin.x, rayEnd.x-boxMin.x, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.X))
|| (getIntersection(raySta.y-boxMin.y, rayEnd.y-boxMin.y, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Y))
|| (getIntersection(raySta.z-boxMin.z, rayEnd.z-boxMin.z, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Z))
|| (getIntersection(raySta.x-boxMax.x, rayEnd.x-boxMax.x, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.X))
|| (getIntersection(raySta.y-boxMax.y, rayEnd.y-boxMax.y, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Y))
|| (getIntersection(raySta.z-boxMax.z, rayEnd.z-boxMax.z, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Z)))
return true;
return false;
}
示例9: contains
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public boolean contains(IBoundingVolume boundingVolume) {
if(!(boundingVolume instanceof BoundingBox)) return false;
BoundingBox boundingBox = (BoundingBox)boundingVolume;
Vector3 otherMin = boundingBox.getTransformedMin();
Vector3 otherMax = boundingBox.getTransformedMax();
Vector3 min = mTransformedMin;
Vector3 max = mTransformedMax;
return (max.x >= otherMax.x) && (min.x <= otherMin.x) &&
(max.y >= otherMax.y) && (min.y <= otherMin.y) &&
(max.z >= otherMax.z) && (min.z <= otherMin.z);
}
示例10: isContainedBy
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public boolean isContainedBy(IBoundingVolume boundingVolume) {
if(!(boundingVolume instanceof BoundingBox)) return false;
BoundingBox boundingBox = (BoundingBox)boundingVolume;
Vector3 otherMin = boundingBox.getTransformedMin();
Vector3 otherMax = boundingBox.getTransformedMax();
Vector3 min = mTransformedMin;
Vector3 max = mTransformedMax;
return (max.x <= otherMax.x) && (min.x >= otherMin.x) &&
(max.y <= otherMax.y) && (min.y >= otherMin.y) &&
(max.z <= otherMax.z) && (min.z >= otherMin.z);
}
示例11: apply
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public void apply(INode node) {
if(node instanceof BaseObject3D) {
BaseObject3D o = (BaseObject3D)node;
if(!o.isVisible() || !o.isInFrustum()) return;
//RajLog.d("VISITING " + o.getName());
if (o.getGeometry().hasBoundingSphere()) {
BoundingSphere bsphere = o.getGeometry().getBoundingSphere();
bsphere.calculateBounds(o.getGeometry());
bsphere.transform(o.getModelMatrix());
if(intersectsWith(bsphere)) {
if(mPickedObject == null ||
(mPickedObject != null && o.getPosition().z < mPickedObject.getPosition().z))
mPickedObject = o;
}
} else {
// Assume bounding box if no bounding sphere found.
BoundingBox bbox = o.getGeometry().getBoundingBox();
bbox.calculateBounds(o.getGeometry());
bbox.transform(o.getModelMatrix());
if(intersectsWith(bbox)) {
if(mPickedObject == null ||
(mPickedObject != null && o.getPosition().z < mPickedObject.getPosition().z))
mPickedObject = o;
}
}
}
}
示例12: intersectsWith
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
private boolean intersectsWith(BoundingBox bbox) {
Number3D raySta = mRayStart;
Number3D rayEnd = mRayEnd;
Number3D boxMin = bbox.getTransformedMin();
Number3D boxMax = bbox.getTransformedMax();
if (rayEnd.x < boxMin.x && raySta.x < boxMin.x) return false;
if (rayEnd.x > boxMax.x && raySta.x > boxMax.x) return false;
if (rayEnd.y < boxMin.y && raySta.y < boxMin.y) return false;
if (rayEnd.y > boxMax.y && raySta.y > boxMax.y) return false;
if (rayEnd.z < boxMin.z && raySta.z < boxMin.z) return false;
if (rayEnd.z > boxMax.z && raySta.z > boxMax.z) return false;
if (raySta.x > boxMin.x && raySta.x < boxMax.x &&
raySta.y > boxMin.y && raySta.y < boxMax.y &&
raySta.z > boxMin.z && raySta.z < boxMax.z)
{mHitPoint.setAllFrom(raySta);
return true;}
if ( (getIntersection(raySta.x-boxMin.x, rayEnd.x-boxMin.x, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.X))
|| (getIntersection(raySta.y-boxMin.y, rayEnd.y-boxMin.y, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Y))
|| (getIntersection(raySta.z-boxMin.z, rayEnd.z-boxMin.z, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Z))
|| (getIntersection(raySta.x-boxMax.x, rayEnd.x-boxMax.x, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.X))
|| (getIntersection(raySta.y-boxMax.y, rayEnd.y-boxMax.y, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Y))
|| (getIntersection(raySta.z-boxMax.z, rayEnd.z-boxMax.z, raySta, rayEnd) && isInBox(boxMin, boxMax, Axis.Z)))
return true;
return false;
}
示例13: BoneAnimationFrame
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public BoneAnimationFrame() {
mBounds = new BoundingBox();
mSkeleton = new Skeleton();
}
示例14: getBoundingBox
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public BoundingBox getBoundingBox() {
return mBounds;
}
示例15: SkeletalAnimationFrame
import rajawali.bounds.BoundingBox; //导入依赖的package包/类
public SkeletalAnimationFrame() {
mBounds = new BoundingBox();
mSkeleton = new Skeleton();
}