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);
}
}
}
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);
}
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());
}
}
}
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);
}
}
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();
}
Aggregations