Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use visibleShadow, get rid of visibleMesh #214

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/iron/Scene.hx
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,8 @@ class Scene {
object.raw = o;
object.name = o.name;
if (o.visible != null) object.visible = o.visible;
if (o.visible_mesh != null) object.visibleMesh = o.visible_mesh;
if (o.visible_shadow != null) object.visibleShadow = o.visible_shadow;

createConstraints(o.constraints, object);
generateTransform(o, object.transform);
object.setupAnimation(oactions);
Expand Down
1 change: 1 addition & 0 deletions Sources/iron/data/SceneFormat.hx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ typedef TObj = {
@:optional public var visible: Null<Bool>;
@:optional public var visible_mesh: Null<Bool>;
@:optional public var visible_shadow: Null<Bool>;
@:optional public var only_shadows: Null<Bool>;
@:optional public var mobile: Null<Bool>;
@:optional public var spawn: Null<Bool>; // Auto add object when creating scene
@:optional public var local_only: Null<Bool>; // Apply parent matrix
Expand Down
7 changes: 4 additions & 3 deletions Sources/iron/object/MeshObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ class MeshObject extends Object {
if (!isLodMaterial() && !validContext(mats, context)) return true;

var isShadow = context == "shadowmap";
if (!visibleMesh && !isShadow) return setCulled(isShadow, true);
if (!visibleShadow && isShadow) return setCulled(isShadow, true);
if (!visible && !isShadow) return setCulled(isShadow, true);
//if (!visibleShadow && isShadow) return setCulled(isShadow, true);

if (skip_context == context) return setCulled(isShadow, true);
if (force_context != null && force_context != context) return setCulled(isShadow, true);
Expand Down Expand Up @@ -230,7 +230,8 @@ class MeshObject extends Object {

public function render(g: Graphics, context: String, bindParams: Array<String>) {
if (data == null || !data.geom.ready) return; // Data not yet streamed
if (!visible) return; // Skip render if object is hidden
if (!visible && !visibleShadow) return; // Skip render if object is hidden
if ((visibleShadow && !visible) && context != "voxel" && context != "shadowmap") return;
if (cullMesh(context, Scene.active.camera, RenderPath.active.light)) return;
var meshContext = raw != null ? context == "mesh" : false;

Expand Down