Skip to content

Commit

Permalink
Better Litght+Material Support
Browse files Browse the repository at this point in the history
  • Loading branch information
MagmaMCNet committed Dec 28, 2023
1 parent 19026c0 commit 1128243
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 6 additions & 2 deletions EQS_Types/EQS_Fields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,13 @@ public class SharedFilterMode : SharedObject<FilterMode> {}

#region Light
[Serializable]
public class SharedLightmapBakeType : SharedObject<LightmapBakeType> {}
public class SharedLightmapBakeType : SharedObject<LightmapBakeType> { }
[Serializable]
public class SharedLightShadows : SharedObject<LightShadows> {}
public class SharedLightShadows: SharedObject<LightShadows> { }
[Serializable]
public class SharedLightRenderMode: SharedObject<LightRenderMode> { }
[Serializable]
public class SharedLightType: SharedObject<LightType> { }
#endregion
}
#endif
9 changes: 9 additions & 0 deletions EQS_Types/Type_Light.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,41 @@ public class Type_Light : Type_Behaviour
[System.NonSerialized]
private Light type;

public SharedLightType LightType = new SharedLightType();
public SharedFloat Range = new SharedFloat();
public SharedColor Color = new SharedColor();
public SharedLightmapBakeType Mode = new SharedLightmapBakeType();
public SharedFloat Intensity = new SharedFloat();
public SharedFloat IndirectMultiplier = new SharedFloat();
public SharedLightShadows ShadowType = new SharedLightShadows();
public SharedLightRenderMode RenderMode = new SharedLightRenderMode();

public override void Setup(Object type)
{
base.Setup(type);
Light component = (Light)type;
LightType.Setup(component.type);
Range.Setup(component.range);
Color.Setup(component.color);
Mode.Setup(component.lightmapBakeType);
Intensity.Setup(component.intensity);
IndirectMultiplier.Setup(component.bounceIntensity);
ShadowType.Setup(component.shadows);
RenderMode.Setup(component.renderMode);
}

public override void Process(Object type, BuildTarget buildTarget)
{
base.Process(type, buildTarget);
Light component = (Light)type;
component.type = LightType.Get(buildTarget);
component.range = Range.Get(buildTarget);
component.color = Color.Get(buildTarget);
component.lightmapBakeType = Mode.Get(buildTarget);
component.intensity = Intensity.Get(buildTarget);
component.bounceIntensity = IndirectMultiplier.Get(buildTarget);
component.shadows = ShadowType.Get(buildTarget);
component.renderMode = RenderMode.Get(buildTarget);
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions EQS_Types/Type_Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ public class Type_Material : Type_Base
private Material type;

public SharedShader Shader = new SharedShader();
public SharedColor MainColor = new SharedColor();
[InspectorName("GPU Instancing")]
public SharedBool GPUInstancing = new SharedBool();
private SharedString ShaderPath = new SharedString();

public override void Setup(Object type)
{
Material material = (Material)type;
Shader.Setup(material.shader);
ShaderPath.Setup(material.shader.name);
MainColor.Setup(material.color);
GPUInstancing.Setup(material.enableInstancing);
}

public override void Process(Object type, BuildTarget buildTarget)
Expand Down Expand Up @@ -54,6 +59,8 @@ public override void Process(Object type, BuildTarget buildTarget)
throw new MissingReferenceException();
}
material.shader = Shader.Get(buildTarget);
material.color = MainColor.Get(buildTarget);
material.enableInstancing = GPUInstancing.Get(buildTarget);
}
}
}
Expand Down

0 comments on commit 1128243

Please sign in to comment.