当前位置: 首页>>代码示例>>C#>>正文


C# Matrix4x4.SetRow方法代码示例

本文整理汇总了C#中UnityEngine.Matrix4x4.SetRow方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix4x4.SetRow方法的具体用法?C# Matrix4x4.SetRow怎么用?C# Matrix4x4.SetRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Matrix4x4的用法示例。


在下文中一共展示了Matrix4x4.SetRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Matrix4x4Field

 static void Matrix4x4Field(string label, ref Matrix4x4 mat)
 {
     GUILayout.Label(label);
     mat.SetRow(0, EditorGUILayout.Vector4Field("0", mat.GetRow(0)));
     mat.SetRow(1, EditorGUILayout.Vector4Field("1", mat.GetRow(1)));
     mat.SetRow(2, EditorGUILayout.Vector4Field("2", mat.GetRow(2)));
     mat.SetRow(3, EditorGUILayout.Vector4Field("3", mat.GetRow(3)));
 }
开发者ID:k-lock,项目名称:Unity3D,代码行数:8,代码来源:MeshViewer.cs

示例2: DrawRows

 public static Matrix4x4 DrawRows( Matrix4x4 matrix )
 {
     matrix.SetRow( 0, EditorGUI.Vector4Field( GetRekt(), "", matrix.GetRow( 0 ) ) );
     matrix.SetRow( 1, EditorGUI.Vector4Field( GetRekt(), "", matrix.GetRow( 1 ) ) );
     matrix.SetRow( 2, EditorGUI.Vector4Field( GetRekt(), "", matrix.GetRow( 2 ) ) );
     matrix.SetRow( 3, EditorGUI.Vector4Field( GetRekt(), "", matrix.GetRow( 3 ) ) );
     return matrix;
 }
开发者ID:Thundernerd,项目名称:Unity3D-ExtendedEvent,代码行数:8,代码来源:MatrixWizard.cs

示例3: Frustum

 private Matrix4x4 Frustum(float left, float right, float bottom, float top, float zNear, float zFar)
 {
     Matrix4x4 m = new Matrix4x4();
     m.SetRow(0, new Vector4(2.0f * zNear / (right - left), 0.0f,                          (right + left) / (right - left) , 0.0f));
     m.SetRow(1, new Vector4(0.0f,                          2.0f * zNear / (top - bottom), (top + bottom) / (top - bottom) , 0.0f));
     m.SetRow(2, new Vector4(0.0f,                          0.0f,                          -(zFar + zNear) / (zFar - zNear), -(2 * zFar * zNear) / (zFar - zNear)));
     m.SetRow(3, new Vector4(0.0f,                          0.0f,                          -1.0f,                            0.0f));
     return m;
 }
开发者ID:techierajan,项目名称:FirstLight,代码行数:9,代码来源:TangoARScreen.cs

示例4: xrotate

	Matrix4x4 xrotate (Matrix4x4 mat, float rsin, float rcos) {
		Matrix4x4 rotmat = new Matrix4x4 ();
		rotmat.SetRow (0, new Vector4 (1, 0, 0, 0));
		rotmat.SetRow (1, new Vector4 (0, rcos, -rsin, 0));
		rotmat.SetRow (2, new Vector4 (0, rsin, rcos, 0));
		rotmat.SetRow (3, new Vector4 (0, 0, 0, 1));

		return rotmat * mat;
	}
开发者ID:FourSwordKirby,项目名称:Blitz,代码行数:9,代码来源:HueRotation.cs

示例5: ToUnityMatrix

        public static Matrix4x4 ToUnityMatrix(this Assimp.Matrix4x4 matrix)
        {
            Matrix4x4 unityMatrix = new Matrix4x4();

            unityMatrix.SetRow(0, new Vector4(matrix.A1, matrix.A2, matrix.A3, matrix.A4));
            unityMatrix.SetRow(1, new Vector4(matrix.B1, matrix.B2, matrix.B3, matrix.B4));
            unityMatrix.SetRow(2, new Vector4(matrix.C1, matrix.C2, matrix.C3, matrix.C4));
            unityMatrix.SetRow(3, new Vector4(matrix.D1, matrix.D2, matrix.D3, matrix.D4));

            return unityMatrix;
        }
开发者ID:MugenAttack,项目名称:WindomSVPartAndAnimationEditor,代码行数:11,代码来源:Extentions.cs

示例6: OnWizardCreate

 void OnWizardCreate()
 {
     Texture2D tmpTexture = normalMap;
     Matrix4x4 mat = new Matrix4x4();
     mat.SetRow(0, fromBasis[0]);
     mat.SetRow(1, fromBasis[1]);
     mat.SetRow(2, fromBasis[2]);
     TexturesSpaceConversions.ConvertTangentBasis(mat, ref tmpTexture);
     string path = Application.dataPath + "/Converted SSBump Maps";
     FileSystemUtilities.CreateDirectory(path);
     FileSystemUtilities.SavePNG(ref tmpTexture, path + "/" + normalMap.name + "_SSBump.png");
 }
开发者ID:Geenz,项目名称:Gz-Unity-Tools,代码行数:12,代码来源:NormalToSSBump.cs

示例7: RGBtoCIELAB

    public static Vector3 RGBtoCIELAB( Color color )
    {
        // a crude (s)rgb -> xyz -> l*a*b* transform
        Matrix4x4 xyzmat = new Matrix4x4();

        xyzmat.SetRow( 0, new Vector4(  0.412453f,  0.357580f,  0.180423f, 0.0f ) );
        xyzmat.SetRow( 1, new Vector4(  0.212671f,  0.715160f,  0.072169f, 0.0f ) );
        xyzmat.SetRow( 2, new Vector4(  0.019334f,  0.119193f,  0.950227f, 0.0f ) );
        xyzmat.SetRow( 3, new Vector4(  0.0f,       0.0f,       0.0f,      1.0f ) );

        Vector3 rgb = new Vector3( color.r, color.g, color.b );
        Vector3 xyz = xyzmat.MultiplyPoint3x4( rgb );

        float epsilon = 0.008856f;
        Vector3 white = new Vector3( 95.047f, 100.0f, 108.883f );  // D65 white point in XYZ

        float L, a, b;

        if( (xyz.y / white.y) > epsilon ) {
            L = 116.0f * Mathf.Pow( (xyz.y / white.y), 1.0f/3.0f ) - 16.0f;
        } else {
            L = 903.3f * xyz.y / white.y;
        }

        Vector3 xyz_fact = new Vector3();

        if( (xyz.x / white.x) > epsilon ) {
            xyz_fact.x = Mathf.Pow( (xyz.x / white.x), 1.0f/3.0f );
        } else {
            xyz_fact.x = 7.787f * (xyz.x / white.x) + 16.0f / 116.0f;
        }

        if( (xyz.y / white.y) > epsilon ) {
            xyz_fact.y = Mathf.Pow( (xyz.y / white.y), 1.0f/3.0f );
        } else {
            xyz_fact.y = 7.787f * (xyz.y / white.y) + 16.0f / 116.0f;
        }

        if( (xyz.z / white.z) > epsilon ) {
            xyz_fact.z = Mathf.Pow( (xyz.z / white.z), 1.0f/3.0f );
        } else {
            xyz_fact.z = 7.787f * (xyz.z / white.z) + 16.0f / 116.0f;
        }

        a = 500.0f * (xyz_fact.x - xyz_fact.y);
        b = 200.0f * (xyz_fact.y - xyz_fact.z);

        return new Vector3( L, a, b );
    }
开发者ID:JuhaKiili,项目名称:Fupixel,代码行数:49,代码来源:PaletteFupixel.cs

示例8: GetCameraTransform

    public static void GetCameraTransform(out Vector3 position, out Quaternion orientation)
    {
        ARUNBridge.ARUNGLMatrix matrix = ARUNBridge.CurrentARResult.CameraMatrix;

        //	Convert to matrix type so we can multiply.
        Matrix4x4 cameraTransform = new Matrix4x4();
        cameraTransform.SetRow(0, new Vector4(matrix.m11, matrix.m12, matrix.m13, matrix.m14));
        cameraTransform.SetRow(1, new Vector4(matrix.m21, matrix.m22, matrix.m23, matrix.m24));
        cameraTransform.SetRow(2, new Vector4(matrix.m31, matrix.m32, matrix.m33, matrix.m34));
        cameraTransform.SetRow(3, new Vector4(matrix.m41, matrix.m42, matrix.m43, matrix.m44));
        cameraTransform = SpheroToUnityTransform * cameraTransform;

        orientation = MatrixToQuaternion(ref cameraTransform);
        position = Translation(ref cameraTransform);
    }
开发者ID:nikhilJain17,项目名称:Sphero-AR-SDK,代码行数:15,代码来源:VisionUtils.cs

示例9: OnRenderImage

		protected override void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			Material.SetVector("_Center", new Vector2(Center.x * (float)source.width, Center.y * (float)source.height));
			Material.SetVector("_Params", new Vector3(Scale, DotSize, Smoothness));

			// Precompute rotation matrices
			Matrix4x4 m = new Matrix4x4();
			m.SetRow(0, CMYKRot(Angle + 0.261799388f)); // C
			m.SetRow(1, CMYKRot(Angle + 1.30899694f));  // M
			m.SetRow(2, CMYKRot(Angle));                // Y
			m.SetRow(3, CMYKRot(Angle + 0.785398163f)); // K
			Material.SetMatrix("_MatRot", m);

			Graphics.Blit(source, destination, Material, Desaturate ? 1 : 0);
		}
开发者ID:pryd0008,项目名称:GGJ2016,代码行数:15,代码来源:Halftone.cs

示例10: OnWizardCreate

 void OnWizardCreate()
 {
     Texture2D tmpTexture = SSBumpMap;
     Matrix4x4 mat = new Matrix4x4();
     mat.SetRow(0, basis[0]);
     mat.SetRow(1, basis[1]);
     mat.SetRow(2, basis[2]);
     Matrix4x4 convMat = new Matrix4x4();
     convMat.SetRow(0, (mat.MultiplyVector(new Vector3(1, 0, 0))));
     convMat.SetRow(1, (mat.MultiplyVector(new Vector3(0, 1, 0))));
     convMat.SetRow(2, (mat.MultiplyVector(new Vector3(0, 0, 1))));
     TexturesSpaceConversions.ConvertTangentBasis(convMat, ref tmpTexture, recomputeZ);
     string path = Application.dataPath + "/Converted Normal Maps";
     FileSystemUtilities.CreateDirectory(path);
     FileSystemUtilities.SavePNG(ref tmpTexture, path + "/" + SSBumpMap.name + "_normal.png");
 }
开发者ID:Geenz,项目名称:Gz-Unity-Tools,代码行数:16,代码来源:SSBumpWizard.cs

示例11: OnPreCull

        internal void OnPreCull()
        {
            if (HighLogic.LoadedScene != GameScenes.MAINMENU)
            {
                Matrix4x4 bodies = new Matrix4x4();
                int i = 0;
                foreach (CelestialBody cb in shadowList)
                {
                    bodies.SetRow(i, cb.transform.position);
                    bodies[i, 3] = (float)(cb.Radius);
                    i++;
                    if (i == 4)
                        break;
                }
                if (shadowMat != null)
                {
                    shadowMat.SetVector(ShaderProperties._SunPos_PROPERTY, Sun.Instance.sun.transform.position);
                    shadowMat.SetMatrix(ShaderProperties._ShadowBodies_PROPERTY, bodies);
                }

                foreach (Transform child in body.transform)
                {
                    Renderer cr = child.GetComponent<Renderer>();
                    if (cr != null)
                    {
                        cr.sharedMaterial.SetFloat(ShaderProperties._SunRadius_PROPERTY, (float)(Sun.Instance.sun.Radius));
                        cr.sharedMaterial.SetVector(ShaderProperties._SunPos_PROPERTY, Sun.Instance.sun.transform.position);
                        cr.sharedMaterial.SetMatrix(ShaderProperties._ShadowBodies_PROPERTY, bodies);
                    }
                }
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:EnvironmentalVisualEnhancements,代码行数:32,代码来源:ShadowObject.cs

示例12: FixedUpdate

 // Calcula a diferenca em relacao ao eixo Z
 void FixedUpdate()
 {
     Vector4 norte = Vector3.forward;
     Vector4 localu = -this.transform.right;
     Vector4 localv = this.transform.up;
     Vector4 localw = this.transform.forward;
     Matrix4x4 baseOrto = new Matrix4x4 ();
     baseOrto.SetRow (0, localu);
     baseOrto.SetRow (1, localv);
     baseOrto.SetRow (2, localw);
     baseOrto = baseOrto.transpose;
     norte = baseOrto*norte;
     anguloNorte = 180*Mathf.Atan2 (norte.x, norte.z)/Mathf.PI;
     Vector3 agv = agulha.localEulerAngles;
     agv.y = -anguloNorte;
     agulha.localEulerAngles = agv;
 }
开发者ID:ClaudioMota,项目名称:SimuladorRoboUnity,代码行数:18,代码来源:SensorBussola.cs

示例13: CalculateProjectionMatrix

 static Matrix4x4 CalculateProjectionMatrix(
     float left, float right, float bottom, float top,
     float near, float far)
 {
     var x = 2 * near / (right - left);
     var y = 2 * near / (top - bottom);
     var a = (right + left) / (right - left);
     var b = (top + bottom) / (top - bottom);
     var c = (far + near) / (near - far);
     var d = (2 * far * near) / (near - far);
     var e = -1.0f;
     var m = new Matrix4x4();
     m.SetRow(0, new Vector4(x, 0, a, 0));
     m.SetRow(1, new Vector4(0, y, b, 0));
     m.SetRow(2, new Vector4(0, 0, c, d));
     m.SetRow(3, new Vector4(0, 0, e, 0));
     return m;
 }
开发者ID:keijiro,项目名称:MiragePrototype,代码行数:18,代码来源:OffCenterProjection.cs

示例14: InCircle

 // InCircle(p1,p2,p3,p4) determines if point p4 lies inside of the circumcircle of points p1, p2 and p3,
 // where it is assumed that the points p1, p2 and p3 are in counterclockwise order.
 public static bool InCircle(Vector3 p1,Vector3 p2,Vector3 p3,Vector3 p4)
 {
     Matrix4x4 m = new Matrix4x4();
     Vector3[] a = new Vector3[]{
         p1,p2,p3,p4
     };
     for (int i=0;i<4;i++){
         m.SetRow(i, new Vector4(a[i].x,a[i].y,a[i].x*a[i].x+a[i].y*a[i].y,1));
     }
     return m.determinant<0;
 }
开发者ID:mortennobel,项目名称:UnityUtils,代码行数:13,代码来源:HMeshMath.cs

示例15: OnRenderImage

		// Postprocess the image
		void OnRenderImage (RenderTexture source, RenderTexture destination)
		{
			stage += 0.02f;
			if (intensity == 0)
			{
				Graphics.Blit (source, destination);
				return;
			}
			float s1 =(Mathf.Sin(stage)+1.0f)/2.0f;
			float c1 = (Mathf.Cos (stage)+1.0f)/2.0f;
			float s2 =(Mathf.Sin(stage*1.3f+Mathf.PI)+1.0f)/2.0f;
			float c2 = (Mathf.Cos (stage*1.3f+Mathf.PI)+1.0f)/2.0f;
			material.SetFloat("_stage", intensity);
			Matrix4x4 colorMatrix= new Matrix4x4();
			colorMatrix.SetRow (0, new Vector4 (s1,c1,s2,0));
			colorMatrix.SetRow (1, new Vector4 (c2,c1,s1,0));
			colorMatrix.SetRow (2, new Vector4 (c2,s1,c1,0));
			colorMatrix.SetRow (3, new Vector4 (0,0,0,1));
			Debug.Log(colorMatrix.ToString ());
			material.SetMatrix ("_mymatrix", colorMatrix);
			Graphics.Blit (source, destination, material);
		}
开发者ID:VeryOriginalTeam,项目名称:OldGodsTheForest,代码行数:23,代码来源:trippyColorsEffect.cs


注:本文中的UnityEngine.Matrix4x4.SetRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。