コード例 #1
0
Light::Light()
{
/*
	setType(D3DLIGHT_POINT);
	setDiffuse(r, g, b, a); 
	setAmbient(0, 0, 0, 0);
	setRange((float)sqrt(FLT_MAX));
	setSpecular(r, g, b, a);
    setAttenuation(1, 0, 0);
*/
	
	SetType(LIGHT_POINT);

	SetDiffuse(1, 1, 1, 1);
	SetSpecular(1, 1, 1, 1);
	SetAmbient(0, 0, 0, 0);

	SetRange((float)sqrt(FLT_MAX));

    SetAttenuation(1, 0, 0);
	SetThetaPhi(1.f, 2.f);
	SetFalloff(1.f);

	SetLocation(0, 0, 0);
	SetDirection(0, 1, 0);
}
コード例 #2
0
ファイル: Sound.cpp プロジェクト: Smurf/sfml-audio
Sound& Sound::operator =(const Sound& right)
{
    // Here we don't use the copy-and-swap idiom, because it would mess up
    // the list of sound instances contained in the buffers

    // Detach the sound instance from the previous buffer (if any)
    if (myBuffer)
    {
        Stop();
        myBuffer->DetachSound(this);
        myBuffer = NULL;
    }

    // Copy the sound attributes
    if (right.myBuffer)
        SetBuffer(*right.myBuffer);
    SetLoop(right.GetLoop());
    SetPitch(right.GetPitch());
    SetVolume(right.GetVolume());
    SetPosition(right.GetPosition());
    SetRelativeToListener(right.IsRelativeToListener());
    SetMinDistance(right.GetMinDistance());
    SetAttenuation(right.GetAttenuation());

    return *this;
}
コード例 #3
0
	SoundEmitter::SoundEmitter(const SoundEmitter& emitter)
	{
		alGenSources(1, &m_source);

		SetAttenuation(emitter.GetAttenuation());
		SetMinDistance(emitter.GetMinDistance());
		SetPitch(emitter.GetPitch());
		// No copy for position or velocity
		SetVolume(emitter.GetVolume());
	}
コード例 #4
0
NzSoundEmitter::NzSoundEmitter(const NzSoundEmitter& emitter)
{
	alGenSources(1, &m_source);

	SetAttenuation(emitter.GetAttenuation());
	SetMinDistance(emitter.GetMinDistance());
	SetPitch(emitter.GetPitch());
	// Pas de copie de position ou de vitesse
	SetVolume(emitter.GetVolume());
}
コード例 #5
0
ファイル: GLDirectionalLight.cpp プロジェクト: nutti/MAPIL
	// Create.
	MapilVoid GLDirectionalLight::Create(	const ColorARGB < MapilFloat32 >& colorDiffuse,
											const ColorARGB < MapilFloat32 >& colorAmbient,
											const ColorARGB < MapilFloat32 >& colorSpecular,
											const Vector3 < MapilFloat32 >& vDir,
											MapilFloat32 attenuation0, MapilFloat32 attenuation1, MapilFloat32 attenuation2 )
	{
		SetDiffuseColor( colorDiffuse );
		SetAmbientColor( colorAmbient );
		SetSpecularColor( colorSpecular );
		SetDirection( vDir );
		SetAttenuation( attenuation0, attenuation1, attenuation2 );
	}
コード例 #6
0
void DeferredLight::UpdateFromParent()
{
    // TODO : Don't do this unless something changed
    SetAttenuation(mParentLight->getAttenuationConstant(), mParentLight->getAttenuationLinear(),
                    mParentLight->getAttenuationQuadric());
    SetSpecularColour(mParentLight->getSpecularColour());

    if (getCastChadows())
    {
        ENABLE_BIT(mPermutation, LightMaterialGenerator::MI_SHADOW_CASTER);
    }
    else
    {
        DISABLE_BIT(mPermutation, LightMaterialGenerator::MI_SHADOW_CASTER);
    }
}
コード例 #7
0
ファイル: PointLight.cpp プロジェクト: latuya23/rt
PointLight::PointLight(vec3 pos, Color c, vec3 dir)
	: Light("point light", pos, c, dir,false)
{
	SetAttenuation(1.0,0.0,0.0);//sets default attenuation to 1,0,0
}
コード例 #8
0
ファイル: PointLight.cpp プロジェクト: latuya23/rt
PointLight::PointLight()
	: Light("point light", vec3(0,0,0) ,Color(0.0,0.0,0.0), vec3(0,0,0),false)
{
	SetAttenuation(1.0, 0.0, 0.0);//sets default attenuation to 1,0,0
}
コード例 #9
0
ファイル: PointLight.cpp プロジェクト: latuya23/rt
PointLight::PointLight(vec3 pos, Color c, vec3 dir, double kc, double kl, double kq)
	: Light("Point light", pos, c, dir, false)
{
	SetAttenuation(kc,kl,kq);
}
コード例 #10
0
ファイル: pointlight.cpp プロジェクト: haschmitt/iV-ART
VART::PointLight::PointLight(Point4D loc, float constantAtt, float linearAtt, float quadraticAtt){
    SetLocation(loc);
	SetAttenuation(constantAtt, linearAtt, quadraticAtt);
}
コード例 #11
0
ファイル: PointLight.cpp プロジェクト: latuya23/rt2
PointLight::PointLight(glm::dvec3 pos, Color c, glm::dvec3 dir)
	: Light(pos, c, dir)
{
	SetAttenuation(1.0,0.0,0.0);//sets default attenuation to 1,0,0
	m_lightType = Light::POINT_LIGHT;
}
コード例 #12
0
ファイル: Music.cpp プロジェクト: freemaul/SFML
////////////////////////////////////////////////////////////
/// Set the attenuation factor - the higher the attenuation, the
/// more the sound will be attenuated with distance from listener.
/// The default attenuation factor 1.0
////////////////////////////////////////////////////////////
void sfMusic_SetAttenuation(sfMusic* Music, float Attenuation)
{
    CSFML_CALL(Music, SetAttenuation(Attenuation));
}