Ejemplo n.º 1
0
void VFmodManager::OneTimeInit()
{
  if (!PROFILING_FMOD_OVERALL)
  {
    PROFILING_FMOD_OVERALL = Vision::Profiling.GetFreeElementID();
    PROFILING_FMOD_PUREUPDATE = Vision::Profiling.GetFreeElementID();
    PROFILING_FMOD_PURGE = Vision::Profiling.GetFreeElementID();

    Vision::Profiling.AddGroup("Fmod");
    VProfilingNode *pOverall = Vision::Profiling.AddElement(PROFILING_FMOD_OVERALL, "Overall", TRUE);
      VProfilingNode *pUpdate = Vision::Profiling.AddElement(PROFILING_FMOD_PUREUPDATE, "  Pure update", TRUE, pOverall);  
        Vision::Profiling.AddElement(PROFILING_FMOD_PURGE, "  Purge instances", TRUE, pOverall);
  }

  Vision::RegisterModule(&g_FmodModule);

  m_pSoundResourceManager = new VFmodSoundResourceManager();
  Vision::ResourceSystem.RegisterResourceManager(m_pSoundResourceManager, VColorRef(0,255,100));
  m_pEventGroupManager = new VFmodEventGroupManager();
  Vision::ResourceSystem.RegisterResourceManager(m_pEventGroupManager, VColorRef(255,255,100));

  Vision::Callbacks.OnEngineInit += this;
  Vision::Callbacks.OnEngineDeInit += this;
  Vision::Callbacks.OnWorldInit += this;
  Vision::Callbacks.OnWorldDeInit += this;
  Vision::Callbacks.OnUpdateSceneFinished += this;

#if defined(_VISION_MOBILE)
  Vision::Callbacks.OnLeaveForeground += this;
  Vision::Callbacks.OnEnterForeground += this;
#endif
 
  IVScriptManager::OnRegisterScriptFunctions += this;
  IVScriptManager::OnScriptProxyCreation += this;
}
Ejemplo n.º 2
0
void RPG_Effect::DebugDisplayParticleInformation(const VisParticleEffect_cl* particleEffect)
{
  if (!m_debugDisplay)
  {
    return;
  }

  const float crossSize = 100.0f;
  VColorRef crossColor = VColorRef(208, 24, 208);
  const VColorRef linkColor = VColorRef(24, 208, 208);

  // find the actual position of the effect elements and draw it
  hkvVec3 const& pos = particleEffect->GetPosition();
  Vision::Game.DrawSingleLine(pos, pos + hkvVec3(crossSize, 0.f, 0.f), crossColor);
  Vision::Game.DrawSingleLine(pos, pos + hkvVec3(-crossSize, 0.f, 0.f), crossColor);
  Vision::Game.DrawSingleLine(pos, pos + hkvVec3(0.f, crossSize, 0.f), crossColor);
  Vision::Game.DrawSingleLine(pos, pos + hkvVec3(0.f, -crossSize, 0.f), crossColor);
  Vision::Game.DrawSingleLine(pos, pos + hkvVec3(0.f, 0.f, crossSize), crossColor);
  Vision::Game.DrawSingleLine(pos, pos + hkvVec3(0.f, 0.f, -crossSize), crossColor);

  // draw a link to the parent if any
  if (m_parentEntity)
  {
    Vision::Game.DrawSingleLine(pos, GetPosition(), linkColor);
  }
}
bool RPG_AiControllerComponent::FleeFromPosition(hkvVec3 const& targetPosition, float const fleeDistance /*= 300.f*/)
{
  VASSERT(m_characterOwner);
  hkvVec3 const& currentPosition = m_characterOwner->GetPosition();

  // find a position away from the target
  hkvVec3 const& fleeDirection = (currentPosition - targetPosition).getNormalized(); //direction from target to me
  hkvVec3 const& fleePosition = currentPosition + fleeDirection * fleeDistance;

  // if fleePosition is valid, just use it
  if (RPG_ControllerUtil::IsPointOnNavmesh(fleePosition))
  {
    m_characterOwner->GetActionHandler().PerformAction(AT_Move, false, NULL, fleePosition);
    if (m_characterOwner->ShouldDisplayDebugStateInformation())
    {
      Vision::Game.DrawSingleLine(currentPosition, fleePosition, VColorRef(24, 208, 208), 3.0f);
    }
    return true;
  }
  else
  {
    hkvVec3 nearestFleePosition;
    if (RPG_ControllerUtil::GetClosestPointOnNavMesh(fleePosition, 5.0f, nearestFleePosition))
    {
      m_characterOwner->GetActionHandler().PerformAction(AT_Move, false, NULL, nearestFleePosition);
      if (m_characterOwner->ShouldDisplayDebugStateInformation())
      {
        Vision::Game.DrawSingleLine(currentPosition, nearestFleePosition, VColorRef(24, 208, 208), 3.0f);
      }
      return true;
    }
  }
  return false;
}
void MenuController::Enable(){
	this->m_pMainMenuDialog = spContext->ShowDialog("Assets\\MainMenu.xml");
	this->enabled=true;
	
	/*Screen Dimensions */
	int x = Vision::Video.GetXRes();
	int y = Vision::Video.GetYRes();

	/* Create Buttons */
	VPushButton* buttonGR = new VPushButton();
	VPushButton* buttonToD = new VPushButton();
	VPushButton* buttonScene3 = new VPushButton();
	VPushButton* buttonScene4 = new VPushButton();
	VPushButton* buttonScene5 = new VPushButton();
	VPushButton* buttonScene6 = new VPushButton();

	VPushButton* buttonArray[6] = {buttonGR, buttonToD, buttonScene3, buttonScene4, buttonScene5, buttonScene6};
	char *sceneNames[6] = {"Gravity Room", "Tower of Doom", "Particle Rain", "Tumbler", "Car Derby", "Water Simulation"};

	for(int i = 0; i < 6; i++){
		buttonArray[i]->SetPosition((x/2) - x/4, y * i/6 + y/20);		
		buttonArray[i]->SetText(sceneNames[i]);
		buttonArray[i]->SetSize(x/2, y/20);		
		buttonArray[i]->SetDialogResult(i+1);	//every scene has a dialog result used for loading call
		buttonArray[i]->SetEnabled(true); //not sure if this is necessary

		buttonArray[i]->Text().SetFont(Vision::Fonts.FindFont("MenuFont"));
		buttonArray[i]->Text().SetColor(VColorRef (100,40,245,255));
		
		buttonArray[i]->Text().SetHorizontalAlignment(VisFont_cl::ALIGN_CENTER);
		buttonArray[i]->Text().SetVerticalAlignment(VisFont_cl::ALIGN_CENTER);
		
		m_pMainMenuDialog->AddControl(buttonArray[i]);
	}
}
void CRBX_ModelViewCtrl::SetBkgColor(UCHAR r, UCHAR g, UCHAR b)
{
  VisionRenderLoop_cl *pRL = (VisionRenderLoop_cl *)VisRenderContext_cl::GetMainRenderContext()->GetRenderLoop();
  VColorRef clearColor = Vision::Renderer.GetDefaultClearColor();
  clearColor.SetNoAlpha(VColorRef(r,g,b));
  Vision::Renderer.SetDefaultClearColor(clearColor);
}
void SimpleSkeletalAnimatedObject_cl::ThinkFunction()
{
  // Check whether the object is active.
  if (GetAnimConfig() == NULL)
    return;

  const float dtime = Vision::GetTimer()->GetTimeDifference();

  // highlight the bone after animation event
  if (m_fBoneHighlightDuration > 0.0f && !m_sHighlightedBoneName.IsEmpty())
  {
    int iColorVal = static_cast<int>(m_fBoneHighlightDuration / BONE_HIGHLIGHT_FADEOUTTIME * 255.0f);
    DrawBoneBoundingBox(m_sHighlightedBoneName, VColorRef(iColorVal,iColorVal, 0), 2.f);
    m_fBoneHighlightDuration -= Vision::GetTimer()->GetTimeDifference();
  }

  // update the LookAt
  if (m_eSampleMode == MODE_LOOKAT)
  {
    VASSERT(m_pLookAtTarget);

    // rotate the object around the character
    m_fLookAtRotationPhase = hkvMath::mod(m_fLookAtRotationPhase + dtime*0.7f, hkvMath::pi() * 2.0f);
    hkvVec3 vNewPos(100.f*hkvMath::sinRad(m_fLookAtRotationPhase), 100.0f*hkvMath::cosRad(m_fLookAtRotationPhase), 160.0f);
    vNewPos += GetPosition();
    m_pLookAtTarget->SetPosition(vNewPos);

    // update the LookAt orientation
    UpdateLookatHeadRotation(dtime);
  }
}
Ejemplo n.º 7
0
void Vehicle::CacheEffects()
{
	VisParticleEffectFile_cl* fxDustTrail = VisParticleGroupManager_cl::GlobalManager().LoadFromFile("Particles\\Car_DustTrail_Sand_SingleTire.xml");
	VASSERT(fxDustTrail);
	VisParticleEffectFile_cl* fxTyreMark = VisParticleGroupManager_cl::GlobalManager().LoadFromFile("Particles\\Car_Tyremark_Sand.xml");
	VASSERT(fxTyreMark);

	for (int wi = 0; wi < 4; wi ++)
	{
		m_wheelFX[wi] = fxDustTrail->CreateParticleEffectInstance(hkvVec3(0.f, 0.f, 0.f), hkvVec3(0.f, 0.f, 0.f), 1.0f);
		m_tyremarkFX[wi] = fxTyreMark->CreateParticleEffectInstance(hkvVec3(0.f, 0.f, 0.f), hkvVec3(0.f, 0.f, 0.f), 1.0f);

		// Tweak the particle color
		m_wheelFX[wi]->SetAmbientColor(VColorRef(75, 75, 75, 255));
		m_tyremarkFX[wi]->SetAmbientColor(VColorRef(75, 75, 75, 255));
	}
}
/// should be called at plugin initialization time
void vHavokBehaviorResourceManager::OneTimeInit()
{
	Vision::ResourceSystem.RegisterResourceManager(this, VColorRef(25,60,200));

	// Set project asset manager
	vHavokBehaviorModule* behaviorModule = vHavokBehaviorModule::GetInstance();
	m_projectAssetManager = behaviorModule->GetProjectAssetManager();
	m_projectAssetManager->addReference();
}
void VisParticleGroupManager_cl::OneTimeInit()
{
  Vision::ResourceSystem.RegisterResourceManager(this, VColorRef(100,200,255));

  Vision::Callbacks.OnWorldDeInit += this; // register callback
  Vision::Callbacks.OnUpdateSceneFinished += this; // register callback
  Vision::Callbacks.OnReassignShaders += this; // register callback
  Vision::Callbacks.OnAfterSceneUnloaded += this; // register callback
}
Ejemplo n.º 10
0
void RPG_DestructibleEntity::SetEffectDefaults()
{
  RPG_DestructibleEntityEffect_e effectType;

  effectType = DEFX_TakeHit;
  {
    m_effectDefinitions[effectType].m_shaderFlashDuration = 1.f;
    m_effectDefinitions[effectType].m_shaderFlashColor = VColorRef(150, 200, 255);
  }
}
Ejemplo n.º 11
0
VDialog::VDialog()
{
  m_Frame.SetOwner(this);
  m_uiDialogFlags = 0;
  m_iOrder = DIALOG_ORDER_FRONT;
  m_iDialogResult = 0;
  m_fFadeInPos = 1.f;
  m_fFadeInSpeed = 0.f;
  m_iStatus = ITEMSTATUS_VISIBLE|ITEMSTATUS_ENABLED;
  m_vClientMin.set(16.f,16.f);
  m_vClientMax.set(8192.0f, 8192.0f); // 8192.0f is enough for everyone (greetings from the past!)
  m_iBackFadeColor = VColorRef(100,100,100,255);
  m_fBackFadePos = 0.f;
  m_fBackFadeSpeed = 1.f;
  m_bFadeBack = false;
  m_eStartPos = AbsolutePos;
  m_iBackColor = VColorRef(0,0,0,0); // a=0 -> no constant color
  m_pImage = NULL;
}
void RPG_GuiManager_VisionGUI::AddSkillButtonsToParentDialog()
{
  InitializeButtonDefinitions();

  // add skill buttons
  for (int i = 0; i < BTN_Count; ++i)
  {
    VASSERT(!m_skillButtons[i]);
    m_skillButtons[i] = new VPushButton();
    VASSERT(m_skillButtons[i]);

    // button image(s)
    VTextureObject *buttonTexture = Vision::TextureManager.Load2DTexture(m_skillButtonDefinitions[i].m_imageFileName.AsChar());
    VASSERT_MSG(buttonTexture, "Button texture failed to load.");
    VASSERT_MSG(buttonTexture->IsTexturePowerOfTwo(), "Button texture's dimensions must be a power of two.");
    m_skillButtons[i]->Image().SetTexture(buttonTexture); // set all 4 textures for now
    m_skillButtons[i]->Image().SetTransparency(VIS_TRANSP_ALPHA);
    m_skillButtons[i]->Image().m_States[VWindowBase::MOUSEOVER].SetColor(VColorRef(128,128,255,255));
    m_skillButtons[i]->Image().m_States[VWindowBase::SELECTED].SetColor(VColorRef(208,24,24,255));
    m_skillButtons[i]->Image().m_States[VWindowBase::DISABLED].SetColor(VColorRef(128,128,128,255));

    // position, size and visibility
    hkvVec2 const position = FindButtonPosition(m_skillButtonDefinitions[i].m_positionOffsetFromCorner, m_skillButtonDefinitions[i].m_positionCorner);
    m_skillButtons[i]->SetPosition(position.x, position.y);
    m_skillButtons[i]->SetSize(m_skillButtonDefinitions[i].m_size.x, m_skillButtonDefinitions[i].m_size.y);
    m_skillButtons[i]->SetVisible(m_skillButtonDefinitions[i].m_initiallyVisible);

    VASSERT(m_parentDialog);
    m_parentDialog->AddControl(m_skillButtons[i]);
  }

#if defined(_VISION_MOBILE)
  MapTouchArea(m_skillButtons[BTN_RangedAttack], PI_ShiftModifier);
  MapTouchArea(m_skillButtons[BTN_PowerAttack], PI_SecondaryShiftModifier);
  MapTouchArea(m_skillButtons[BTN_AoeAttack], PI_SpecialAction01);
  MapTouchArea(m_skillButtons[BTN_RangedAttackAlt], PI_ShiftModifier);
  MapTouchArea(m_skillButtons[BTN_PowerAttackAlt], PI_SecondaryShiftModifier);
  MapTouchArea(m_skillButtons[BTN_AoeAttackAlt], PI_SpecialAction01);
#endif
}
void RPG_AiControllerComponent::DebugDisplayStateInformation() const
{
  const float vOffset = 0.f;
  VString msg, tempLine, stateName;

  RPG_AIState_e const state = GetState();
  switch(state)
  {
  case ST_None:
    stateName = "None";
  case ST_Spawning:
    stateName = "Spawning";
    break;
  case ST_Wandering:
    stateName = "Wandering";
    break;
  case ST_Challenging:
    stateName = "Challenging";
    break;
  case ST_MovingToPosition:
    stateName = "Moving to Position";
    break;
  case ST_MeleeAttacking:
    stateName = "Melee Attacking";
    break;
  case ST_RangedAttacking:
    stateName = "Ranged Attacking";
    break;
  case ST_AoeAttacking:
    stateName = "AoE Attacking";
    break;
  case ST_Fleeing:
    stateName = "Fleeing";
    break;
  case ST_Healing:
    stateName = "Healing";
    break;
  default:
    VASSERT_MSG(false, "Hey developer! Update your DebugDisplayStateInformation() to accommodate any newly-defined states.");
    break;
  }

  tempLine.Format("State: %s\n", stateName.AsChar());
  msg += tempLine;

  VASSERT(m_characterOwner);
  const hkvVec3 vPos = m_characterOwner->GetPosition() + hkvVec3(0.0f, 0.0f, vOffset);

  Vision::Message.SetTextColor(VColorRef(208,127,127,255));
  Vision::Message.DrawMessage3D(msg, vPos);
  Vision::Message.SetTextColor(); // restore default white
}
Ejemplo n.º 14
0
 /// \brief
 ///   Constructor; Sets defaults
 inline VStateGroupBlendBase() 
 {
   memset(this, 0, sizeof(VStateGroupBlendBase)); ///< turn off everything by default
   m_cBlendOp = BLEND_OP_ADD;
   m_cSrcBlend = BLEND_ONE;
   m_cDestBlend = BLEND_ONE;
   m_cBlendOpAlpha = BLEND_OP_ADD;
   m_cSrcBlendAlpha = BLEND_ONE;
   m_cDestBlendAlpha = BLEND_ONE;
   m_iRenderTargetWriteMask = 0xffffffff;
   m_cAlphaTestFunc = COMPARISON_GREATER_EQUAL;
   m_cAlphaTestRef = 128;
   m_blendFactor = VColorRef(255,255,255,255);
 }
void RPG_GuiManager_VisionGUI::UpdateManaBarGlow(float const deltaTime)
{
  float const endTime = m_manaGlowStartTime + m_manaGlowDuration;
  float const remainingTime = endTime - Vision::GetTimer()->GetTime();
  if (remainingTime > 0.f)
  {
    UBYTE const alphaInterp = static_cast<UBYTE>(remainingTime * 255.f / m_manaGlowDuration);
    m_manaBarGlow->Image().m_States->SetColor(VColorRef(255, 255, 255, alphaInterp));
  }
  else
  {
    m_manaGlowDuration = 0.f;
    m_manaBarGlow->SetVisible(false);
  }
}
Ejemplo n.º 16
0
void RPG_Action_RangedAttack::DisplayDamage() const
{
  const float vOffset = 400.f;
  VString msg, tempLine;

  tempLine.Format("Dealing Damage: %i\n", m_outgoingDamage);
  msg += tempLine;

  VASSERT(m_characterOwner);
  const hkvVec3 vPos = m_characterOwner->GetPosition() + hkvVec3(0.0f, 0.0f, vOffset);

  Vision::Message.SetTextColor(VColorRef(208,127,127,255));
  Vision::Message.DrawMessage3D(msg, vPos);
  Vision::Message.SetTextColor(); // restore default white
}
Ejemplo n.º 17
0
bool vHavokAiModule::ComputeAndDrawPath(IVRenderInterface *pRenderer, hkvVec3* startPoint, hkvVec3* endPoint, float radius, float height, float displayOffset, unsigned int color) const
{
	hkaiPathfindingUtil::FindPathInput input(1);
	hkaiPathfindingUtil::FindPathOutput output;
	bool foundPath = _ComputePath(m_aiWorld, startPoint, endPoint, radius, input, output);

	if (input.m_startFaceKey != HKAI_INVALID_PACKED_KEY && input.m_goalFaceKeys[0] != HKAI_INVALID_PACKED_KEY)
	{
		vHavokAiNavMeshDebugDisplayHandler displayHandler;
		hkReal displayOffsetHavokScale = VIS2HK_FLOAT_SCALED(displayOffset);
		hkaiNavMeshDebugUtils::_drawPathWithRadius(input, output, color, hkColor::ORANGE, &displayHandler, 0, displayOffsetHavokScale);
	}

	hkvVec3 vStartPos; vHavokConversionUtils::PhysVecToVisVecWorld(input.m_startPoint,vStartPos); 
	hkvVec3 vEndPos; vHavokConversionUtils::PhysVecToVisVecWorld(input.m_goalPoints[0],vEndPos); 
	hkvVec3 vScaledDir ( 0.f, 0.f, height );
	VSimpleRenderState_t state(VIS_TRANSP_NONE, RENDERSTATEFLAG_FRONTFACE|RENDERSTATEFLAG_WRITETOZBUFFER);	
	int sd = (input.m_startFaceKey != HKAI_INVALID_PACKED_KEY) ? 1 : 2;
	int ed = (input.m_goalFaceKeys[0] != HKAI_INVALID_PACKED_KEY) ? 1 : 2;
	pRenderer->RenderCylinder(vStartPos, vScaledDir, radius, VColorRef(255/sd, 165/sd, 0/sd), state, RENDERSHAPEFLAGS_SOLID|RENDERSHAPEFLAGS_CAP1);
	pRenderer->RenderCylinder(vEndPos, vScaledDir, radius, VColorRef(0/ed, 128/ed, 0/ed), state, RENDERSHAPEFLAGS_SOLID|RENDERSHAPEFLAGS_CAP1);

	return foundPath;
}
void MenuController::Enable(VInputMap* inputMap){
	//VDialogCollection openDialogs = spContext->
	//for(int i = 0; i < openDialogs.Count(); i++){
		//spContext->CloseDialog(openDialogs.GetAt(i));
	//}
	this->enabled=true;
#if defined(WIN32)
	this->m_pMainMenuDialog = spContext->ShowDialog("Assets\\MainMenu.xml");
	/*Screen Dimensions */
	int x = Vision::Video.GetXRes();
	int y = Vision::Video.GetYRes();

	/* Create Buttons */
	VPushButton* buttonGR = new VPushButton();
	VPushButton* buttonToD = new VPushButton();
	VPushButton* buttonScene3 = new VPushButton();
	VPushButton* buttonScene4 = new VPushButton();
	//VPushButton* buttonScene5 = new VPushButton();
	//VPushButton* buttonScene6 = new VPushButton();

	VPushButton* buttonArray[4] = {buttonGR, buttonToD, buttonScene3, buttonScene4};//, buttonScene5, buttonScene6};
	char *sceneNames[4] = {"Gravity Room", "Tower of Doom", "Particle Rain", "Tumbler"};//, "Car Derby", "Water Simulation"};

	for(int i = 0; i < 4; i++){
		buttonArray[i]->SetPosition(0, y * i/6 + y/20);		
		buttonArray[i]->SetText(sceneNames[i]);
		buttonArray[i]->SetSize(x, y/20);		
		buttonArray[i]->SetDialogResult(i+1);	//every scene has a dialog result used for loading call
		buttonArray[i]->SetEnabled(true); //not sure if this is necessary

		buttonArray[i]->Text().SetFont(Vision::Fonts.FindFont("MenuFont"));
		buttonArray[i]->Text().SetColor(VColorRef (50,50,255,255));
		
		buttonArray[i]->Text().SetHorizontalAlignment(VisFont_cl::ALIGN_CENTER);
		buttonArray[i]->Text().SetVerticalAlignment(VisFont_cl::ALIGN_CENTER);
		
		m_pMainMenuDialog->AddControl(buttonArray[i]);
	}
#endif

#if defined(_VISION_ANDROID)
	AndroidMenu(inputMap);
#endif

}
Ejemplo n.º 19
0
void AttachedTorch_cl::Show()
{
  if (m_bVisible) return;

  m_bVisible = true;

  SetVisibleBitmask( 1 );
  SetCastShadows(FALSE);

  m_pShadowCaster->SetVisibleBitmask( ENTITY_CAST_SHADOW );
  m_pShadowCaster->SetCastShadows(TRUE);

  V_SAFE_DISPOSEOBJECT(m_pLight);

  if (m_spTorchParticles)
  {
    m_spTorchParticles->Dispose(); 
    m_spTorchParticles = NULL;
  }

  m_pTorchFX = VisParticleGroupManager_cl::GlobalManager().LoadFromFile("Data\\Vision\\Samples\\Engine\\Common\\Models\\Warrior\\TorchFire.xml");
  VASSERT(m_pTorchFX);
  m_pTorchFX->SetResourceFlag(VRESOURCEFLAG_AUTODELETE);

  m_pLight = new VisLightSource_cl(VIS_LIGHT_POINT, 800);
  VASSERT(m_pLight);

  m_pLight->SetMultiplier(1.5f);
  m_pLight->SetLightInfluenceBitMasks(0xFFFFFFFF, 0xFFFFFFFF);
  m_pLight->SetColor(VColorRef(255,180,105));
  m_pLight->SetAttenuation(VIS_LIGHT_ATTEN_CUSTOM);

#if defined(SUPPORTS_SHADOW_MAPS) && !defined(_VISION_MOBILE) && !defined( HK_ANARCHY )
  VShadowMapComponentPoint* pShadowMapComponent = new VShadowMapComponentPoint();
  pShadowMapComponent->SetShadowMapSize(256);
  pShadowMapComponent->SetShadowMappingMode(SHADOW_MAPPING_MODE_PCF8);
  m_pLight->AddComponent(pShadowMapComponent);
#endif

  hkvVec3 vPdir(0.0f, -90.0f, 0.0f);
  m_spTorchParticles = m_pTorchFX->CreateParticleEffectInstance(GetPosition(), vPdir);
}
Ejemplo n.º 20
0
void VLogoOverlay::Init()
{
#if defined(SHOW_LOGO)
  Vision::Callbacks.OnVideoChanged += this;

#if defined( HK_ANARCHY )
  m_spLogoOverlay = new VisScreenMask_cl("Textures/Anarchy_Logo_128x128.dds");
#else
  m_spLogoOverlay = new VisScreenMask_cl("Textures/Havok_Logo_128x64.dds");
#endif
  m_spLogoOverlay->SetDepthWrite(FALSE);
  m_spLogoOverlay->SetTransparency (VIS_TRANSP_ALPHA);
  m_spLogoOverlay->SetFiltering(FALSE);

  RefreshLayout();

  m_spLogoOverlay->SetColor(VColorRef(255, 255, 255, 255));
  m_spLogoOverlay->GetTextureObject()->SetResourceFlag(VRESOURCEFLAG_AUTODELETE); 
#endif
}
Ejemplo n.º 21
0
void VUINodeRotator::OnPaint(VGraphicsInfo &Graphics, const VItemRenderInfo &parentState)
{
	const VRectanglef rect = GetClientRect();

	hkvVec2 vCenter = ( rect.m_vMin + rect.m_vMax ) / 2.0f;

	hkvVec2 vSize = GetSize();

	VColorRef color = VColorRef(255,128,128,255);
	Overlay2DVertex_t v[6];

	float fWidth = vSize.x / 2;
	float fHeight = vSize.y / 2;


	IVRender2DInterface::CreateQuadVertices(-fWidth,-fHeight,fWidth,fHeight,0,0,1,1,color ,v);

	for ( int i = 0 ; i < 6 ; i++ )
	{
		Overlay2DVertex_t vertex = v[i];

		float fx = v[i].screenPos.x;
		float fy = v[i].screenPos.y;

		v[i].screenPos.x = vCenter.x + (fx * hkvMath::cosDeg (m_fAngle) + fy * hkvMath::sinDeg (m_fAngle));
		v[i].screenPos.y = vCenter.y + (-fx * hkvMath::sinDeg (m_fAngle) + fy * hkvMath::cosDeg (m_fAngle));
	}

	VTextureObject *pTex = Image().m_States[VWindowBase::NORMAL].GetCurrentTexture();
	Graphics.Renderer.Draw2DBuffer(6, v, pTex, VSimpleRenderState_t(VIS_TRANSP_ALPHA,RENDERSTATEFLAG_ALWAYSVISIBLE|RENDERSTATEFLAG_DOUBLESIDED));


	VItemRenderInfo thisState(parentState,this,1.f);
	m_TextCfg.OnPaint(Graphics,thisState);
	return;
}
// RPG_AttackableComponent
RPG_AttackableComponent::RPG_AttackableComponent()
  : RPG_HighlightableComponent()
{
  SetColor(VColorRef(32, 32, 32));
}
Ejemplo n.º 23
0
void RPG_Action_RangedAttack::Tick(float const deltaTime)
{
  RPG_Action_AttackBase::Tick(deltaTime);

  if(m_attacking)
  {
    // RangedAttacking was set to true when the action was initiated. Is reset to false by Behavior when the attack anim finishes.
    vHavokBehaviorComponent *const behaviorComponent = m_characterOwner->GetBehaviorComponent();
    VVERIFY_OR_RET(behaviorComponent);

    VASSERT(!m_behaviorTriggerVarName.IsEmpty());
    if (!RPG_VisionHavokBehaviorHelper::BehaviorGetVarNamed<bool>(*behaviorComponent, m_behaviorTriggerVarName.AsChar()))
    {
      if (m_flags == 1)
      {
        if(m_updatedInteraction)
        {
          m_updatedInteraction = false;
          if(!m_updatedInteractionEntity && m_interactionEntity)
          {
            // Do not lose the player's intended target
            ValidateInteractionEntity();
            if(!m_interactionEntity->Components().GetComponentOfType(V_RUNTIME_CLASS(RPG_AttackableComponent)))
            {
              m_interactionEntity = NULL;
            }
            else
            {
              if(m_interactionEntity->GetPosition().getDistanceToSquared(m_updatedInteractionPosition) > s_retargetingRadius * s_retargetingRadius)
              {
                m_interactionEntity = NULL;
              }
            }
          }
          else
          {
            m_interactionEntity = m_updatedInteractionEntity;
            ValidateInteractionEntity();
          }
          m_interactionPosition = m_updatedInteractionPosition;
        }
        m_startTime = Vision::GetTimer()->GetTime();
        StartAttack();
      }
      else
      {
        // if we've gotten to the end and haven't fired the projectile, fire it now
        if (!m_hasFired)
        {
          VString msg;
          msg.Format("RPG_Action_RangedAttack never received expected %s event from Behavior.", m_behaviorFireEventName.AsChar());
          Vision::Error.Warning(msg.AsChar());
          //VASSERT_MSG(false, msg.AsChar());
          FireAttack();
        }
        End();
      }
    }
    else
    {
      // we're currently attacking
      hkvVec3 const targetPosition = m_interactionEntity ? m_interactionEntity->GetPosition() : m_interactionPosition;
      FaceTargetPoint(targetPosition);

#ifdef _DEBUG
      if (m_debugDisplayInfo)
      {
        Vision::Game.DrawSingleLine(m_characterOwner->GetPosition(), targetPosition, VColorRef(255, 0, 255));
      }
#endif
    }
  }
  else
  {
    StartAttack();
  }
}
Ejemplo n.º 24
0
void VRendererNodeCommon::RenderSceneTextureWithDepth(bool bHalfSize)
{
  PushAndDisableGlobalWireframeState();

  if (m_spSceneDepthTechnique == NULL)
  {
    Vision::Shaders.LoadShaderLibrary("\\Shaders\\BaseShaders.ShaderLib", SHADERLIBFLAG_HIDDEN);
    m_spSceneDepthTechnique = Vision::Shaders.CreateTechnique("CopyWithDepthOutput", NULL);
    VASSERT(m_spSceneDepthTechnique != NULL);
  }

#ifdef _VISION_XENON
  if(bHalfSize)
  {
    // first make sure the stencil buffer is cleared.
    // we clear it to all 1's, and then reset all geometry pixels to 0
    // For this the shader simply checks a pixels depth and does a discard on sky pixels (depth == 1.0).
    // On all pixels that pass the test, the stencil value is set to zero.
    Vision::RenderLoopHelper.ClearScreen(VisRenderLoopHelper_cl::VCTF_DepthStencil, VColorRef (0, 0, 0, 0), 1.0f, 255);
#endif

    IVRender2DInterface *pRenderer = Vision::RenderLoopHelper.BeginOverlayRendering();
    VCompiledShaderPass *pPass = m_spSceneDepthTechnique->GetShader(0);
    VStateGroupTexture *pStateGroupTexture = pPass->GetStateGroupTexture(VSS_PixelShader, 0);
    if (pStateGroupTexture != NULL)
      pStateGroupTexture->m_spCustomTex = m_spColorReadTarget;

    pStateGroupTexture = pPass->GetStateGroupTexture(VSS_PixelShader, 1);
#ifdef _VISION_PS3
    if (m_spDummyDepthTexture == NULL)
      m_spDummyDepthTexture = RenderingOptimizationHelpers_cl::CreateAndPatchDummyTexture(m_spDepthReadTarget);
    if (pStateGroupTexture != NULL)
    {
      pStateGroupTexture->m_spCustomTex = m_spDummyDepthTexture;
      pPass->m_bModified = true;
    }
#else
    if (pStateGroupTexture != NULL)
    {
      pStateGroupTexture->m_spCustomTex = m_spDepthReadTarget;
      pPass->m_bModified = true;
    }
#endif

    Overlay2DVertex_t *pVertices;
    if (bHalfSize)
      pVertices = GetRendererNodeHelper()->GetOverlayVerticesHalfSize();
    else
      pVertices = GetRendererNodeHelper()->GetOverlayVertices();
    pRenderer->Draw2DBufferWithShader(6, pVertices, NULL, *pPass); 

    Vision::RenderLoopHelper.EndOverlayRendering();

#ifdef _VISION_XENON
  }
  else
  {
    if(m_spDepthOnlyTechnique360 == NULL)
    {
      m_spDepthOnlyTechnique360 = Vision::Shaders.CreateTechnique("CopyDepthOnly_360", NULL);
      VASSERT(m_spDepthOnlyTechnique360 != NULL);
    }
    VASSERT_MSG(m_bDepthRestoreInitialized, "Fast depth restore has not been initialized");
    //Restore color first (can't do this in one step because of a certification issue with Depth only rendering right after MRT rendering)
    RenderSceneTexture(bHalfSize);
    //Restore depth and stencil with xbox 360 specific implementation
    VisHiZHelper_cl::FastDepthRestore(m_fastRestoreData, m_spDepthOnlyTechnique360->GetShader(0));
  }
#endif

  PopGlobalWireframeState();
}
Ejemplo n.º 25
0
void RPG_Boss::InitializeCharacterEffects()
{
  // @todo: this is a bit of an off-topic place for this. Organize better once we data-drive this bit.
  m_projectileMeshFilename = "Models/Effects/ProjectileStandIn.model";
  RPG_CharacterEffect_e effectType;

  //const VString& fmodEventGroup = "Characters/Boss";
  //VVERIFY_MSG(RPG_VisionEffectHelper::LoadFmodEventGroup(fmodEventGroup), fmodEventGroup.AsChar());   // pre-load this character's sounds

  effectType = FX_Ambient;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_Idle.xml";
  }

  // Ranged Attack ////////////////////////////////////////////////////////////
  effectType = FX_RangedAttackFire;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_Ranged_Attack_Fire_mobile.xml";
    //m_characterEffectDefinitions[effectType].m_fmodEventGroupName = fmodEventGroup;
    //m_characterEffectDefinitions[effectType].m_fmodEventName = "Ranged_Attack_Fire";
  }

  effectType = FX_RangedAttackProjectile;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_Ranged_Attack_Proj_mobile.xml";
  }

  effectType = FX_RangedAttackImpact;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_Ranged_Attack_Impact_mobile.xml";
  }

  // AoE Attack ///////////////////////////////////////////////////////////////
  effectType = FX_AoeAttackFire;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_Aoe_Attack_mobile.xml";
    m_characterEffectDefinitions[effectType].m_fmodEventGroupName = "Characters/Guardian/Caster";
    m_characterEffectDefinitions[effectType].m_fmodEventName = "Aoe_Attack_Cast";
  }

  effectType = FX_ReceiveHeal;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Any_Character_Receive_Heal.xml";
    //m_characterEffectDefinitions[effectType].m_fmodEventGroupName = fmodEventGroup;
    //m_characterEffectDefinitions[effectType].m_fmodEventName = "Receive_Heal";
    m_characterEffectDefinitions[effectType].m_shaderFlashDuration = 1.f;
    m_characterEffectDefinitions[effectType].m_shaderFlashColor = VColorRef(0, 208, 24);
  }

  effectType = FX_TakeHit;
  {
    m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_TakeHit.xml";
    //m_characterEffectDefinitions[effectType].m_fmodEventGroupName = fmodEventGroup;
    //m_characterEffectDefinitions[effectType].m_fmodEventName = "Take_Hit";
    m_characterEffectDefinitions[effectType].m_shaderFlashDuration = 1.f;
    m_characterEffectDefinitions[effectType].m_shaderFlashColor = VColorRef(150, 200, 255);
  }

  effectType = FX_Die;
  {
    //m_characterEffectDefinitions[effectType].m_vfxFilename = "Particles/CharacterEffects/Boss_Die.xml";
    //m_characterEffectDefinitions[effectType].m_fmodEventGroupName = fmodEventGroup;
    //m_characterEffectDefinitions[effectType].m_fmodEventName = "Die";
  }
}
// RPG_InteractableComponent
RPG_InteractableComponent::RPG_InteractableComponent()
  : RPG_HighlightableComponent()
{
  SetColor(VColorRef(0, 127, 0));
}
Ejemplo n.º 27
0
void VPrefabManager::OneTimeInit()
{
 Vision::ResourceSystem.RegisterResourceManager(this, VColorRef(200,100,0));
}
bool RPG_AiControllerComponent::HasLineOfSightToTarget(bool& left, bool& center, bool& right) const
{
  VASSERT(m_characterOwner);
  VASSERT(m_target);

  RPG_ClosestRaycastResultIgnoreSourceTarget raycastResult(m_characterOwner, m_target);

  hkvVec3 rayStart;
  m_characterOwner->CalcPositionForTargeting(rayStart);

  hkvVec3 rayEnd;
  m_target->CalcPositionForTargeting(rayEnd);

  hkvVec3 directionToTarget = rayEnd - rayStart;
  directionToTarget.normalizeIfNotZero();

  // check from the center
  center = true;
  raycastResult.Reset();
  raycastResult.vRayStart = rayStart;
  raycastResult.vRayEnd = rayEnd;
  Vision::GetApplication()->GetPhysicsModule()->PerformRaycast(&raycastResult);
  if (m_characterOwner->ShouldDisplayDebugStateInformation())
  {
    if(raycastResult.bHit)
    {
      Vision::Game.DrawSingleLine(raycastResult.vRayStart, raycastResult.vRayEnd, VColorRef(208, 24, 24), 3.0f);
    }
    else
    {
      Vision::Game.DrawSingleLine(raycastResult.vRayStart, raycastResult.vRayEnd, VColorRef(24, 208, 24), 3.0f);
    }
  }
  if(raycastResult.bHit)
  {
    center = false;
  }

  // check from the left side
  left = true;
  raycastResult.Reset();
  raycastResult.vRayStart = rayStart + hkvVec3(-directionToTarget.y, directionToTarget.x, 0.0f) * m_characterOwner->GetCollisionRadius();
  raycastResult.vRayEnd = rayEnd + hkvVec3(-directionToTarget.y, directionToTarget.x, 0.0f) * m_characterOwner->GetCollisionRadius();
  Vision::GetApplication()->GetPhysicsModule()->PerformRaycast(&raycastResult);
  if (m_characterOwner->ShouldDisplayDebugStateInformation())
  {
    if(raycastResult.bHit)
    {
      Vision::Game.DrawSingleLine(raycastResult.vRayStart, raycastResult.vRayEnd, VColorRef(208, 24, 24), 3.0f);
    }
    else
    {
      Vision::Game.DrawSingleLine(raycastResult.vRayStart, raycastResult.vRayEnd, VColorRef(24, 208, 24), 3.0f);
    }
  }
  if(raycastResult.bHit)
  {
    left = false;
  }

  // check from the right side
  right = true;
  raycastResult.Reset();
  raycastResult.vRayStart = rayStart + hkvVec3(directionToTarget.y, -directionToTarget.x, 0.0f) * m_characterOwner->GetCollisionRadius();
  raycastResult.vRayEnd = rayEnd + hkvVec3(directionToTarget.y, -directionToTarget.x, 0.0f) * m_characterOwner->GetCollisionRadius();
  Vision::GetApplication()->GetPhysicsModule()->PerformRaycast(&raycastResult);
  if (m_characterOwner->ShouldDisplayDebugStateInformation())
  {
    if(raycastResult.bHit)
    {
      Vision::Game.DrawSingleLine(raycastResult.vRayStart, raycastResult.vRayEnd, VColorRef(208, 24, 24), 3.0f);
    }
    else
    {
      Vision::Game.DrawSingleLine(raycastResult.vRayStart, raycastResult.vRayEnd, VColorRef(24, 208, 24), 3.0f);
    }
  }
  if(raycastResult.bHit)
  {
    right = false;
  }

  return left && center && right;
}
Ejemplo n.º 29
0
void VDebugOptions::Init()
{
  Vision::Callbacks.OnUpdateSceneBegin += this;
  Vision::Callbacks.OnBeforeSwapBuffers += this;
  Vision::Callbacks.OnRenderHook += this;

  // Setup graph for displaying un-/filtered time steps
  VGraphProps timeStepGraphProps;
  timeStepGraphProps.vPosition.set(-0.85f, -0.3f);  
  timeStepGraphProps.fWidth = 0.25f;
  timeStepGraphProps.fHeight = 0.25f;  
  timeStepGraphProps.iResolution = 64; 
  timeStepGraphProps.bRangeAdaptation = true;
  m_pTimeStepGraph = new VGraphObject(timeStepGraphProps);
  m_pTimeStepGraph->AddCurve("Unfiltered Time Step", VColorRef(0, 255, 0), new VUnfilteredTimeDiffUpdater);
  m_pTimeStepGraph->AddCurve("Filtered Time Step", VColorRef(255, 0, 0), new VFilteredTimeDiffUpdater);
  m_pTimeStepGraph->Init();
  m_pTimeStepGraph->SetVisible(false);

#if defined(WIN32)
  GetParent()->GetInputMap()->MapTrigger(TOGGLE_FPS, VInputManager::GetKeyboard(), CT_KB_F2, VInputOptions::Once(ONCE_ON_RELEASE));
  GetParent()->GetInputMap()->MapTrigger(TOGGLE_WIREFRAME, VInputManager::GetKeyboard(), CT_KB_F3, VInputOptions::Once(ONCE_ON_RELEASE));
#endif

  VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
  if (pMainMenu == NULL)
    return;

  // General Debug Options
  //  Note: OPTION_FPS, OPTION_WIREFRAME, and OPTION_RELOAD_RESOURCES are added directly to the menu's root, the other options
  //        are added to the menu's root as a group called 'Debug Options'
  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Toggle FPS Display", OPTION_FPS, VAPP_DEFAULT_SORTING_0, true)));

  // wireframe rendering is not supported on GLES2
#if !defined(_VR_GLES2)
  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Wireframe", OPTION_WIREFRAME, VAPP_DEFAULT_SORTING_0 + 1, true)));
#endif

  m_callbacks.Append(pMainMenu->RegisterItem(VAppMenuItem("Reload Modified Resources", OPTION_RELOAD_RESOURCES, VAPP_DEFAULT_SORTING_0 + 2, false)));

  VAppMenuItems items;
  items.Add(VAppMenuItem("Show Time Step Graph", OPTION_TIME_STEP_GRAPH, 0, true));
  items.Add(VAppMenuItem("Save Screenshot", OPTION_SAVE_SCREENSHOT, 0, false));
#if defined(SUPPORTS_MULTITOUCH)
  items.Add(VAppMenuItem("Touch Area Debug Rendering", OPTION_MULTITOUCH, 0, true));
#endif
  m_callbacks.Append(pMainMenu->RegisterGroup("Debug Options", items, NULL, VAPP_DEFAULT_SORTING_0 + 3, true));
  RegisterCallbacks();

  // Debug Render Flags
  items.RemoveAll();
  items.Add(VAppMenuItem("Display Object Triangle Count", DEBUGRENDERFLAG_OBJECT_TRIANGLECOUNT, 0, true));
  items.Add(VAppMenuItem("Display Object Visibility BoundingBox", DEBUGRENDERFLAG_OBJECT_VISBBOX, 0, true));
  items.Add(VAppMenuItem("Display Object vis. Area Assignment", DEBUGRENDERFLAG_OBJECT_VISIBILITYZONES, 0, true));
  items.Add(VAppMenuItem("Display Light Influence BoundingBox", DEBUGRENDERFLAG_LIGHT_INFLUENCEBOX, 0, true));
  items.Add(VAppMenuItem("Display Trace Lines", DEBUGRENDERFLAG_TRACELINES, 0, true));
  items.Add(VAppMenuItem("Display Visibility Objects", DEBUGRENDERFLAG_VISIBILITYOBJECTS, 0, true));
  items.Add(VAppMenuItem("Display Portals", DEBUGRENDERFLAG_PORTALS, 0, true));
  items.Add(VAppMenuItem("Display Visibility Zones", DEBUGRENDERFLAG_VISIBILITYZONES, 0, true));
  items.Add(VAppMenuItem((Vision::GetScriptManager() != NULL) ? "Scripting Statistics" : "Scripting Statistics (no script man.)", DEBUGRENDERFLAG_SCRIPTSTATISTICS, 0, true));
  items.Add(VAppMenuItem("Display Object Render Order", DEBUGRENDERFLAG_OBJECTRENDERORDER, 0, true));
  items.Add(VAppMenuItem("Display Thread Workload", DEBUGRENDERFLAG_THREADWORKLOAD, 0, true));
  items.Add(VAppMenuItem("Display Streaming Zones", DEBUGRENDERFLAG_ZONES, 0, true));
  items.Add(VAppMenuItem("Display Resource Stats", DEBUGRENDERFLAG_RESOURCE_STATISTICS, 0, true));
  items.Add(VAppMenuItem("Display Memory Stats", DEBUGRENDERFLAG_MEMORY_STATISTICS, 0, true));

  m_debugInfos = pMainMenu->RegisterGroup("Debug Infos", items, "Debug Options");
  RegisterCallbacks(m_debugInfos);
}
Ejemplo n.º 30
0
void VDebugOptions::OnHandleCallback(IVisCallbackDataObject_cl* pData)
{
  if (pData->m_pSender == &Vision::Callbacks.OnUpdateSceneBegin)
  {
#if defined(WIN32)
    if (GetParent()->GetInputMap()->GetTrigger(TOGGLE_FPS))
    {
      SetFrameRateVisible(!IsFrameRateVisible());
    }
    else if (GetParent()->GetInputMap()->GetTrigger(TOGGLE_WIREFRAME))
    {
      SetWireframe(!IsWireframe());
    }
#endif

    // FPS accumulation
    {
      m_iFrameCounter++;
      m_fTimeAccumulator += Vision::GetUITimer()->GetTimeDifference();

      if (m_fTimeAccumulator >= 1.0f)
      {
        m_fCurrentFrameTime = m_fTimeAccumulator / m_iFrameCounter;
        m_fCurrentFps = m_iFrameCounter / m_fTimeAccumulator;

        m_fTimeAccumulator = 0.0f;
        m_iFrameCounter = 0;
      }
    }

    if (m_bFpsVisible)
      Vision::Message.Print(1, 10, Vision::Video.GetYRes() - 35, "FPS : %.1f\nFrame Time : %.2f", m_fCurrentFps, m_fCurrentFrameTime * 1000.0f);
  }
  else if (pData->m_pSender == &Vision::Callbacks.OnBeforeSwapBuffers)
  {
    if (m_bSaveScreenshot)
    {
      VScreenShotHelper helper;
      helper.Capture();
      if (helper.PendingDataInBuffer())
      {
        if (helper.SaveBufferToFile("", NULL, 1.0f, 1.0f))
          Vision::Message.Add(0, "Screenshot saved to \"%s\".\n", helper.GetScreenShotPath());
        else
          Vision::Message.Add(0, "Screenshot could not be saved.\n");
      }

      // Re-enable the VAppMenu again
      VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
      if (pMainMenu)
        pMainMenu->SetVisible(true);

      m_bSaveScreenshot = false;
    }
  }
  else if (pData->m_pSender == &Vision::Callbacks.OnRenderHook)
  {
    VisRenderHookDataObject_cl *pRenderHookData = (VisRenderHookDataObject_cl *)pData;
    if (pRenderHookData->m_iEntryConst == VRH_PRE_SCREENMASKS)
    {
      // Debug drawing of all visible touch areas.
#if defined(SUPPORTS_MULTITOUCH)
      if (m_bTouchAreaDebug)
      {
        IVMultiTouchInput* pMultiTouchInput = NULL;
        pMultiTouchInput = static_cast<IVMultiTouchInput*>(&VInputManager::GetInputDevice(INPUT_DEVICE_TOUCHSCREEN));
        VPListT<VTouchArea> touchAreas = pMultiTouchInput->GetTouchAreas();

        const float fBorderWidth = 3.0f;
        VSimpleRenderState_t alphaState(VIS_TRANSP_ALPHA, RENDERSTATEFLAG_FRONTFACE|RENDERSTATEFLAG_NOWIREFRAME|RENDERSTATEFLAG_ALWAYSVISIBLE);

        IVRender2DInterface *pRI = Vision::RenderLoopHelper.BeginOverlayRendering();
        {
          for (int i=0; i<touchAreas.GetLength(); ++i)
          {
            const VRectanglef& rect = touchAreas.Get(i)->GetArea();
            const VColorRef color = touchAreas.Get(i)->GetTouchPointIndex() < 0 ? VColorRef(0, 255, 0, 64) : VColorRef(0, 255, 0, 96);
            pRI->DrawSolidQuad(rect.m_vMin, rect.m_vMax, color, alphaState);

            pRI->DrawSolidQuad(rect.m_vMin, hkvVec2(rect.m_vMax.x, rect.m_vMin.y + fBorderWidth), VColorRef(0, 255, 0, 255), alphaState);
            pRI->DrawSolidQuad(hkvVec2(rect.m_vMin.x, rect.m_vMax.y - fBorderWidth), rect.m_vMax, VColorRef(0, 255, 0, 255), alphaState);
            pRI->DrawSolidQuad(hkvVec2(rect.m_vMin.x, rect.m_vMin.y + fBorderWidth), hkvVec2(rect.m_vMin.x + fBorderWidth, rect.m_vMax.y - fBorderWidth), VColorRef(0, 255, 0, 255), alphaState);
            pRI->DrawSolidQuad(hkvVec2(rect.m_vMax.x - fBorderWidth, rect.m_vMin.y + fBorderWidth), hkvVec2(rect.m_vMax.x, rect.m_vMax.y - fBorderWidth), VColorRef(0, 255, 0, 255), alphaState);
          }
        }
        Vision::RenderLoopHelper.EndOverlayRendering();
      }
#endif
    }
  }

  int iIndex = GetCallbackIndex(pData);
  if (iIndex >= 0)
  {
    if (iIndex == OPTION_FPS)
    {
      m_bFpsVisible = !m_bFpsVisible;
    }
    else if (iIndex == OPTION_WIREFRAME)
    {
      if (Vision::Renderer.GetWireframeMode())
        Vision::Renderer.SetWireframeMode(false);
      else
        Vision::Renderer.SetWireframeMode(true);
    }
    else if (iIndex == OPTION_RELOAD_RESOURCES)
    {
      int iCount = Vision::ResourceSystem.ReloadModifiedResourceFiles(NULL, VURO_HOT_RELOAD);       

      // Clear effect caches so that material shaders will be re-created (not re-used).
      Vision::Shaders.GetShaderFXLibManager().ResetCompiledEffectCaches();

      // Reassign all material shaders.
      Vision::Shaders.ReloadAllShaderAssignmentFiles();

      Vision::Message.Add(1, "%i resources were outdated and have been reloaded.", iCount);
    }
    else if (iIndex == OPTION_TIME_STEP_GRAPH)
    {
      m_pTimeStepGraph->SetVisible(!m_pTimeStepGraph->IsVisible());
    }
#if defined(SUPPORTS_MULTITOUCH)
    else if (iIndex == OPTION_MULTITOUCH)
    {
      m_bTouchAreaDebug = !m_bTouchAreaDebug;
    }
#endif
    else if (iIndex == OPTION_SAVE_SCREENSHOT)
    {
      m_bSaveScreenshot = true;

      // We don't want the menu to be visible in the screenshot
      VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
      if (pMainMenu != NULL)
        pMainMenu->SetVisible(false);
    }
  }

  iIndex = GetCallbackIndex(m_debugInfos, pData);
  if (iIndex >= 0)
    Vision::Profiling.ToggleDebugRenderFlags((unsigned int)iIndex);
}