本文整理汇总了C#中Matrix4.Inverse方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4.Inverse方法的具体用法?C# Matrix4.Inverse怎么用?C# Matrix4.Inverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4
的用法示例。
在下文中一共展示了Matrix4.Inverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLights
/// ライトの設定
public void SetLights(
ref Matrix4 target, ///< モデルローカルに変換するための、モデルの位置
ref Vector4 eyePos, ///< ワールド上での視点の位置
ref Light[] lights
)
{
if( lights != null ){
Matrix4 invWorld = target.Inverse();
Vector4 localEyePosistion = invWorld * eyePos;
if( idWorldInverse >= 0 ){
this.SetUniformValue( idWorldInverse, ref invWorld );
}
if( idLocalEyePosition >= 0 ){
this.SetUniformValue( idLocalEyePosition, ref localEyePosistion );
}
// ライト : 0
if( lights[ 0 ] != null ){
Vector4 localLightPosition = invWorld * lights[ 0 ].Position;
if( idLocalLightPosition00 >= 0 ){
// Vector4 V = localLightPosition.Normalize();
this.SetUniformValue( idLocalLightPosition00, ref localLightPosition );
}
// 並行光源(トゥーン用)
if( idLocalLightDir >= 0 ){
Vector4 localLightPos = invWorld * lights[ 0 ].Position;
Vector3 localLightDir = new Vector3( -localLightPos.X, -localLightPos.Y, -localLightPos.Z );
localLightDir = localLightDir.Normalize();
this.SetUniformValue( idLocalLightDir, ref localLightDir );
}
if( idKDiffuse00 >= 0 ){
this.SetUniformValue( idKDiffuse00, ref lights[ 0 ].KDiffuse );
}
if( idKSpecular00 >= 0 ){
this.SetUniformValue( idKSpecular00, ref lights[ 0 ].KSpecular );
}
}
// ライト : 1
if( lights[ 1 ] != null ){
if( idLocalLightPosition01 >= 0 ){
Vector4 localLightPosition = invWorld * lights[ 1 ].Position;
this.SetUniformValue( idLocalLightPosition01, ref localLightPosition );
}
if( idKDiffuse01 >= 0 ){
this.SetUniformValue( idKDiffuse01, ref lights[ 1 ].KDiffuse );
}
if( idKSpecular01 >= 0 ){
this.SetUniformValue( idKSpecular01, ref lights[ 1 ].KSpecular );
}
}
// ライト : 2
if( lights[ 2 ] != null ){
if( idLocalLightPosition02 >= 0 ){
Vector4 localLightPosition = invWorld * lights[ 2 ].Position;
this.SetUniformValue( idLocalLightPosition02, ref localLightPosition );
}
if( idKDiffuse02 >= 0 ){
this.SetUniformValue( idKDiffuse02, ref lights[ 2 ].KDiffuse );
}
if( idKSpecular02 >= 0 ){
this.SetUniformValue( idKSpecular02, ref lights[ 2 ].KSpecular );
}
}
}else{
if( idLIGHT_COUNT >= 0 ){
this.SetUniformValue( idLIGHT_COUNT, 0 );
}
}
}