当前位置: 首页>>代码示例>>C++>>正文


C++ APoint::Y方法代码示例

本文整理汇总了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;
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:32,代码来源:PX2TriggerActor.cpp

示例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;
}
开发者ID:bobbyzhu,项目名称:Phoenix3D,代码行数:33,代码来源:PX2RenderStep.cpp

示例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));
}
开发者ID:SylviaTanenbaum,项目名称:3d-simulation-and-game,代码行数:8,代码来源:PX2ApplicationBase.cpp

示例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;
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:31,代码来源:PX2Renderer.cpp

示例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;
}
开发者ID:PhoenixSteam,项目名称:Phoenix3D,代码行数:47,代码来源:PX2InputPushTransformController.cpp

示例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();
	}
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:19,代码来源:PX2Transform.cpp

示例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()));
}
开发者ID:ascetic85,项目名称:Phoenix3d,代码行数:11,代码来源:wxPropertyExtend.cpp

示例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);
	}
}
开发者ID:PhoenixSteam,项目名称:Phoenix3D,代码行数:44,代码来源:PX2EU_CanvasStage.cpp

示例9: SetRotation

//----------------------------------------------------------------------------
void Actor::SetRotation (APoint &rolate)
{
	mRotation = rolate;

	if (mMovable)
	{
		mMovable->LocalTransform.SetRotate(Matrix3f().MakeEulerXYZ(
			rolate.X(), rolate.Y(), rolate.Z()));
	}
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:11,代码来源:PX2Actor.cpp

示例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()));
	}
}
开发者ID:SylviaTanenbaum,项目名称:3d-simulation-and-game,代码行数:20,代码来源:PX2Actor_TransMoving.cpp

示例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);
	}
}
开发者ID:zhangf911,项目名称:Phoenix3D,代码行数:44,代码来源:PX2EditRenderView_Scene.cpp

示例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);
}
开发者ID:whztt07,项目名称:Phoenix3D_2.0,代码行数:11,代码来源:PX2SoundSystemFMOD.cpp

示例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);
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:44,代码来源:PX2MovableTransProperty.cpp

示例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;
}
开发者ID:PhoenixSteam,项目名称:Phoenix3D,代码行数:42,代码来源:PX2InputPushTransformController.cpp

示例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);
	}
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:51,代码来源:PX2MovableTransProperty.cpp


注:本文中的APoint::Y方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。