本文整理汇总了C++中GetWorldBoundingBox函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWorldBoundingBox函数的具体用法?C++ GetWorldBoundingBox怎么用?C++ GetWorldBoundingBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWorldBoundingBox函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetWorldBoundingBox
void BillboardSet::UpdateBatches(const FrameInfo& frame)
{
// If beginning a new frame, assume no sorting first
if (frame.frameNumber_ != sortFrameNumber_)
{
sortThisFrame_ = false;
sortFrameNumber_ = frame.frameNumber_;
}
Vector3 worldPos = node_->GetWorldPosition();
Vector3 offset = (worldPos - frame.camera_->GetNode()->GetWorldPosition());
// Sort if position relative to camera has changed
if (offset != previousOffset_ & sorted_)
sortThisFrame_ = true;
distance_ = frame.camera_->GetDistance(GetWorldBoundingBox().Center());
// Calculate scaled distance for animation LOD
float scale = GetWorldBoundingBox().Size().DotProduct(DOT_SCALE);
// If there are no billboards, the size becomes zero, and LOD'ed updates no longer happen. Disable LOD in that case
if (scale > M_EPSILON)
lodDistance_ = frame.camera_->GetLodDistance(distance_, scale, lodBias_);
else
lodDistance_ = 0.0f;
batches_[0].distance_ = distance_;
batches_[0].numWorldTransforms_ = 2;
// Billboard positioning
transforms_[0] = relative_ ? node_->GetWorldTransform() : Matrix3x4::IDENTITY;
// Billboard rotation
transforms_[1] = Matrix3x4(Vector3::ZERO, faceCameraMode_ != FC_NONE ? frame.camera_->GetFaceCameraRotation(
node_->GetWorldPosition(), node_->GetWorldRotation(), faceCameraMode_) : node_->GetWorldRotation(), Vector3::ONE);
}
开发者ID:ezhangle,项目名称:AtomicGameEngine,代码行数:33,代码来源:BillboardSet.cpp
示例2: GetWorldBoundingBox
void BillboardSet::UpdateBatches(const FrameInfo& frame)
{
// Check if position relative to camera has changed, and re-sort in that case
const Matrix3x4& worldTransform = node_->GetWorldTransform();
Vector3 worldPos = worldTransform.Translation();
Vector3 offset = (worldPos - frame.camera_->GetNode()->GetWorldPosition());
if (offset != previousOffset_)
{
previousOffset_ = offset;
if (sorted_)
{
// Sort billboards only once per frame. This means that secondary views will get
// the same sorting as the main view
if (frame.frameNumber_ != sortFrameNumber_)
{
sortFrameNumber_ = frame.frameNumber_;
bufferDirty_ = true;
}
}
}
distance_ = frame.camera_->GetDistance(GetWorldBoundingBox().Center());
// Calculate scaled distance for animation LOD
float scale = GetWorldBoundingBox().Size().DotProduct(DOT_SCALE);
// If there are no billboards, the size becomes zero, and LOD'ed updates no longer happen. Disable LOD in that case
if (scale > M_EPSILON)
lodDistance_ = frame.camera_->GetLodDistance(distance_, scale, lodBias_);
else
lodDistance_ = 0.0f;
batches_[0].distance_ = distance_;
batches_[0].worldTransform_ = relative_ ? &node_->GetWorldTransform() : &Matrix3x4::IDENTITY;
}
开发者ID:acremean,项目名称:urho3d,代码行数:34,代码来源:BillboardSet.cpp
示例3: GetTransformedBoundingBox
csScreenBoxResult csMeshWrapper::GetScreenBoundingBox (iCamera *camera)
{
csScreenBoxResult rc;
// Calculate camera space bbox.
csReversibleTransform tr_o2c = camera->GetTransform ();
if (!movable.IsFullTransformIdentity ())
tr_o2c /= movable.GetFullTransform ();
rc.cbox = GetTransformedBoundingBox (tr_o2c);
// Calculate screen space bbox.
float minz, maxz;
const csBox3& wbox = GetWorldBoundingBox();
if(!wbox.ProjectBox(camera->GetTransform(), camera->GetProjectionMatrix(),
rc.sbox, minz, maxz, engine->G3D->GetWidth(),
engine->G3D->GetHeight()))
{
rc.distance = -1;
}
else
{
rc.distance = rc.cbox.MaxZ ();
}
return rc;
}
开发者ID:garinh,项目名称:cs,代码行数:27,代码来源:meshobj.cpp
示例4:
Air::U1 MeshEntity::RayCast( const Ray& ray ,float* pOutDistance)
{
#if 1
if(!GetWorldBoundingBox().RayCast(ray.GetOrigin(),ray.GetDirection())){//.Intersect(GetWorldBoundingBox())){
return false;
}
#endif
Matrix matWorld = *GetWorldMatrix();
Matrix matWorldInv = matWorld;
matWorldInv.Inverse();
Float3 vStart = ray.m_vStart;
Float3 vLookAt = vStart + ray.m_vDirection;
vStart = matWorldInv*vStart;
vLookAt = matWorldInv*vLookAt;
Float3 vDir = (vLookAt - vStart);
vDir.Normalize();
Ray objSpaceRay(vStart,vDir);
float fDistance = 999999.0f;
U1 bHit = m_pMesh->RayCast(objSpaceRay,&fDistance);
if(bHit && pOutDistance!=NULL){
Float3 vObjSpaceHitPostion = vStart + vDir*fDistance;
Float3 vWorldSpaceHiPosition = matWorld*vObjSpaceHitPostion;
*pOutDistance = (vWorldSpaceHiPosition - ray.m_vStart).Length();
}
return bHit;
}
开发者ID:ingeyu,项目名称:airengine,代码行数:30,代码来源:AirMeshEntity.cpp
示例5:
void Text3D::UpdateBatches(const FrameInfo& frame)
{
distance_ = frame.camera_->GetDistance(GetWorldBoundingBox().Center());
if (faceCameraMode_ != FC_NONE)
{
Vector3 worldPosition = node_->GetWorldPosition();
customWorldTransform_ = Matrix3x4(worldPosition, frame.camera_->GetFaceCameraRotation(
worldPosition, node_->GetWorldRotation(), faceCameraMode_), node_->GetWorldScale());
worldBoundingBoxDirty_ = true;
}
for (unsigned i = 0; i < batches_.Size(); ++i)
{
batches_[i].distance_ = distance_;
batches_[i].worldTransform_ = faceCameraMode_ != FC_NONE ? &customWorldTransform_ : &node_->GetWorldTransform();
}
for (unsigned i = 0; i < uiBatches_.Size(); ++i)
{
if (uiBatches_[i].texture_ && uiBatches_[i].texture_->IsDataLost())
{
fontDataLost_ = true;
break;
}
}
}
开发者ID:boberfly,项目名称:Urho3D,代码行数:27,代码来源:Text3D.cpp
示例6: GetWorldBoundingBox
void StaticModelGroup::UpdateBatches(const FrameInfo& frame)
{
// Getting the world bounding box ensures the transforms are updated
const BoundingBox& worldBoundingBox = GetWorldBoundingBox();
const Matrix3x4& worldTransform = node_->GetWorldTransform();
distance_ = frame.camera_->GetDistance(worldBoundingBox.Center());
if (batches_.Size() > 1)
{
for (unsigned i = 0; i < batches_.Size(); ++i)
{
batches_[i].distance_ = frame.camera_->GetDistance(worldTransform * geometryData_[i].center_);
batches_[i].worldTransform_ = numWorldTransforms_ ? &worldTransforms_[0] : &Matrix3x4::IDENTITY;
batches_[i].numWorldTransforms_ = numWorldTransforms_;
}
}
else if (batches_.Size() == 1)
{
batches_[0].distance_ = distance_;
batches_[0].worldTransform_ = numWorldTransforms_ ? &worldTransforms_[0] : &Matrix3x4::IDENTITY;
batches_[0].numWorldTransforms_ = numWorldTransforms_;
}
float scale = worldBoundingBox.Size().DotProduct(DOT_SCALE);
float newLodDistance = frame.camera_->GetLodDistance(distance_, scale, lodBias_);
if (newLodDistance != lodDistance_)
{
lodDistance_ = newLodDistance;
CalculateLodLevels();
}
}
开发者ID:LuisAntonRebollo,项目名称:Urho3D,代码行数:32,代码来源:StaticModelGroup.cpp
示例7: query
void Zone::ClearDrawablesZone()
{
if (octant_ && lastWorldBoundingBox_.defined_)
{
PODVector<Drawable*> result;
BoxOctreeQuery query(result, lastWorldBoundingBox_, DRAWABLE_GEOMETRY | DRAWABLE_ZONE);
octant_->GetRoot()->GetDrawables(query);
for (PODVector<Drawable*>::Iterator i = result.Begin(); i != result.End(); ++i)
{
Drawable* drawable = *i;
unsigned drawableFlags = drawable->GetDrawableFlags();
if (drawableFlags & DRAWABLE_GEOMETRY)
drawable->SetZone(0);
else if (drawableFlags & DRAWABLE_ZONE)
{
Zone* zone = static_cast<Zone*>(drawable);
zone->lastAmbientStartZone_.Reset();
zone->lastAmbientEndZone_.Reset();
}
}
}
lastWorldBoundingBox_ = GetWorldBoundingBox();
lastAmbientStartZone_.Reset();
lastAmbientEndZone_.Reset();
}
开发者ID:ViteFalcon,项目名称:Urho3D,代码行数:27,代码来源:Zone.cpp
示例8: GetWorldBoundingBox
void StaticModel::UpdateBatches(const FrameInfo& frame)
{
const BoundingBox& worldBoundingBox = GetWorldBoundingBox();
distance_ = frame.camera_->GetDistance(worldBoundingBox.Center());
if (batches_.Size() == 1)
batches_[0].distance_ = distance_;
else
{
const Matrix3x4& worldTransform = node_->GetWorldTransform();
for (unsigned i = 0; i < batches_.Size(); ++i)
batches_[i].distance_ = frame.camera_->GetDistance(worldTransform * geometryData_[i].center_);
}
float scale = worldBoundingBox.Size().DotProduct(DOT_SCALE);
float newLodDistance = frame.camera_->GetLodDistance(distance_, scale, lodBias_);
if (newLodDistance != lodDistance_)
{
lodDistance_ = newLodDistance;
CalculateLodLevels();
}
// ATOMIC BEGIN
if (geometryDisabled_)
UpdateBatchesHideGeometry();
// ATOMIC END
}
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:29,代码来源:StaticModel.cpp
示例9:
void Drawable2D::UpdateBatches(const FrameInfo& frame)
{
const Matrix3x4& worldTransform = node_->GetWorldTransform();
distance_ = frame.camera_->GetDistance(GetWorldBoundingBox().Center());
batches_[0].distance_ = distance_;
batches_[0].worldTransform_ = &worldTransform;
}
开发者ID:reattiva,项目名称:Urho3D,代码行数:8,代码来源:Drawable2D.cpp
示例10: ProcessRayQuery
void StaticModelGroup::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
// If no bones or no bone-level testing, use the Drawable test
RayQueryLevel level = query.level_;
if (level < RAY_AABB)
{
Drawable::ProcessRayQuery(query, results);
return;
}
// Check ray hit distance to AABB before proceeding with more accurate tests
// GetWorldBoundingBox() updates the world transforms
if (query.ray_.HitDistance(GetWorldBoundingBox()) >= query.maxDistance_)
return;
for (unsigned i = 0; i < numWorldTransforms_; ++i)
{
// Initial test using AABB
float distance = query.ray_.HitDistance(boundingBox_.Transformed(worldTransforms_[i]));
// Then proceed to OBB and triangle-level tests if necessary
if (level >= RAY_OBB && distance < query.maxDistance_)
{
Matrix3x4 inverse = worldTransforms_[i].Inverse();
Ray localRay = query.ray_.Transformed(inverse);
distance = localRay.HitDistance(boundingBox_);
if (level == RAY_TRIANGLE && distance < query.maxDistance_)
{
distance = M_INFINITY;
for (unsigned j = 0; j < batches_.Size(); ++j)
{
Geometry* geometry = batches_[j].geometry_;
if (geometry)
{
float geometryDistance = geometry->GetHitDistance(localRay);
if (geometryDistance < query.maxDistance_ && geometryDistance < distance)
distance = geometryDistance;
}
}
}
}
if (distance < query.maxDistance_)
{
RayQueryResult result;
result.drawable_ = this;
result.node_ = node_;
result.distance_ = distance;
result.subObject_ = i;
results.Push(result);
}
}
}
开发者ID:LuisAntonRebollo,项目名称:Urho3D,代码行数:55,代码来源:StaticModelGroup.cpp
示例11: GetWorldBoundingBox
void SceneNode::OnUpdateRenderQueues( const Camera& camera, RenderOrder order, uint32_t buckterFilter, uint32_t filterIgnore )
{
const BoundingBoxf& worldBound = GetWorldBoundingBox();
if (!camera.Visible(GetWorldBoundingBox()))
return;
RenderQueue& renderQueue = mScene->GetRenderQueue();
for (SceneObject* pSceneObject : mAttachedObjects)
{
if (pSceneObject->IsActive() && pSceneObject->Renderable())
pSceneObject->OnUpdateRenderQueue(&renderQueue, camera, order, buckterFilter, filterIgnore);
}
// recursively call children
for (Node* node : mChildren)
{
SceneNode* child = static_cast<SceneNode*>(node);
child->OnUpdateRenderQueues(camera, order, buckterFilter, filterIgnore);
}
}
开发者ID:hustruan,项目名称:RcEngine,代码行数:21,代码来源:SceneNode.cpp
示例12: switch
void Light::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
// Do not record a raycast result for a directional light, as it would block all other results
if (lightType_ == LIGHT_DIRECTIONAL)
return;
float distance = query.maxDistance_;
switch (query.level_)
{
case RAY_AABB:
Drawable::ProcessRayQuery(query, results);
return;
case RAY_OBB:
{
Matrix3x4 inverse(node_->GetWorldTransform().Inverse());
Ray localRay = query.ray_.Transformed(inverse);
distance = localRay.HitDistance(GetWorldBoundingBox().Transformed(inverse));
if (distance >= query.maxDistance_)
return;
}
break;
case RAY_TRIANGLE:
if (lightType_ == LIGHT_SPOT)
{
distance = query.ray_.HitDistance(GetFrustum());
if (distance >= query.maxDistance_)
return;
}
else
{
distance = query.ray_.HitDistance(Sphere(node_->GetWorldPosition(), range_));
if (distance >= query.maxDistance_)
return;
}
break;
case RAY_TRIANGLE_UV:
LOGWARNING("RAY_TRIANGLE_UV query level is not supported for Light component");
return;
}
// If the code reaches here then we have a hit
RayQueryResult result;
result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
result.normal_ = -query.ray_.direction_;
result.distance_ = distance;
result.drawable_ = this;
result.node_ = node_;
result.subObject_ = M_MAX_UNSIGNED;
results.Push(result);
}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:53,代码来源:Light.cpp
示例13: GetWorldBoundingBox
void Drawable::LimitLights()
{
// Maximum lights value 0 means unlimited
if (!maxLights_ || lights_.Size() <= maxLights_)
return;
// If more lights than allowed, move to vertex lights and cut the list
const BoundingBox& box = GetWorldBoundingBox();
for (unsigned i = 0; i < lights_.Size(); ++i)
lights_[i]->SetIntensitySortValue(box);
Sort(lights_.Begin(), lights_.End(), CompareDrawables);
vertexLights_.Insert(vertexLights_.End(), lights_.Begin() + maxLights_, lights_.End());
lights_.Resize(maxLights_);
}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:15,代码来源:Drawable.cpp
示例14: ProcessRayQuery
void Drawable::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
float distance = query.ray_.HitDistance(GetWorldBoundingBox());
if (distance < query.maxDistance_)
{
RayQueryResult result;
result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
result.normal_ = -query.ray_.direction_;
result.distance_ = distance;
result.drawable_ = this;
result.node_ = GetNode();
result.subObject_ = M_MAX_UNSIGNED;
results.Push(result);
}
}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:15,代码来源:Drawable.cpp
示例15: ProcessRayQuery
void BillboardSet::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
{
// If no billboard-level testing, use the Drawable test
if (query.level_ < RAY_TRIANGLE)
{
Drawable::ProcessRayQuery(query, results);
return;
}
// Check ray hit distance to AABB before proceeding with billboard-level tests
if (query.ray_.HitDistance(GetWorldBoundingBox()) >= query.maxDistance_)
return;
const Matrix3x4& worldTransform = node_->GetWorldTransform();
Matrix3x4 billboardTransform = relative_ ? worldTransform : Matrix3x4::IDENTITY;
Vector3 billboardScale = scaled_ ? worldTransform.Scale() : Vector3::ONE;
for (unsigned i = 0; i < billboards_.Size(); ++i)
{
if (!billboards_[i].enabled_)
continue;
// Approximate the billboards as spheres for raycasting
float size = INV_SQRT_TWO * (billboards_[i].size_.x_ * billboardScale.x_ + billboards_[i].size_.y_ * billboardScale.y_);
if (fixedScreenSize_)
size *= billboards_[i].screenScaleFactor_;
Vector3 center = billboardTransform * billboards_[i].position_;
Sphere billboardSphere(center, size);
float distance = query.ray_.HitDistance(billboardSphere);
if (distance < query.maxDistance_)
{
// If the code reaches here then we have a hit
RayQueryResult result;
result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
result.normal_ = -query.ray_.direction_;
result.distance_ = distance;
result.drawable_ = this;
result.node_ = node_;
result.subObject_ = i;
results.Push(result);
}
}
}
开发者ID:gogoprog,项目名称:Urho3D,代码行数:44,代码来源:BillboardSet.cpp
示例16: GetScene
void Zone::OnMarkedDirty(Node* node)
{
// Due to the octree query and weak pointer manipulation, is not safe from worker threads
Scene* scene = GetScene();
if (scene && scene->IsThreadedUpdate())
{
scene->DelayedMarkedDirty(this);
return;
}
Drawable::OnMarkedDirty(node);
// When marked dirty, clear the cached zone from all drawables inside the zone bounding box,
// and mark gradient dirty in all neighbor zones
if (octant_ && lastWorldBoundingBox_.defined_)
{
PODVector<Drawable*> result;
BoxOctreeQuery query(result, lastWorldBoundingBox_, DRAWABLE_GEOMETRY | DRAWABLE_ZONE);
octant_->GetRoot()->GetDrawables(query);
for (PODVector<Drawable*>::Iterator i = result.Begin(); i != result.End(); ++i)
{
Drawable* drawable = *i;
unsigned drawableFlags = drawable->GetDrawableFlags();
if (drawableFlags & DRAWABLE_GEOMETRY)
{
if (drawable->GetZone() == this)
drawable->SetZone(0);
}
else if (drawableFlags & DRAWABLE_ZONE)
{
Zone* zone = static_cast<Zone*>(drawable);
zone->lastAmbientStartZone_.Reset();
zone->lastAmbientEndZone_.Reset();
}
}
}
lastWorldBoundingBox_ = GetWorldBoundingBox();
lastAmbientStartZone_.Reset();
lastAmbientEndZone_.Reset();
inverseWorldDirty_ = true;
}
开发者ID:gameogre,项目名称:Urho3D,代码行数:43,代码来源:Zone.cpp
示例17: CalculateFixedScreenSize
void Text3D::UpdateBatches(const FrameInfo& frame)
{
distance_ = frame.camera_->GetDistance(GetWorldBoundingBox().Center());
if (faceCameraMode_ != FC_NONE || fixedScreenSize_)
CalculateFixedScreenSize(frame);
for (unsigned i = 0; i < batches_.Size(); ++i)
{
batches_[i].distance_ = distance_;
batches_[i].worldTransform_ = faceCameraMode_ != FC_NONE ? &customWorldTransform_ : &node_->GetWorldTransform();
}
for (unsigned i = 0; i < uiBatches_.Size(); ++i)
{
if (uiBatches_[i].texture_ && uiBatches_[i].texture_->IsDataLost())
{
fontDataLost_ = true;
break;
}
}
}
开发者ID:03050903,项目名称:Urho3D,代码行数:22,代码来源:Text3D.cpp
示例18: UpdateBatches
void TerrainPatch::UpdateBatches(const FrameInfo& frame)
{
const Matrix3x4& worldTransform = node_->GetWorldTransform();
distance_ = frame.camera_->GetDistance(GetWorldBoundingBox().Center());
float scale = worldTransform.Scale().DotProduct(DOT_SCALE);
lodDistance_ = frame.camera_->GetLodDistance(distance_, scale, lodBias_);
batches_[0].distance_ = distance_;
batches_[0].worldTransform_ = &worldTransform;
unsigned newLodLevel = 0;
for (unsigned i = 0; i < lodErrors_.Size(); ++i)
{
if (lodErrors_[i] / lodDistance_ > LOD_CONSTANT)
break;
else
newLodLevel = i;
}
lodLevel_ = GetCorrectedLodLevel(newLodLevel);
}
开发者ID:LuisAntonRebollo,项目名称:Urho3D,代码行数:22,代码来源:TerrainPatch.cpp
示例19: DrawDebugGeometry
void Drawable::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
{
if (debug && IsEnabledEffective())
debug->AddBoundingBox(GetWorldBoundingBox(), Color::GREEN, depthTest);
}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:5,代码来源:Drawable.cpp
注:本文中的GetWorldBoundingBox函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论