Пример #1
0
        void HandleVector4ShaderProperty(PropertySheet propertySheet, Vector4ShaderProperty vector4Property)
        {
            var vector4PropertyDrawer = new Vector4PropertyDrawer();

            vector4PropertyDrawer.preValueChangeCallback  = () => this._preChangeValueCallback("Change property value");
            vector4PropertyDrawer.postValueChangeCallback = () => this._postChangeValueCallback();

            propertySheet.Add(vector4PropertyDrawer.CreateGUI(
                                  newValue => _changeValueCallback(newValue),
                                  vector4Property.value,
                                  "Default",
                                  out var propertyVec4Field));
        }
Пример #2
0
        void HandleMatrix4Property(
            ValueChangedCallback valueChangedCallback,
            PropertySheet propertySheet,
            Matrix4x4 matrix4Property,
            string labelName = "Default")
        {
            var vector4PropertyDrawer = new Vector4PropertyDrawer();

            vector4PropertyDrawer.preValueChangeCallback  = PreValueChangeCallback;
            vector4PropertyDrawer.postValueChangeCallback = PostValueChangeCallback;

            propertySheet.Add(vector4PropertyDrawer.CreateGUI(
                                  newValue =>
            {
                Vector4 row1 = MatrixRowFetchCallback(1);
                Vector4 row2 = MatrixRowFetchCallback(2);
                Vector4 row3 = MatrixRowFetchCallback(3);
                valueChangedCallback(new Matrix4x4()
                {
                    m00 = newValue.x,
                    m01 = newValue.y,
                    m02 = newValue.z,
                    m03 = newValue.w,
                    m10 = row1.x,
                    m11 = row1.y,
                    m12 = row1.z,
                    m13 = row1.w,
                    m20 = row2.x,
                    m21 = row2.y,
                    m22 = row2.z,
                    m23 = row2.w,
                    m30 = row3.x,
                    m31 = row3.y,
                    m32 = row3.z,
                    m33 = row3.w,
                });
            },
                                  matrix4Property.GetRow(0),
                                  labelName,
                                  out var row0Field
                                  ));

            propertySheet.Add(vector4PropertyDrawer.CreateGUI(
                                  newValue =>
            {
                Vector4 row0 = MatrixRowFetchCallback(0);
                Vector4 row2 = MatrixRowFetchCallback(2);
                Vector4 row3 = MatrixRowFetchCallback(3);
                valueChangedCallback(new Matrix4x4()
                {
                    m00 = row0.x,
                    m01 = row0.y,
                    m02 = row0.z,
                    m03 = row0.w,
                    m10 = newValue.x,
                    m11 = newValue.y,
                    m12 = newValue.z,
                    m13 = newValue.w,
                    m20 = row2.x,
                    m21 = row2.y,
                    m22 = row2.z,
                    m23 = row2.w,
                    m30 = row3.x,
                    m31 = row3.y,
                    m32 = row3.z,
                    m33 = row3.w,
                });
            },
                                  matrix4Property.GetRow(1),
                                  "",
                                  out var row1Field
                                  ));

            propertySheet.Add(vector4PropertyDrawer.CreateGUI(
                                  newValue =>
            {
                Vector4 row0 = MatrixRowFetchCallback(0);
                Vector4 row1 = MatrixRowFetchCallback(1);
                Vector4 row3 = MatrixRowFetchCallback(3);
                valueChangedCallback(new Matrix4x4()
                {
                    m00 = row0.x,
                    m01 = row0.y,
                    m02 = row0.z,
                    m03 = row0.w,
                    m10 = row1.x,
                    m11 = row1.y,
                    m12 = row1.z,
                    m13 = row1.w,
                    m20 = newValue.x,
                    m21 = newValue.y,
                    m22 = newValue.z,
                    m23 = newValue.w,
                    m30 = row3.x,
                    m31 = row3.y,
                    m32 = row3.z,
                    m33 = row3.w,
                });
            },
                                  matrix4Property.GetRow(2),
                                  "",
                                  out var row2Field));

            propertySheet.Add(vector4PropertyDrawer.CreateGUI(
                                  newValue =>
            {
                Vector4 row0 = MatrixRowFetchCallback(0);
                Vector4 row1 = MatrixRowFetchCallback(1);
                Vector4 row2 = MatrixRowFetchCallback(2);
                valueChangedCallback(new Matrix4x4()
                {
                    m00 = row0.x,
                    m01 = row0.y,
                    m02 = row0.z,
                    m03 = row0.w,
                    m10 = row1.x,
                    m11 = row1.y,
                    m12 = row1.z,
                    m13 = row1.w,
                    m20 = row2.x,
                    m21 = row2.y,
                    m22 = row2.z,
                    m23 = row2.w,
                    m30 = newValue.x,
                    m31 = newValue.y,
                    m32 = newValue.z,
                    m33 = newValue.w,
                });
            },
                                  matrix4Property.GetRow(3),
                                  "",
                                  out var row3Field
                                  ));
        }