Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            if (styles == null)
            {
                styles = new Styles();
            }

            var rts = target as RayTracingShader;

            if (rts == null)
            {
                return;
            }

            serializedObject.Update();

            GUI.enabled = true;

            EditorGUI.indentLevel = 0;

            if (ShowPlatformListSection(rts))
            {
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(m_MaxRecursionDepth, styles.s_MaxRecursionDepthText);

                int rayGenShaderCount = ShaderUtil.GetRayGenerationShaderCount(rts);
                if (rayGenShaderCount > 0)
                {
                    GUILayout.Space(15.0f);
                    GUILayout.Label(styles.s_RayGenShaderNames, styles.s_LabelStyle);

                    string[] rayGenShaderNames = new string[rayGenShaderCount];
                    for (int i = 0; i < rayGenShaderCount; i++)
                    {
                        rayGenShaderNames[i] = ShaderUtil.GetRayGenerationShaderName(rts, i);
                    }

                    ShowRayGenerationShaderList(rayGenShaderNames);
                }

                int missShaderCount = ShaderUtil.GetMissShaderCount(rts);
                if (missShaderCount > 0)
                {
                    GUILayout.Space(15.0f);

                    GUILayout.Label(styles.s_MissShaderNames, styles.s_LabelStyle);

                    string[] missShaderNames       = new string[missShaderCount];
                    int[]    missShaderPayloadSize = new int[missShaderCount];
                    for (int i = 0; i < missShaderCount; i++)
                    {
                        missShaderNames[i]       = ShaderUtil.GetMissShaderName(rts, i);
                        missShaderPayloadSize[i] = ShaderUtil.GetMissShaderRayPayloadSize(rts, i);
                    }

                    ShowMissShaderList(missShaderNames, missShaderPayloadSize);
                }

                int callableShaderCount = ShaderUtil.GetCallableShaderCount(rts);
                if (callableShaderCount > 0)
                {
                    GUILayout.Space(15.0f);

                    GUILayout.Label(styles.s_CallableShaderNames, styles.s_LabelStyle);

                    string[] callableShaderNames      = new string[callableShaderCount];
                    int[]    callableShaderParamsSize = new int[callableShaderCount];
                    for (int i = 0; i < callableShaderCount; i++)
                    {
                        callableShaderNames[i]      = ShaderUtil.GetCallableShaderName(rts, i);
                        callableShaderParamsSize[i] = ShaderUtil.GetCallableShaderParamSize(rts, i);
                    }

                    ShowCallableShaderList(callableShaderNames, callableShaderParamsSize);
                }
            }
            else
            {
                EditorGUILayout.HelpBox(styles.s_NotSupported.text, MessageType.Error);
            }

            ShowShaderErrors(rts);
        }