void OFrustum::Transform(const OMatrix3x4& transform) { for (unsigned i = 0; i < ONLY_FRUSTUM_VERTICES_NUM; ++i) //vertices[i] = transform * vertices[i]; UpdatePlanes(); }
void Frustum::Transform(const Matrix3& transform) { for (size_t i = 0; i < NUM_FRUSTUM_VERTICES; ++i) vertices[i] = transform * vertices[i]; UpdatePlanes(); }
void Frustum::Transform(const Matrix3x4& transform) { for (unsigned i = 0; i < NUM_FRUSTUM_VERTICES; ++i) vertices_[i] = transform * vertices_[i]; UpdatePlanes(); }
void Frustum::Transform(const Matrix3x4& transform) { for (auto& vertice : vertices_) vertice = transform * vertice; UpdatePlanes(); }
// thread function that handels the update process static void *UpdateThreadFunction(void *ptr) { srand(time(NULL)); while (true) { pthread_mutex_lock(&positionMutex); double latitude = userLatitude, longitude = userLongitude; pthread_mutex_unlock(&positionMutex); char *balancerUrl = GetBalancerUrl(); // printf("URL -> %s\n", balancerUrl); if (balancerUrl != NULL) { char *zoneName = GetZoneName(latitude, longitude); if (zoneName != NULL) { // printf("ZONE -> %s\n", zoneName); UpdatePlanes(balancerUrl, zoneName, latitude, longitude); free(zoneName); zoneName = NULL; } free(balancerUrl); balancerUrl = NULL; } sleep(3); } }
void cFrustum::SetViewProjMatrix(const cMatrixf& a_mtxProj, const cMatrixf& a_mtxView, float afFarPlane, float afNearPlane,float afFOV,float afAspect, const cVector3f &avOrigin, bool abInfFarPlane) { m_mtxViewProj = cMath::MatrixMul(a_mtxProj, a_mtxView); m_mtxModelView = a_mtxView; mfFarPlane = afFarPlane; mfNearPlane = afNearPlane; mfFOV = afFOV; mfAspect = afAspect; mvOrigin = avOrigin; mbInfFarPlane = abInfFarPlane; //This could be made more accurate. mOriginBV.SetSize(afNearPlane*2); mOriginBV.SetPosition(mvOrigin); UpdatePlanes(); UpdateSphere(); UpdateEndPoints(); UpdateBV(); }
Frustum::Frustum() { for (size_t i = 0; i < NUM_FRUSTUM_VERTICES; ++i) vertices[i] = Vector3::ZERO; UpdatePlanes(); }
void Frustum::Define(const BoundingBox& box, const Matrix3x4& transform) { vertices_[0] = transform * Vector3(box.max_.x_, box.max_.y_, box.min_.z_); vertices_[1] = transform * Vector3(box.max_.x_, box.min_.y_, box.min_.z_); vertices_[2] = transform * Vector3(box.min_.x_, box.min_.y_, box.min_.z_); vertices_[3] = transform * Vector3(box.min_.x_, box.max_.y_, box.min_.z_); vertices_[4] = transform * Vector3(box.max_.x_, box.max_.y_, box.max_.z_); vertices_[5] = transform * Vector3(box.max_.x_, box.min_.y_, box.max_.z_); vertices_[6] = transform * Vector3(box.min_.x_, box.min_.y_, box.max_.z_); vertices_[7] = transform * Vector3(box.min_.x_, box.max_.y_, box.max_.z_); UpdatePlanes(); }
void OFrustum::Init(const OVector3& near, const OVector3& far, const OMatrix3x4& transform) { // vertices[0] = transform * near; // vertices[1] = transform * OVector3( near.x, -near.y, near.z); // vertices[2] = transform * OVector3(-near.x, -near.y, near.z); // vertices[3] = transform * OVector3(-near.x, near.y, near.z); // vertices[4] = transform * far; // vertices[5] = transform * OVector3( far.x, -far.y, far.z); // vertices[6] = transform * OVector3(-far.x, -far.y, far.z); // vertices[7] = transform * OVector3(-far.x, far.y, far.z); UpdatePlanes(); }
void Frustum::Define(const BoundingBox& box, const Matrix3x4& transform) { vertices[0] = transform * Vector3(box.max.x, box.max.y, box.min.z); vertices[1] = transform * Vector3(box.max.x, box.min.y, box.min.z); vertices[2] = transform * Vector3(box.min.x, box.min.y, box.min.z); vertices[3] = transform * Vector3(box.min.x, box.max.y, box.min.z); vertices[4] = transform * Vector3(box.max.x, box.max.y, box.max.z); vertices[5] = transform * Vector3(box.max.x, box.min.y, box.max.z); vertices[6] = transform * Vector3(box.min.x, box.min.y, box.max.z); vertices[7] = transform * Vector3(box.min.x, box.max.y, box.max.z); UpdatePlanes(); }
void Frustum::Define(const Vector3& near, const Vector3& far, const Matrix3x4& transform) { vertices[0] = transform * near; vertices[1] = transform * Vector3(near.x, -near.y, near.z); vertices[2] = transform * Vector3(-near.x, -near.y, near.z); vertices[3] = transform * Vector3(-near.x, near.y, near.z); vertices[4] = transform * far; vertices[5] = transform * Vector3(far.x, -far.y, far.z); vertices[6] = transform * Vector3(-far.x, -far.y, far.z); vertices[7] = transform * Vector3(-far.x, far.y, far.z); UpdatePlanes(); }
void Frustum::Define(const Vector3& near, const Vector3& far, const Matrix3x4& transform) { vertices_[0] = transform * near; vertices_[1] = transform * Vector3(near.x_, -near.y_, near.z_); vertices_[2] = transform * Vector3(-near.x_, -near.y_, near.z_); vertices_[3] = transform * Vector3(-near.x_, near.y_, near.z_); vertices_[4] = transform * far; vertices_[5] = transform * Vector3(far.x_, -far.y_, far.z_); vertices_[6] = transform * Vector3(-far.x_, -far.y_, far.z_); vertices_[7] = transform * Vector3(-far.x_, far.y_, far.z_); UpdatePlanes(); }
void OFrustum::Init(const OBoundingBox& box, const OMatrix3x4& transform) { // vertices[0] = transform * OVector3(box.m_max.x, box.m_max.y, box.m_min.z); // vertices[1] = transform * OVector3(box.m_max.x, box.m_min.y, box.m_min.z); // vertices[2] = transform * OVector3(box.m_min.x, box.m_min.y, box.m_min.z); // vertices[3] = transform * OVector3(box.m_min.x, box.m_max.y, box.m_min.z); // vertices[4] = transform * OVector3(box.m_max.x, box.m_max.y, box.m_max.z); // vertices[5] = transform * OVector3(box.m_max.x, box.m_min.y, box.m_max.z); // vertices[6] = transform * OVector3(box.m_min.x, box.m_min.y, box.m_max.z); // vertices[7] = transform * OVector3(box.m_min.x, box.m_max.y, box.m_max.z); UpdatePlanes(); }
void Frustum::Define(const Matrix4& projection) { Matrix4 projInverse = projection.Inverse(); vertices_[0] = projInverse * Vector3(1.0f, 1.0f, 0.0f); vertices_[1] = projInverse * Vector3(1.0f, -1.0f, 0.0f); vertices_[2] = projInverse * Vector3(-1.0f, -1.0f, 0.0f); vertices_[3] = projInverse * Vector3(-1.0f, 1.0f, 0.0f); vertices_[4] = projInverse * Vector3(1.0f, 1.0f, 1.0f); vertices_[5] = projInverse * Vector3(1.0f, -1.0f, 1.0f); vertices_[6] = projInverse * Vector3(-1.0f, -1.0f, 1.0f); vertices_[7] = projInverse * Vector3(-1.0f, 1.0f, 1.0f); UpdatePlanes(); }
void CFunc::GetPlanes(BOOL& src, BOOL& dst) const { src = dst = FALSE; CMyString sDescr = DescrName(); CMyString srcStr = firstChanStr(sDescr); CMyString dstStr = firstChanStr(sDescr); src = planeChannel(srcStr); if (dstStr.IsEmpty()) dst = src; else dst = planeChannel(dstStr); if (!src && !dst && sDescr.Found(_T("P"))) src = dst = TRUE; UpdatePlanes(src,dst); }
void Frustum::DefineSplit(const Matrix4& projection, float near, float far) { Matrix4 projInverse = projection.Inverse(); // Figure out depth values for near & far Vector4 nearTemp = projection * Vector4(0.0f, 0.0f, near, 1.0f); Vector4 farTemp = projection * Vector4(0.0f, 0.0f, far, 1.0f); float nearZ = nearTemp.z_ / nearTemp.w_; float farZ = farTemp.z_ / farTemp.w_; vertices_[0] = projInverse * Vector3(1.0f, 1.0f, nearZ); vertices_[1] = projInverse * Vector3(1.0f, -1.0f, nearZ); vertices_[2] = projInverse * Vector3(-1.0f, -1.0f, nearZ); vertices_[3] = projInverse * Vector3(-1.0f, 1.0f, nearZ); vertices_[4] = projInverse * Vector3(1.0f, 1.0f, farZ); vertices_[5] = projInverse * Vector3(1.0f, -1.0f, farZ); vertices_[6] = projInverse * Vector3(-1.0f, -1.0f, farZ); vertices_[7] = projInverse * Vector3(-1.0f, 1.0f, farZ); UpdatePlanes(); }
void cFrustum::SetViewProjMatrix(const cMatrixf &a_mtxProj, const cMatrixf &a_mtxView, float a_fFarPlane, float a_fNearPlane, float a_fFOV, float a_fAspect, const cVector3f &a_vOrigin, bool a_bInfFarPlane) { m_mtxViewProj = cMath::MatrixMul(a_mtxProj, a_mtxView); m_mtxModelView = a_mtxView; m_fFarPlane = a_fFarPlane; m_fNearPlane = a_fNearPlane; m_fFOV = a_fFOV; m_fAspect = a_fAspect; m_vOrigin = a_vOrigin; m_bInfFarPlane = a_bInfFarPlane; m_OriginBV.SetSize(a_fNearPlane*2); m_OriginBV.SetPosition(m_vOrigin); UpdatePlanes(); UpdateSphere(); UpdateEndPoints(); UpdateBV(); }
Frustum::Frustum() { UpdatePlanes(); }