Search in sources :

Example 36 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class ShadowMapResolutionDependentFBOs method propertyChange.

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (renderingConfig.isDynamicShadows()) {
        int shadowMapResFromSettings = (int) evt.getNewValue();
        shadowMapResolution = new FBO.Dimensions(shadowMapResFromSettings, shadowMapResFromSettings);
        for (Map.Entry<SimpleUri, FBOConfig> entry : fboConfigs.entrySet()) {
            SimpleUri fboName = entry.getKey();
            FBOConfig fboConfig = entry.getValue();
            if (fboLookup.containsKey(fboName)) {
                FBO fbo = fboLookup.get(fboName);
                if (fbo != null) {
                    // TODO: validate if necessary
                    fbo.dispose();
                }
            }
            FBO shadowMapResDependentFBO = generateWithDimensions(fboConfig, shadowMapResolution);
            if (shadowMapResDependentFBO.getStatus() == FBO.Status.DISPOSED) {
                logger.warn("Failed to generate ShadowMap FBO. Turning off shadows.");
                renderingConfig.setDynamicShadows(false);
                break;
            }
            fboLookup.put(fboName, shadowMapResDependentFBO);
        }
    }
}
Also used : FBOConfig(org.terasology.rendering.opengl.FBOConfig) FBO(org.terasology.rendering.opengl.FBO) SimpleUri(org.terasology.engine.SimpleUri) Map(java.util.Map)

Example 37 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class WorldRendererImpl method addExposureNodes.

private void addExposureNodes(RenderGraph renderGraph) {
    // TODO: Remove the hard coded value here
    FBOConfig gBuffer2Config = displayResolutionDependentFBOs.getFboConfig(new SimpleUri("engine:fbo.gBuffer2"));
    DownSamplerForExposureNode exposureDownSamplerTo16pixels = new DownSamplerForExposureNode(context, gBuffer2Config, displayResolutionDependentFBOs, FBO_16X16_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo16pixels, "exposureDownSamplerTo16pixels");
    DownSamplerForExposureNode exposureDownSamplerTo8pixels = new DownSamplerForExposureNode(context, FBO_16X16_CONFIG, immutableFBOs, FBO_8X8_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo8pixels, "exposureDownSamplerTo8pixels");
    DownSamplerForExposureNode exposureDownSamplerTo4pixels = new DownSamplerForExposureNode(context, FBO_8X8_CONFIG, immutableFBOs, FBO_4X4_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo4pixels, "exposureDownSamplerTo4pixels");
    DownSamplerForExposureNode exposureDownSamplerTo2pixels = new DownSamplerForExposureNode(context, FBO_4X4_CONFIG, immutableFBOs, FBO_2X2_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo2pixels, "exposureDownSamplerTo2pixels");
    DownSamplerForExposureNode exposureDownSamplerTo1pixel = new DownSamplerForExposureNode(context, FBO_2X2_CONFIG, immutableFBOs, FBO_1X1_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo1pixel, "exposureDownSamplerTo1pixel");
    Node updateExposureNode = new UpdateExposureNode(context);
    renderGraph.addNode(updateExposureNode, "updateExposureNode");
    Node simpleBlendMaterialsNode = renderGraph.findNode("engine:simpleBlendMaterialsNode");
    renderGraph.connect(simpleBlendMaterialsNode, exposureDownSamplerTo16pixels, exposureDownSamplerTo8pixels, exposureDownSamplerTo4pixels, exposureDownSamplerTo2pixels, exposureDownSamplerTo1pixel, updateExposureNode);
}
Also used : FBOConfig(org.terasology.rendering.opengl.FBOConfig) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) DeferredMainLightNode(org.terasology.rendering.dag.nodes.DeferredMainLightNode) PrePostCompositeNode(org.terasology.rendering.dag.nodes.PrePostCompositeNode) ShadowMapNode(org.terasology.rendering.dag.nodes.ShadowMapNode) OutlineNode(org.terasology.rendering.dag.nodes.OutlineNode) InitialPostProcessingNode(org.terasology.rendering.dag.nodes.InitialPostProcessingNode) BlurredAmbientOcclusionNode(org.terasology.rendering.dag.nodes.BlurredAmbientOcclusionNode) OpaqueBlocksNode(org.terasology.rendering.dag.nodes.OpaqueBlocksNode) AmbientOcclusionNode(org.terasology.rendering.dag.nodes.AmbientOcclusionNode) FinalPostProcessingNode(org.terasology.rendering.dag.nodes.FinalPostProcessingNode) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) LightShaftsNode(org.terasology.rendering.dag.nodes.LightShaftsNode) AlphaRejectBlocksNode(org.terasology.rendering.dag.nodes.AlphaRejectBlocksNode) Node(org.terasology.rendering.dag.Node) DeferredPointLightsNode(org.terasology.rendering.dag.nodes.DeferredPointLightsNode) WorldReflectionNode(org.terasology.rendering.dag.nodes.WorldReflectionNode) ToneMappingNode(org.terasology.rendering.dag.nodes.ToneMappingNode) BufferClearingNode(org.terasology.rendering.dag.nodes.BufferClearingNode) HighPassNode(org.terasology.rendering.dag.nodes.HighPassNode) BloomBlurNode(org.terasology.rendering.dag.nodes.BloomBlurNode) OpaqueObjectsNode(org.terasology.rendering.dag.nodes.OpaqueObjectsNode) OutputToHMDNode(org.terasology.rendering.dag.nodes.OutputToHMDNode) LateBlurNode(org.terasology.rendering.dag.nodes.LateBlurNode) ApplyDeferredLightingNode(org.terasology.rendering.dag.nodes.ApplyDeferredLightingNode) BackdropReflectionNode(org.terasology.rendering.dag.nodes.BackdropReflectionNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) HazeNode(org.terasology.rendering.dag.nodes.HazeNode) RefractiveReflectiveBlocksNode(org.terasology.rendering.dag.nodes.RefractiveReflectiveBlocksNode) SimpleBlendMaterialsNode(org.terasology.rendering.dag.nodes.SimpleBlendMaterialsNode) OutputToScreenNode(org.terasology.rendering.dag.nodes.OutputToScreenNode) BackdropNode(org.terasology.rendering.dag.nodes.BackdropNode) OverlaysNode(org.terasology.rendering.dag.nodes.OverlaysNode) SimpleUri(org.terasology.engine.SimpleUri)

Example 38 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class NUIEditorSettingsScreen method initialise.

@Override
public void initialise() {
    WidgetUtil.tryBindCheckbox(this, "disableAutosave", BindHelper.bindBeanProperty("disableAutosave", config.getNuiEditor(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "disableIcons", BindHelper.bindBeanProperty("disableIcons", config.getNuiEditor(), Boolean.TYPE));
    WidgetUtil.trySubscribe(this, "close", button -> getManager().closeScreen(ASSET_URI));
    alternativeLocale = find("alternativeLocale", UIDropdownScrollable.class);
    if (alternativeLocale != null) {
        // Build the list of available locales and set the dropdown's options to them.
        TranslationProject menuProject = translationSystem.getProject(new SimpleUri("engine:menu"));
        List<Locale> locales = new ArrayList<>(menuProject.getAvailableLocales());
        Collections.sort(locales, ((Object o1, Object o2) -> (o1.toString().compareTo(o2.toString()))));
        alternativeLocale.setOptions(Lists.newArrayList(locales));
        alternativeLocale.setVisibleOptions(5);
        alternativeLocale.setOptionRenderer(new LocaleRenderer(translationSystem));
        // If an alternative locale has been previously selected, select it; otherwise select the system locale.
        if (config.getNuiEditor().getAlternativeLocale() != null) {
            alternativeLocale.setSelection(config.getNuiEditor().getAlternativeLocale());
        } else {
            alternativeLocale.setSelection(config.getSystem().getLocale());
        }
    }
}
Also used : Locale(java.util.Locale) LocaleRenderer(org.terasology.rendering.nui.layers.mainMenu.settings.LocaleRenderer) TranslationProject(org.terasology.i18n.TranslationProject) UIDropdownScrollable(org.terasology.rendering.nui.widgets.UIDropdownScrollable) SimpleUri(org.terasology.engine.SimpleUri) ArrayList(java.util.ArrayList)

Example 39 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class NUIManagerInternal method refreshWidgetsLibrary.

public void refreshWidgetsLibrary() {
    widgetsLibrary = new WidgetLibrary(context);
    ModuleEnvironment environment = context.get(ModuleManager.class).getEnvironment();
    for (Class<? extends UIWidget> type : environment.getSubtypesOf(UIWidget.class)) {
        widgetsLibrary.register(new SimpleUri(environment.getModuleProviding(type), type.getSimpleName()), type);
    }
}
Also used : ModuleEnvironment(org.terasology.module.ModuleEnvironment) SimpleUri(org.terasology.engine.SimpleUri) ModuleManager(org.terasology.engine.module.ModuleManager)

Example 40 with SimpleUri

use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.

the class CreateGameScreen method setDefaultGeneratorOfGameplayModule.

// Sets the default generator of the passed in gameplay module. Make sure it's already selected.
private void setDefaultGeneratorOfGameplayModule(Module module) {
    ModuleConfig moduleConfig = config.getDefaultModSelection();
    // Set the default generator of the selected gameplay module
    SimpleUri defaultWorldGenerator = StandardModuleExtension.getDefaultWorldGenerator(module);
    if (defaultWorldGenerator != null) {
        for (WorldGeneratorInfo worldGenInfo : worldGeneratorManager.getWorldGenerators()) {
            if (worldGenInfo.getUri().equals(defaultWorldGenerator)) {
                config.getWorldGeneration().setDefaultGenerator(worldGenInfo.getUri());
            }
        }
    }
    config.save();
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) ModuleConfig(org.terasology.config.ModuleConfig) WorldGeneratorInfo(org.terasology.world.generator.internal.WorldGeneratorInfo)

Aggregations

SimpleUri (org.terasology.engine.SimpleUri)71 Test (org.junit.Test)18 Map (java.util.Map)10 Name (org.terasology.naming.Name)9 ResourceUrn (org.terasology.assets.ResourceUrn)7 DefaultClassMetadata (org.terasology.reflection.metadata.DefaultClassMetadata)7 Config (org.terasology.config.Config)6 Input (org.terasology.input.Input)6 FBO (org.terasology.rendering.opengl.FBO)6 ModuleManager (org.terasology.engine.module.ModuleManager)5 Command (org.terasology.logic.console.commandSystem.annotations.Command)5 ModuleEnvironment (org.terasology.module.ModuleEnvironment)5 List (java.util.List)4 DependencyResolver (org.terasology.module.DependencyResolver)4 ResolutionResult (org.terasology.module.ResolutionResult)4 UILabel (org.terasology.rendering.nui.widgets.UILabel)4 Lists (com.google.common.collect.Lists)3 IOException (java.io.IOException)3 Type (java.lang.reflect.Type)3 Locale (java.util.Locale)3