예제 #1
0
void IShaderManager::SendLightsInfo()
{
    return;
    IString str;
    //printf("light count %d\n",ILight::m_aLights.Count());
    for (unsigned int i=0; i<m_pShaderList.Count(); i++)
    {
        if (m_pShaderList[i] && m_pShaderList[i]->IsCompiled())
        {
            //m_pShaderList[i]->UseShader();
            int ok = m_pShaderList[i]->SetParameterInt("m_nLightsCount",ILight::m_aLights.Count());
            //printf("Send light count %d\n",ok);
            if (ok)
                for (unsigned int j=0; j<ILight::m_aLights.Count(); j++)
                {
                    //Send color
                    str.Printf("m_v3LightsColor[%d]",j);
                    ok=m_pShaderList[i]->SetParameter3Float(str,ILight::m_aLights[j]->m_cColor);
                    //Send position
                    str.Printf("m_v3LightsPos[%d]",j);
                    ok=m_pShaderList[i]->SetParameter3Float(str,ILight::m_aLights[j]->m_vPosition);
                    //Send radius
                    str.Printf("m_fLightsRadius[%d]",j);
                    ok=m_pShaderList[i]->SetParameterFloat(str,ILight::m_aLights[j]->m_fRadius);
                }
        }
    }
}
예제 #2
0
	IString IProperty::GetString()
	{
		if (m_pVar)
		{
			switch (m_iType)
			{
			case IPT_BOOL:
				return *((bool*)m_pVar)==true?"true":"false";
				break;
			case IPT_INTEGER:
				return IString(*((int*)m_pVar));
				break;
			case IPT_FLOAT:
				return TrimZeroFloat(IString(*((float*)m_pVar)));
				break;
			case IPT_VEC2:
				{
					IString str;
					IVector2D *vect = ((IVector2D*)m_pVar);
					str.Printf("%f;%f",vect->GetU(),vect->GetV());
					return str;
				}
				break;
			case IPT_VEC3:
				{
					IString str;
					IVector3D *vect = ((IVector3D*)m_pVar);
					str.Printf("%f;%f;%f",vect->GetX(),vect->GetY(),vect->GetZ());
					return str;
				}
				break;
			case IPT_COLOR:
				{
					IString str;
					IColor *color = ((IColor*)m_pVar);
					str.Printf("%f;%f;%f;%f",color->GetRed(),color->GetGreen(),color->GetBlue(),color->GetAlpha());
					return str;
				}
				break;
			case IPT_STRING:
			case IPT_LONG_STRING:
				return *((IString*)m_pVar);
				break;
			case IPT_CHOICE:
					return *((int*)m_pVar);
				//return IString(*((int*)m_pVar));
				break;
			case IPT_RESSOURCE_ITX: // Texture
				//if (((ISmartPtr<ITexture>*)m_pVar))
					//return (*(ISmartPtr<ITexture>*)m_pVar)->GetFilename();
				//return "";
				
				//return *((IString*)m_pVar);
				return Core::RelativeToPath(Core::AppPath(),*((IString*)m_pVar));
				break;
			case IPT_RESSOURCE_IMA: // Material
				break;
			case IPT_RESSOURCE_IEM: // Animated mesh
				break;
			}
		}
		return "";
	}