本文整理汇总了C++中APoint::Y方法的典型用法代码示例。如果您正苦于以下问题:C++ APoint::Y方法的具体用法?C++ APoint::Y怎么用?C++ APoint::Y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APoint
的用法示例。
在下文中一共展示了APoint::Y方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsPointIn
//----------------------------------------------------------------------------
bool TriggerActor::IsPointIn(const PX2::APoint &point) const
{
Transform trans = WorldTransform;
APoint localPoint = trans.Inverse() * point;
if (mAreaType == AT_SPHERE)
{
Sphere3f sphere;
sphere.Radius = mAreaParam[0];
if (InSphere<float>(localPoint, sphere))
return true;
}
else if (mAreaType == AT_BOX)
{
Box3f box;
box.Extent[0] = mAreaParam[0];
box.Extent[1] = mAreaParam[1];
box.Extent[2] = mAreaParam[2];
if (localPoint.X() >= -box.Extent[0] &&
localPoint.Y() >= -box.Extent[1] &&
localPoint.Z() >= -box.Extent[2] &&
localPoint.X() <= box.Extent[0] &&
localPoint.Y() <= box.Extent[1] &&
localPoint.Z() <= box.Extent[2])
return true;
}
return false;
}
示例2: PointWorldToViewPort
//----------------------------------------------------------------------------
Vector2f RenderStep::PointWorldToViewPort(const APoint &point,
bool *isInBack)
{
Rectf viewPort = mViewPort;
if (viewPort.IsEmpty())
viewPort = Rectf(0.0f, 0.0f, mSize.Width, mSize.Height);
HMatrix matProjView = mCamera->GetProjectionMatrix() * mCamera->GetViewMatrix();
HPoint hPoint(point.X(), point.Y(), point.Z(), point.W());
HPoint tempPoint = matProjView * hPoint;
if (isInBack)
{
if (tempPoint.Z() <= 0)
*isInBack = true;
else
*isInBack = false;
}
float wInv = 1.0f / tempPoint.W();
//投影坐标范围为[-1,1]要变成[0,1]
Vector2f screenPoint;
screenPoint.X() = (1.0f + tempPoint.X()*wInv) / 2.0f;
screenPoint.Y() = (1.0f + tempPoint.Y()*wInv) / 2.0f;
//投影坐标范围为[0,1]要变成视口内坐标
screenPoint.X() = viewPort.Left + screenPoint.X()*viewPort.Width();
screenPoint.Y() = viewPort.Bottom + screenPoint.Y()*viewPort.Height();
return screenPoint;
}
示例3: OnProjectSize
//----------------------------------------------------------------------------
void ApplicationBase::OnProjectSize (int width, int height)
{
mUIManager->GetDefaultView()->SetSize((float)width, (float)height);
APoint curPos = mUIManager->GetDefaultView()->GetCamera()->GetPosition();
mUIManager->GetDefaultView()->GetCamera()->SetPosition(APoint((float)width/2.0f,
curPos.Y(), (float)height/2.0f));
}
示例4: PointWorldToViewPort
//----------------------------------------------------------------------------
Vector2f Renderer::PointWorldToViewPort (const APoint &point, bool *isInBack)
{
HMatrix matProjView = GetProjectionMatrix() * GetViewMatrix();
HPoint hPoint(point.X(), point.Y(), point.Z(), point.W());
HPoint tempPoint = matProjView * hPoint;
if (isInBack)
{
if (tempPoint.Z() <= 0)
*isInBack = true;
else
*isInBack = false;
}
float wInv = 1.0f / tempPoint.W();
//投影坐标范围为[-1,1]要变成[0,1]
Vector2f screenPoint;
screenPoint.X() = (1.0f + tempPoint.X()*wInv)/2.0f;
screenPoint.Y() = (1.0f + tempPoint.Y()*wInv)/2.0f;
//投影坐标范围为[0,1]要变成视口内坐标
int viewX, viewY, viewW, viewH;
GetViewport(viewX, viewY, viewW, viewH);
screenPoint.X() = viewX + screenPoint.X()*viewW;
screenPoint.Y() = viewY + screenPoint.Y()*viewH;
return screenPoint;
}
示例5: TransScope
//----------------------------------------------------------------------------
bool InputPushTransformController::TransScope(APoint &pos)
{
if (mMinPos.X() > mMaxPos.X() || mMinPos.Y() > mMaxPos.Y() ||
mMinPos.Z() > mMaxPos.Z() || mMinPos == mMaxPos)
{
return false;
}
if (mMinPos.X() > pos.X())
{
pos.X() = mMinPos.X();
mVelocity.X() = 0.0f;
}
if (mMinPos.Y() > pos.Y())
{
pos.Y() = mMinPos.Y();
mVelocity.Y() = 0.0f;
}
if (mMinPos.Z() > pos.Z())
{
pos.Z() = mMinPos.Z();
mVelocity.Z() = 0.0f;
}
if (pos.X() > mMaxPos.X())
{
pos.X() = mMaxPos.X();
mVelocity.X() = 0.0f;
}
if (pos.Y() > mMaxPos.Y())
{
pos.Y() = mMaxPos.Y();
mVelocity.Y() = 0.0f;
}
if (pos.Z() > mMaxPos.Z())
{
pos.Z() = mMaxPos.Z();
mVelocity.Z() = 0.0f;
}
return true;
}
示例6: SetScale
//----------------------------------------------------------------------------
void Transform::SetScale (const APoint& scale)
{
if (scale.X()==scale.Y() && scale.Y()==scale.Z())
{
SetUniformScale(scale.X());
}
else
{
assertion(mIsRSMatrix, "Matrix is not a rotation\n");
assertion(scale[0] != 0.0f && scale[1] != 0.0f && scale[2] != 0.0f,
"Scales must be nonzero\n");
mScale = scale;
mIsIdentity = false;
mIsUniformScale = false;
UpdateHMatrix();
}
}
示例7: wxFloatProperty
//-----------------------------------------------------------------------------
wxAPoint3Property::wxAPoint3Property (const wxString &label, const wxString &name,
const APoint &value)
:
wxPGProperty(label, name)
{
SetValue(APointToVariant(value));
AddPrivateChild(new wxFloatProperty(wxT("X"),wxPG_LABEL,value.X()));
AddPrivateChild(new wxFloatProperty(wxT("Y"),wxPG_LABEL,value.Y()));
AddPrivateChild(new wxFloatProperty(wxT("Z"),wxPG_LABEL,value.Z()));
}
示例8: _MoveCamera
//----------------------------------------------------------------------------
void EU_CanvasStage::_MoveCamera(float horz, float vert)
{
if (!Project::GetSingletonPtr()) return;
Scene *scene = PX2_PROJ.GetScene();
if (!scene) return;
if (mStageCameraNode)
{
APoint position = mStageCameraNode->LocalTransform.GetTranslate();
AVector rVector;
AVector dVector;
AVector uVector;
mStageCameraNode->LocalTransform.GetRDUVector(rVector, dVector, uVector);
if (mViewType == VT_PERSPECTIVE)
{
dVector.Z() = 0.0f;
dVector.Normalize();
rVector.Z() = 0.0f;
rVector.Normalize();
position += dVector * vert;
position -= rVector * horz;
}
else if (mViewType == VT_TOP)
{
position.Y() += vert * 1.0f;
position.X() -= horz * 1.0f;
}
else if (mViewType == VT_LEFT)
{
position.Z() += vert * 1.0f;
position.Y() += horz * 1.0f;
}
else if (mViewType == VT_FRONT)
{
position.Z() += vert * 1.0f;
position.X() -= horz * 1.0f;
}
mStageCameraNode->LocalTransform.SetTranslate(position);
}
}
示例9: SetRotation
//----------------------------------------------------------------------------
void Actor::SetRotation (APoint &rolate)
{
mRotation = rolate;
if (mMovable)
{
mMovable->LocalTransform.SetRotate(Matrix3f().MakeEulerXYZ(
rolate.X(), rolate.Y(), rolate.Z()));
}
}
示例10: SetRotation
//----------------------------------------------------------------------------
void Actor::SetRotation (const APoint &rolate)
{
if (rolate == mRotation)
return;
mRotation = rolate;
if (mMovable)
{
mMovable->LocalTransform.SetRotate(Matrix3f().MakeEulerXYZ(
rolate.X(), rolate.Y(), rolate.Z()));
}
if (mHelpMovable)
{
mHelpMovable->LocalTransform.SetRotate(Matrix3f().MakeEulerXYZ(
rolate.X(), rolate.Y(), rolate.Z()));
}
}
示例11: _MoveCamera
//----------------------------------------------------------------------------
void EditRenderView_Scene::_MoveCamera(float horz, float vert)
{
Scene *scene = PX2_PROJ.GetScene();
if (!scene) return;
CameraActor *camActor = scene->GetUseCameraActor();
if (camActor)
{
APoint position = camActor->LocalTransform.GetTranslate();
AVector rVector;
AVector dVector;
AVector uVector;
camActor->GetRDUVector(rVector, dVector, uVector);
if (mViewType == VT_PERSPECTIVE)
{
dVector.Z() = 0.0f;
dVector.Normalize();
rVector.Z() = 0.0f;
rVector.Normalize();
position += dVector * vert;
position -= rVector * horz;
}
else if (mViewType == VT_TOP)
{
position.Y() += vert * 1.0f;
position.X() -= horz * 1.0f;
}
else if (mViewType == VT_LEFT)
{
position.Z() += vert * 1.0f;
position.Y() += horz * 1.0f;
}
else if (mViewType == VT_FRONT)
{
position.Z() += vert * 1.0f;
position.X() -= horz * 1.0f;
}
camActor->LocalTransform.SetTranslate(position);
}
}
示例12: SetPosition
//----------------------------------------------------------------------------
void FMODSound::SetPosition (const APoint &position)
{
FMOD_VECTOR pos;
pos.x = position.X();
pos.y = position.Y();
pos.z = position.Z();
if (mChannel)
mChannel->set3DAttributes(&pos, 0);
}
示例13: OnChange
//-----------------------------------------------------------------------------
void MovableTransProperty::OnChange (wxPropertyGridEvent &event)
{
if (!mProperty)
return;
wxPGProperty *id = event.GetProperty();
const wxString &name = event.GetPropertyName();
std::string stdName = std::string(name);
wxVariant variant = id->GetValue();
if (0 == id)
return;
if (variant.IsNull())
return;
APoint value;
if (mPropertyTranslate == id)
{
value = APointRefFromVariant(variant);
mTrans->SetTranslate(value);
}
else if (mPropertyRotation == id)
{
value = APointRefFromVariant(variant);
mTrans->SetRotate(Matrix3f().MakeEulerXYZ(
value.X(), value.Y(), value.Z()));
}
else if (mPropertyScale == id)
{
value = APointRefFromVariant(variant);
if (value.X()!=0.0f && value.Y()!=0.0f && value.Z()!=0.0f)
{
mTrans->SetScale(value);
}
}
Event *ent = 0;
ent = EditEventSpace::CreateEventX(EditEventSpace::ObjectTransformChanged);
ent->SetData<Object*>(mObject);
EventWorld::GetSingleton().BroadcastingLocalEvent(ent);
}
示例14: GetSmallTransDir
//----------------------------------------------------------------------------
AVector InputPushTransformController::GetSmallTransDir()
{
Movable *movable = DynamicCast<Movable>(mObject);
if (!movable)
AVector::ZERO;
APoint curPos = movable->LocalTransform.GetTranslate();
AVector moveDir = AVector::ZERO;
if (curPos.X() < mMinPosSmall.X())
{
moveDir.X() = mMinPosSmall.X() - curPos.X();
}
if (curPos.Y() < mMinPosSmall.Y())
{
moveDir.Y() = mMinPosSmall.Y() - curPos.Y();
}
if (curPos.Z() < mMinPosSmall.Z())
{
moveDir.Z() = mMinPosSmall.Z() - curPos.Z();
}
if (curPos.X()>mMaxPosSmall.X())
{
moveDir.X() = mMaxPosSmall.X() - curPos.X();
}
if (curPos.Y() > mMaxPosSmall.Y())
{
moveDir.Y() = mMaxPosSmall.Y() - curPos.Y();
}
if (curPos.Z() > mMaxPosSmall.Z())
{
moveDir.Z() = mMaxPosSmall.Z() - curPos.Z();
}
return moveDir;
}
示例15: scale
MovableTransProperty::MovableTransProperty (PropertyPage *parent,
const std::string &name, const std::string &tag,
Transform *trans, Object *obj)
:
Property(parent, name, tag, Property::PT_TRANSFORM, 0),
mIsRSMatrix(0),
mPropertyTranslate(0),
mPropertyRotation(0),
mPropertyScale(0),
mPropertyIsUniformScale(0),
mTrans(trans),
mObject(obj)
{
APoint position;
APoint rotation;
APoint scale(1.0f, 1.0f, 1.0f);
bool isRSMatrix = mTrans->IsRSMatrix();
if (isRSMatrix)
{
position = mTrans->GetTranslate();
Matrix3f mat = mTrans->GetRotate();
mat.ExtractEulerXYZ(rotation.X(), rotation.Y(), rotation.Z());
scale = mTrans->GetScale();
bool isUniformScale = mTrans->IsUniformScale();
mProperty = parent->mPage->Append(new wxStringProperty(
name, tag, wxT("<composed>")) );
mPropertyTranslate = parent->mPage->AppendIn(mProperty,
new wxAPoint3Property("Translate", tag+"Translate",
position));
mPropertyRotation = parent->mPage->AppendIn(mProperty,
new wxAPoint3Property("Rotate", tag+"Rotate", rotation));
mPropertyScale = parent->mPage->AppendIn(mProperty,
new wxAPoint3Property("Scale", tag+"Scale", scale));
mPropertyIsUniformScale = parent->mPage->AppendIn(mProperty,
new wxBoolProperty("IsUniformScale", tag+"IsUniformScale", isUniformScale));
mPropertyIsUniformScale->Enable(false);
}
else
{
mProperty = parent->mPage->Append(new wxStringProperty(
name, tag, wxT("<composed>")) );
mIsRSMatrix = parent->mPage->AppendIn(mProperty,
new wxBoolProperty("IsRSMatrix", tag+"IsRSMatrix", false));
mIsRSMatrix->Enable(false);
}
}