Example #1
0
Vector3 ETHEntity::GetLightRelativePosition() const
{
	if (HasLightSource())
		return m_properties.light->pos;
	else
		return Vector3(0,0,0);
}
Example #2
0
Vector3 ETHEntity::GetLightColor() const
{
	if (HasLightSource())
		return m_properties.light->color;
	else
		return Vector3(0, 0, 0);
}
Example #3
0
float ETHEntity::GetLightRange() const
{
	if (HasLightSource())
		return m_properties.light->range;
	else
		return 0.0f;
}
Example #4
0
bool ETHRenderEntity::DrawHalo(const float maxHeight, const float minHeight, const bool rotateHalo, const Vector2 &zAxisDirection)
{
	GS2D_UNUSED_ARGUMENT(minHeight);
	GS2D_UNUSED_ARGUMENT(maxHeight);

	if (!GetHalo() || !HasLightSource() || IsHidden())
		return false;

	m_pHalo->SetOrigin(Sprite::EO_CENTER);
	const ETHLight* light = m_properties.light.get();

	const Vector3 v3EntityPos = GetPosition();

	// will remain as 1.0 for a while
	m_provider->GetVideo()->SetSpriteDepth(1.0f/*ETHGlobal::ComputeDepth(m_data.entity.light.pos.z+v3EntityPos.z+ETH_HALO_DEPTH_SHIFT, maxHeight, minHeight)*/);

	// if it has a particle system in the first slot, adjust the light
	// brightness according to the number of active particles
	float brightness = 1.0f;
	const ETHParticleManagerPtr paticleManager = GetParticleManager(0);
	if (paticleManager)
	{
		brightness = static_cast<float>(paticleManager->GetNumActiveParticles())/static_cast<float>(paticleManager->GetNumParticles());
	}

	Vector3 v3HaloPos = light->pos + v3EntityPos;

	Color dwColor = ConvertToDW(light->color * light->haloBrightness * brightness);
	Vector2 v2Size(light->haloSize, light->haloSize);

	m_pHalo->DrawShaped(
		ETHGlobal::ToScreenPos(v3HaloPos, zAxisDirection) + ComputeParallaxOffset(),
		v2Size * m_properties.scale,
		dwColor, dwColor, dwColor, dwColor,
		(rotateHalo) ? ComputeHaloAngle() : 0.0f);
	return true;
}
Example #5
0
bool ETHEntity::HasHalo() const
{
	return (!HasLightSource()) ? false : (!m_properties.light->haloBitmap.empty());
}
Example #6
0
void ETHEntity::SetLightColor(const Vector3 &color)
{
	if (HasLightSource())
		m_properties.light->color = color;
}
Example #7
0
void ETHEntity::SetLightRange(const float range)
{
	if (HasLightSource())
		m_properties.light->range = range;
}