Inheritance: UnityEngine.MonoBehaviour
コード例 #1
0
ファイル: TressFX.cs プロジェクト: sokolman/TressFXUnity
		/// <summary>
		/// Start this instance.
		/// Initializes all buffers and other resources needed by tressfx simulation and rendering.
		/// </summary>
		public void Start()
		{
			if (this.hairData == null)
			{
				Debug.LogError("No hair data assigned to TressFX :(");
			}

			// Vertex buffers
			this.g_HairVertexPositions = this.InitializeBuffer (this.hairData.m_pVertices, 16);
			this.g_HairVertexPositionsPrev = this.InitializeBuffer (this.hairData.m_pVertices, 16);
			this.g_InitialHairPositions = this.InitializeBuffer (this.hairData.m_pVertices, 16);

			// Tangents and rotations
			this.g_HairVertexTangents = this.InitializeBuffer (this.hairData.m_pTangents, 16);
			this.g_GlobalRotations = this.InitializeBuffer (this.hairData.m_pGlobalRotations, 16);
			this.g_LocalRotations = this.InitializeBuffer (this.hairData.m_pLocalRotations, 16);

			// Others
			this.g_HairRestLengthSRV = this.InitializeBuffer (this.hairData.m_pRestLengths, 4);
			this.g_HairStrandType = this.InitializeBuffer (this.hairData.m_pHairStrandType, 4);
			this.g_HairRefVecsInLocalFrame = this.InitializeBuffer (this.hairData.m_pRefVectors, 16);
			this.g_FollowHairRootOffset = this.InitializeBuffer (this.hairData.m_pFollowRootOffset, 16);
			this.g_HairThicknessCoeffs = this.InitializeBuffer (this.hairData.m_pThicknessCoeffs, 4);
			this.g_TexCoords = this.InitializeBuffer(this.hairData.m_TexCoords, 16);

			// Get other parts
			this.simulation = this.GetComponent<TressFXSimulation> ();
		}
コード例 #2
0
        /// <summary>
        /// Start this instance.
        /// Initializes all buffers and other resources needed by tressfx simulation and rendering.
        /// </summary>
        public void Start()
        {
            if (this.hairData == null)
            {
                Debug.LogError("No hair data assigned to TressFX :(");
            }

            // Vertex buffers
            this.g_HairVertexPositions     = this.InitializeBuffer(this.hairData.m_pVertices, 16);
            this.g_HairVertexPositionsPrev = this.InitializeBuffer(this.hairData.m_pVertices, 16);
            this.g_InitialHairPositions    = this.InitializeBuffer(this.hairData.m_pVertices, 16);

            // Tangents and rotations
            this.g_HairVertexTangents = this.InitializeBuffer(this.hairData.m_pTangents, 16);
            this.g_GlobalRotations    = this.InitializeBuffer(this.hairData.m_pGlobalRotations, 16);
            this.g_LocalRotations     = this.InitializeBuffer(this.hairData.m_pLocalRotations, 16);

            // Others
            this.g_HairRestLengthSRV       = this.InitializeBuffer(this.hairData.m_pRestLengths, 4);
            this.g_HairStrandType          = this.InitializeBuffer(this.hairData.m_pHairStrandType, 4);
            this.g_HairRefVecsInLocalFrame = this.InitializeBuffer(this.hairData.m_pRefVectors, 16);
            this.g_FollowHairRootOffset    = this.InitializeBuffer(this.hairData.m_pFollowRootOffset, 16);
            this.g_HairThicknessCoeffs     = this.InitializeBuffer(this.hairData.m_pThicknessCoeffs, 4);
            this.g_TexCoords = this.InitializeBuffer(this.hairData.m_TexCoords, 16);

            // Get other parts
            this.simulation = this.GetComponent <TressFXSimulation> ();
        }