// get handle to Mesh
final Mesh mesh = (Mesh) spatial;
// check if we have a Cull state set or enforced. If one is explicitly set and is not Face.None,
// we'll not do two-pass transparency.
RenderState setState = context.hasEnforcedStates() ? context.getEnforcedState(StateType.Cull)
: null;
if (setState == null) {
setState = mesh.getWorldRenderState(RenderState.StateType.Cull);
}
// Do the described check.
if (setState == null || ((CullState) setState).getCullFace() == Face.None) {
// pull any currently enforced cull or zstate. We'll put them back afterwards
final RenderState oldCullState = context.getEnforcedState(StateType.Cull);
final RenderState oldZState = context.getEnforcedState(StateType.ZBuffer);
// enforce our cull and zstate. The zstate is setup to respect depth, but not write to it.
context.enforceState(_tranparentCull);
context.enforceState(_transparentZBuff);