示例#1
0
文件: Shader.cpp 项目: joewan/fury3d
	void Shader::BindCamera(const std::shared_ptr<SceneNode> &camNode)
	{
		Vector4 camPos = camNode->GetWorldPosition();
		if (auto camera = camNode->GetComponent<Camera>())
		{
			BindFloat("camera_pos", camPos.x, camPos.y, camPos.z);
			BindFloat("camera_far", camera->GetFar());
			BindFloat("camera_near", camera->GetNear());
			BindMatrix(Matrix4::INVERT_VIEW_MATRIX, &camNode->GetInvertWorldMatrix().Raw[0]);
			BindMatrix(Matrix4::PROJECTION_MATRIX, &camera->GetProjectionMatrix().Raw[0]);
		}
	}
void SqlConnection::DataCommand::BindFloat(
    SqlConnection::ArgumentIndex position,
    const Optional<float> &value)
{
    if (value.IsNull())
        BindNull(position);
    else
        BindFloat(position, *value);
}
示例#3
0
文件: Shader.cpp 项目: joewan/fury3d
	void Shader::BindLight(const std::shared_ptr<SceneNode> &lightNode)
	{
		Vector4 lightPos = lightNode->GetWorldPosition();
		Vector4 lightDir = lightNode->GetWorldMatrix().Multiply(Vector4(0, -1, 0, 0));
		lightDir.Normalize();
		if (auto light = lightNode->GetComponent<Light>())
		{
			Color color = light->GetColor();
			BindFloat("light_pos", lightPos.x, lightPos.y, lightPos.z);
			BindFloat("light_dir", lightDir.x, lightDir.y, lightDir.z);
			BindFloat("light_color", color.r, color.g, color.b);
			BindFloat("light_intensity", light->GetIntensity());
			BindFloat("light_innerangle", light->GetInnerAngle());
			BindFloat("light_outterangle", light->GetOutterAngle());
			BindFloat("light_falloff", light->GetFalloff());
			BindFloat("light_radius", light->GetRadius());
		}
	}
/** Bind a value to a uniform floatN input-parameter of the fragmentprogram of this pass.
 *  The value of the input-parameter must be given as a float-array of length N.
 *  GLSL only supports float, float2, float3, float4 so N must be 1,2,3 or 4.
 *
 *  @param[in] parameterName the name of the input-parameter in the fragment program
 *  @param[in] floatvector the float-vector (N is derived from the length of this vector)
 *  @exception PPEResourceException thrown if N is not 1,2,3 or 4
 */
void FragmentProgram::BindFloat(string parameterName, vector<float> floatvector) {

    vector<vector<float> > floatvectors;
    floatvectors.push_back(floatvector);
    BindFloat(parameterName, floatvectors);
}