コード例 #1
0
/*---------------------------------------------------------------------*//**
	実座標を論理 座標に変換する
**//*---------------------------------------------------------------------*/
void View::convRealToLogicalPoint(PointF32* ptLogical, const PointF32* ptReal) const
{
	switch(getRotZ())
	{
	case TFW_DISPF_RANG_0:
		ptLogical->set(
			(             (ptReal->x() * _scaleCoord) - _xLeft) * _xscaleLgcInv,
			(             (ptReal->y() * _scaleCoord) - _yTop ) * _yscaleLgcInv);
		break;
	case TFW_DISPF_RANG_90:
		ptLogical->set(
			(             (ptReal->y() * _scaleCoord) - _xLeft) * _xscaleLgcInv,
			(_heightCur - (ptReal->x() * _scaleCoord) - _yTop ) * _yscaleLgcInv);
		break;
	case TFW_DISPF_RANG_180:
		ptLogical->set(
			(_widthCur  - (ptReal->x() * _scaleCoord) - _xLeft) * _xscaleLgcInv,
			(_heightCur - (ptReal->y() * _scaleCoord) - _yTop ) * _yscaleLgcInv);
		break;
	case TFW_DISPF_RANG_270:
		ptLogical->set(
			(_widthCur  - (ptReal->y() * _scaleCoord) - _xLeft) * _xscaleLgcInv,
			(             (ptReal->x() * _scaleCoord) - _yTop ) * _yscaleLgcInv);
		break;
	}
}
コード例 #2
0
void RollingBall::drawObject(IDirect3DDevice9 *d3dDev)
{
	D3DXMATRIX worldMat, viewMat, matTransform, matProjection, matScale, matTranslate,  matRotation;

	if(actor == NULL)
	{
		return;
	}
	
	//scaling
	D3DXMatrixScaling(&matScale,1.0f, 1.0f, 1.0f);
	worldMat = matScale;

	//rotation
	if(xRot)
		D3DXMatrixRotationX(&matRotation, getRotX());
	else
		D3DXMatrixRotationZ(&matRotation, getRotZ());
	worldMat *= matRotation;

	//translation
	D3DXMatrixTranslation(&matTranslate, getX(), getY(), getZ());
	worldMat *= matTranslate;

	//final matrix = ISROT, identity * scale * rotation * orbit * translation
	d3dDev->SetTransform(D3DTS_WORLD, &worldMat);
	//set texture
	d3dDev->SetTexture(0, texture);
	
	//draw object
	mesh->DrawSubset(0);
}
コード例 #3
0
ファイル: RigidBody.cpp プロジェクト: bagobor/tx
void RigidBody::processBodyRot_() {
	if(!body_) {
		return;
	}

	float rx = getRotX();
	float ry = getRotY();
	float rz = getRotZ();
	float ra = getRotAngle();

	// Stop setting invalid rotations that crash bullet...
	if(rx == 0.0 && ry == 0.0 && rz == 0.0) {
		rx = 1.0;
	}

	btTransform xform;
	xform = getBody().getWorldTransform();
	xform.setRotation(btQuaternion (btVector3(rx, ry, rz), ra*(PI/180)));
	//((btPairCachingGhostObject*)body_)->setWorldTransform (xform);
	body_->setWorldTransform (xform);
}