Example #1
0
	VOVERRIDE void OnClick(VMenuEventDataObject *pEvent) 
	{
		VDialog::OnClick(pEvent);

 		hkvVec2 vMousePos = GetContext()->GetCurrentMousePos();
 		hkvVec3 vDir;
 		Vision::Contexts.GetCurrentContext()->GetTraceDirFromScreenPos(vMousePos.x, vMousePos.y, vDir, 10000.f);
 		hkvVec3 vFrom = Vision::Camera.GetCurrentCameraPosition();
 		hkvVec3 vTo = vFrom + vDir;

		const float v2h = vHavokConversionUtils::GetVision2HavokScale();
		hkVector4 from; from.set( vFrom.x*v2h, vFrom.y*v2h, vFrom.z*v2h );
		hkVector4 to; to.set( vTo.x*v2h, vTo.y*v2h, vTo.z*v2h );

		hkaiNavMeshQueryMediator::HitDetails hit;
		hit.m_hitFaceKey = HKAI_INVALID_PACKED_KEY;
		hit.m_hitFraction = -1.f;
		if (vHavokAiModule::GetInstance()->GetAiWorld()->getDynamicQueryMediator()->castRay(from, to, hit))
		{
			hkVector4 hitPoint; hitPoint.setInterpolate(from, to, hit.m_hitFraction);
			hitPoint.mul4( vHavokConversionUtils::GetHavok2VisionScale() );
			if (pEvent->m_iButtons & BUTTON_LMOUSE)
			{
				vStartPoint.set( hitPoint(0), hitPoint(1), hitPoint(2) );				
			}
			else
			{
				vEndPoint.set( hitPoint(0), hitPoint(1), hitPoint(2) );
			}
		}
	}
Example #2
0
void VFreeCamera::GetCurrentMoveAxes(hkvVec3& vForward, hkvVec3& vRight, hkvVec3& vUp) const
{
  vUp.set(0.0f, 0.0f, 1.0f);

  hkvMat3 mat(hkvNoInitialization);
  GetRotationMatrix(mat);
  vForward = mat.getAxis(0);
  vRight = mat.getAxis(1);
}
Example #3
0
  /// \brief
  ///   Initializes useful default
  inline void InitDefaults()
  {
    m_bSortTextureChannels = false;
    m_bUseTempFolder = false;
    m_sTerrainFolder = "TerrainScene";
    m_iSectorCount[0] = m_iSectorCount[1] = 16;
    m_fViewDistance = 100000.f;
    m_iHeightSamplesPerSector[0] = m_iHeightSamplesPerSector[1] = 128; ///< ideal size
    m_vSectorSize.set(10000.f,10000.f);
    m_iTilesPerSector[0] = m_iTilesPerSector[1] = 16;
    m_iDensityMapSamplesPerSector[0] = m_iDensityMapSamplesPerSector[1] = 32;
    m_vTerrainPos.set(0.f,0.f,0.f);
    m_fPurgeInterval = 100.f;
    m_iMemoryLimit = 500;
    m_iDefaultWeightmapResolution[0] = m_iDefaultWeightmapResolution[1] = 512;
    m_iMaterialMapResolution[0] = m_iMaterialMapResolution[1] = 0; // no material map by default

    m_fVisibilityHeightOverTerrain = 2000.f;
    m_iReplacementLOD = -1;
    m_fReplacementDistance = -1.f;
    m_bDistanceBasedLODOnly = false;
    m_bIgnoreHeightForLOD = false;
    m_bNormalmapUsesBorder = false;
    m_bSceneSpecificLightmaps = false;
    m_bUseThreeWayMapping = false;
    m_bUseNormalMapping = false;
    m_bUseLightMapping = false;
    m_fPrecacheMargin = 1.0f;

	m_iOldSectorCount[0] = 0;	
	m_iOldSectorCount[1] = 0;	

	m_iOldSectorStartIndex[0] = 0;	// For Terrain sector expansion
	m_iOldSectorStartIndex[1] = 0;

	m_iNewSectorStartIndex[0] = 0;	// For Terrain sector expansion
	m_iNewSectorStartIndex[1] = 0;

    Finalize();
  }
void vHavokShapeFactory::ExtractScaling(const hkvMat4 &mat, hkvVec3& destScaling)
{
  hkvVec3 vx(hkvNoInitialization),vy(hkvNoInitialization),vz(hkvNoInitialization);
  mat.getAxisXYZ (&vx, &vy, &vz);
  destScaling.set(vx.getLength(),vy.getLength(),vz.getLength());
}