1- import { Component , ReactNode } from "react" ;
1+ import { ReactNode } from "react" ;
22
33import { StandardMaterial , AbstractMesh } from "babylonjs" ;
44
@@ -9,67 +9,86 @@ import { EditorInspectorNumberField } from "../fields/number";
99import { EditorInspectorTextureField } from "../fields/texture" ;
1010import { EditorInspectorSectionField } from "../fields/section" ;
1111
12- import { EditorMaterialInspectorUtilsComponent } from "./utils" ;
12+ import { EditorAlphaModeField } from "./components/alpha" ;
13+ import { EditorTransparencyModeField } from "./components/transparency" ;
14+ import { EditorMaterialInspectorUtilsComponent } from "./components/utils" ;
1315
1416export interface IEditorStandardMaterialInspectorProps {
1517 mesh ?: AbstractMesh ;
1618 material : StandardMaterial ;
1719}
1820
19- export class EditorStandardMaterialInspector extends Component < IEditorStandardMaterialInspectorProps > {
20- public constructor ( props : IEditorStandardMaterialInspectorProps ) {
21- super ( props ) ;
22- }
23-
24- public render ( ) : ReactNode {
25- return (
26- < >
27- < EditorInspectorSectionField title = "Material" label = { this . props . material . getClassName ( ) } >
28- < EditorInspectorStringField label = "Name" object = { this . props . material } property = "name" />
29- < EditorInspectorSwitchField label = "Back Face Culling" object = { this . props . material } property = "backFaceCulling" />
30-
31- < EditorMaterialInspectorUtilsComponent mesh = { this . props . mesh } material = { this . props . material } />
32- </ EditorInspectorSectionField >
33-
34- < EditorInspectorSectionField title = "Material Textures" >
35- < EditorInspectorTextureField object = { this . props . material } title = "Diffuse Texture" property = "diffuseTexture" onChange = { ( ) => this . forceUpdate ( ) } >
36- < EditorInspectorSwitchField label = "Use Alpha" object = { this . props . material } property = "useAlphaFromDiffuseTexture" />
37- </ EditorInspectorTextureField >
38-
39- < EditorInspectorTextureField object = { this . props . material } title = "Bump Texture" property = "bumpTexture" onChange = { ( ) => this . forceUpdate ( ) } >
40- < EditorInspectorSwitchField label = "Invert X" object = { this . props . material } property = "invertNormalMapX" />
41- < EditorInspectorSwitchField label = "Invert Y" object = { this . props . material } property = "invertNormalMapY" />
42- < EditorInspectorSwitchField label = "Use Parallax" object = { this . props . material } property = "useParallax" onChange = { ( ) => this . forceUpdate ( ) } />
43-
44- { this . props . material . useParallax && (
45- < >
46- < EditorInspectorSwitchField label = "Use Parallax Occlusion" object = { this . props . material } property = "useParallaxOcclusion" />
47- < EditorInspectorNumberField label = "Parallax Scale Bias" object = { this . props . material } property = "parallaxScaleBias" />
48- </ >
49- ) }
50- </ EditorInspectorTextureField >
51-
52- < EditorInspectorTextureField object = { this . props . material } title = "Specular Texture" property = "specularTexture" />
53- < EditorInspectorTextureField object = { this . props . material } title = "Ambient Texture" property = "ambientTexture" />
54- < EditorInspectorTextureField object = { this . props . material } title = "Opacity Texture" property = "opacityTexture" />
55- < EditorInspectorTextureField object = { this . props . material } title = "Emissive Texture" property = "emissiveTexture" />
56-
57- < EditorInspectorTextureField
58- object = { this . props . material }
59- title = "Reflection Texture"
60- property = "reflectionTexture"
61- acceptCubeTexture
62- onChange = { ( ) => this . forceUpdate ( ) }
63- />
64- </ EditorInspectorSectionField >
65-
66- < EditorInspectorSectionField title = "Material Colors" >
67- < EditorInspectorColorField label = { < div className = "w-14" > Diffuse</ div > } object = { this . props . material } property = "diffuseColor" />
68- < EditorInspectorColorField label = { < div className = "w-14" > Specular</ div > } object = { this . props . material } property = "specularColor" />
69- < EditorInspectorColorField label = { < div className = "w-14" > Ambient</ div > } object = { this . props . material } property = "ambientColor" />
70- < EditorInspectorColorField label = { < div className = "w-14" > Emissive</ div > } object = { this . props . material } property = "emissiveColor" />
71- </ EditorInspectorSectionField >
72- </ >
73- ) ;
74- }
21+ export function EditorStandardMaterialInspector ( props : IEditorStandardMaterialInspectorProps ) : ReactNode {
22+ return (
23+ < >
24+ < EditorInspectorSectionField title = "Material" label = { props . material . getClassName ( ) } >
25+ < EditorInspectorStringField label = "Name" object = { props . material } property = "name" />
26+ < EditorInspectorSwitchField label = "Back Face Culling" object = { props . material } property = "backFaceCulling" />
27+ < EditorInspectorNumberField label = "Alpha" object = { props . material } property = "alpha" min = { 0 } max = { 1 } />
28+
29+ < EditorAlphaModeField object = { props . material } />
30+
31+ < EditorTransparencyModeField object = { props . material } />
32+
33+ < EditorMaterialInspectorUtilsComponent mesh = { props . mesh } material = { props . material } />
34+ </ EditorInspectorSectionField >
35+
36+ < EditorInspectorSectionField title = "Material Textures" >
37+ < EditorInspectorTextureField object = { props . material } title = "Diffuse Texture" property = "diffuseTexture" onChange = { ( ) => { } } >
38+ < EditorInspectorSwitchField label = "Use Alpha" object = { props . material } property = "useAlphaFromDiffuseTexture" />
39+ </ EditorInspectorTextureField >
40+
41+ < EditorInspectorTextureField object = { props . material } title = "Bump Texture" property = "bumpTexture" onChange = { ( ) => { } } >
42+ < EditorInspectorSwitchField label = "Invert X" object = { props . material } property = "invertNormalMapX" />
43+ < EditorInspectorSwitchField label = "Invert Y" object = { props . material } property = "invertNormalMapY" />
44+ < EditorInspectorSwitchField label = "Use Parallax" object = { props . material } property = "useParallax" onChange = { ( ) => { } } />
45+
46+ { props . material . useParallax && (
47+ < >
48+ < EditorInspectorSwitchField label = "Use Parallax Occlusion" object = { props . material } property = "useParallaxOcclusion" />
49+ < EditorInspectorNumberField label = "Parallax Scale Bias" object = { props . material } property = "parallaxScaleBias" />
50+ </ >
51+ ) }
52+ </ EditorInspectorTextureField >
53+
54+ < EditorInspectorTextureField object = { props . material } title = "Specular Texture" property = "specularTexture" />
55+ < EditorInspectorTextureField object = { props . material } title = "Ambient Texture" property = "ambientTexture" onChange = { ( ) => { } } >
56+ { props . material . ambientTexture && (
57+ < >
58+ < EditorInspectorSwitchField label = "Use Gray Scale" object = { props . material } property = "useAmbientInGrayScale" />
59+ < EditorInspectorNumberField label = "Strength" object = { props . material } property = "ambientTextureStrength" min = { 0 } />
60+ </ >
61+ ) }
62+ </ EditorInspectorTextureField >
63+ < EditorInspectorTextureField object = { props . material } title = "Opacity Texture" property = "opacityTexture" />
64+ < EditorInspectorTextureField object = { props . material } title = "Emissive Texture" property = "emissiveTexture" />
65+
66+ < EditorInspectorTextureField object = { props . material } title = "Reflection Texture" property = "reflectionTexture" acceptCubeTexture onChange = { ( ) => { } } />
67+ </ EditorInspectorSectionField >
68+
69+ < EditorInspectorSectionField title = "Material Colors" >
70+ < EditorInspectorColorField label = { < div className = "w-14" > Diffuse</ div > } object = { props . material } property = "diffuseColor" />
71+ < EditorInspectorColorField label = { < div className = "w-14" > Specular</ div > } object = { props . material } property = "specularColor" />
72+ < EditorInspectorColorField label = { < div className = "w-14" > Ambient</ div > } object = { props . material } property = "ambientColor" />
73+ < EditorInspectorColorField label = { < div className = "w-14" > Emissive</ div > } object = { props . material } property = "emissiveColor" />
74+ </ EditorInspectorSectionField >
75+
76+ < EditorInspectorSectionField title = "Specular Properties" >
77+ < EditorInspectorNumberField label = "Specular Power" object = { props . material } property = "specularPower" min = { 0 } />
78+ < EditorInspectorNumberField label = "Direct Intensity" object = { props . material } property = "directIntensity" min = { 0 } />
79+ < EditorInspectorNumberField label = "Environment Intensity" object = { props . material } property = "environmentIntensity" min = { 0 } />
80+ < EditorInspectorNumberField label = "Emissive Intensity" object = { props . material } property = "emissiveIntensity" min = { 0 } />
81+ < EditorInspectorNumberField label = "Specular Intensity" object = { props . material } property = "specularIntensity" min = { 0 } />
82+ </ EditorInspectorSectionField >
83+
84+ < EditorInspectorSectionField title = "Misc" >
85+ < EditorInspectorSwitchField label = "Disable Lighting" object = { props . material } property = "disableLighting" />
86+ < EditorInspectorSwitchField label = "Use Specular Over Alpha" object = { props . material } property = "useSpecularOverAlpha" />
87+ < EditorInspectorSwitchField label = "Separate Culling Pass" object = { props . material } property = "separateCullingPass" />
88+ < EditorInspectorNumberField label = "Z Offset" object = { props . material } property = "zOffset" />
89+ < EditorInspectorNumberField label = "Z Offset Units" object = { props . material } property = "zOffsetUnits" />
90+ < EditorInspectorSwitchField label = "Fog Enabled" object = { props . material } property = "fogEnabled" />
91+ </ EditorInspectorSectionField >
92+ </ >
93+ ) ;
7594}
0 commit comments