protected virtual void applyAlphaToMaterial(float alpha) { workingAlpha = alpha; alphaQuat.w = alpha; subEntity.setCustomParameter(0, alphaQuat); if (disableOnHidden) { subEntity.setVisible(alpha >= 0.00008f); } if (alpha >= 0.9999f) { subEntity.setMaterialName(baseMaterialName); entity.setRenderQueueGroup(0); } else { subEntity.setMaterialName(finalAlphaMaterialName); entity.setRenderQueueGroup((byte)(95 + renderGroupOffset)); } }
internal override void setAlpha(float alpha) { currentAlpha = alpha; alphaQuat.w = alpha; subEntity.setCustomParameter(0, alphaQuat); if (alpha >= 0.9999f) { if (status != TransparencyStatus.Solid) { status = TransparencyStatus.Solid; subEntity.setMaterialName(baseMaterialName); entity.setRenderQueueGroup(originalRenderGroup); entity.setVisibilityFlags(TransparencyController.OpaqueVisibilityMask); subEntity.setVisible(true); //entity.setMaterialLodBias(1.0f, 0, 0); } } else if (alpha <= 0.00008f) { if (status != TransparencyStatus.Hidden) { status = TransparencyStatus.Hidden; if (disableOnHidden) { subEntity.setVisible(false); } } } else { if (status != TransparencyStatus.Transparent) { status = TransparencyStatus.Transparent; subEntity.setMaterialName(finalAlphaMaterialName); subEntity.setVisible(true); //entity.setMaterialLodBias(1.0f, 1, 1); entity.setRenderQueueGroup(RenderGroupQueue.GetQueue(RenderGroup, (byte)renderGroupOffset)); entity.setVisibilityFlags(TransparencyController.TransparentVisibilityMask); } } }
private void applyAlphaToMaterial(float alpha) { if (allowVisible) { alphaQuat.w = alpha; subEntity.setCustomParameter(0, alphaQuat); if (alpha >= 0.9999f) { if (status != TransparencyStatus.Solid) { status = TransparencyStatus.Solid; subEntity.setMaterialName(baseMaterialName); entity.setRenderQueueGroup(originalRenderGroup); if (usesVirtualTexture) { entity.setVisibilityFlags(TransparencyController.OpaqueVisibilityMask); } subEntity.setVisible(true); if (disableEntireEntity) { entity.setVisible(true); } entity.setMaterialLodBias(1.0f, 0, 0); } } else if (alpha <= 0.00008f) { setHiddenTransparency(); } else { if (status != TransparencyStatus.Transparent) { status = TransparencyStatus.Transparent; subEntity.setMaterialName(finalAlphaMaterialName); subEntity.setVisible(true); if (disableEntireEntity) { entity.setVisible(true); } if (useDepthCheck) { entity.setMaterialLodBias(1.0f, 0, 0); } else { entity.setMaterialLodBias(1.0f, 1, 1); } entity.setRenderQueueGroup(RenderGroupQueue.GetQueue(RenderGroup, (byte)renderGroupOffset)); if (usesVirtualTexture) { entity.setVisibilityFlags(TransparencyController.TransparentVisibilityMask); } } } if (subInterfaces != null) { foreach (TransparencySubInterface subInterface in subInterfaces) { subInterface.setAlpha(alpha); } } } else { setHiddenTransparency(); if (subInterfaces != null) { foreach (TransparencySubInterface subInterface in subInterfaces) { subInterface.setAlpha(alpha); } } } }