Search in sources :

Example 46 with SimpleUri

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

the class DisplayResolutionDependentFbo method generateDefaultFBOs.

private void generateDefaultFBOs() {
    FBO gBuffer1 = generateWithDimensions(new FboConfig(new SimpleUri("engine:fbo.gBuffer1"), FULL_SCALE, FBO.Type.HDR).useDepthBuffer().useNormalBuffer().useLightBuffer().useStencilBuffer(), fullScale);
    FBO gBuffer2 = generateWithDimensions(new FboConfig(new SimpleUri("engine:fbo.gBuffer2"), FULL_SCALE, FBO.Type.HDR).useDepthBuffer().useNormalBuffer().useLightBuffer().useStencilBuffer(), fullScale);
    generateWithDimensions(new FboConfig(FINAL_BUFFER, FULL_SCALE, FBO.Type.DEFAULT), fullScale);
    gBufferPair = new SwappableFBO(gBuffer1, gBuffer2);
}
Also used : FBO(org.terasology.engine.rendering.opengl.FBO) SwappableFBO(org.terasology.engine.rendering.opengl.SwappableFBO) FboConfig(org.terasology.engine.rendering.opengl.FboConfig) SwappableFBO(org.terasology.engine.rendering.opengl.SwappableFBO) SimpleUri(org.terasology.engine.core.SimpleUri)

Example 47 with SimpleUri

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

the class DisplayResolutionDependentFbo method regenerateFbos.

private void regenerateFbos() {
    propertyChangeSupport.firePropertyChange(PRE_FBO_REGENERATION, 0, 1);
    for (SimpleUri urn : fboConfigs.keySet()) {
        FboConfig fboConfig = getFboConfig(urn);
        fboConfig.setDimensions(fullScale.multiplyBy(fboConfig.getScale()));
        FBO.recreate(get(urn), getFboConfig(urn));
    }
    propertyChangeSupport.firePropertyChange(POST_FBO_REGENERATION, 0, 1);
// Note that the "old" and "new" values (0 and 1) in the above calls aren't actually
// used: they are only necessary to ensure that the event is fired up correctly.
}
Also used : FboConfig(org.terasology.engine.rendering.opengl.FboConfig) SimpleUri(org.terasology.engine.core.SimpleUri)

Example 48 with SimpleUri

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

the class DisplayResolutionDependentFbo method request.

@Override
public FBO request(FboConfig fboConfig) {
    FBO fbo;
    SimpleUri fboName = fboConfig.getName();
    if (fboConfigs.containsKey(fboName)) {
        if (!fboConfig.equals(fboConfigs.get(fboName))) {
            throw new IllegalArgumentException("Requested FBO is already available with different configuration");
        }
        fbo = fboLookup.get(fboConfig.getName());
    } else {
        fbo = generateWithDimensions(fboConfig, fullScale.multiplyBy(fboConfig.getScale()));
    }
    retain(fboName);
    return fbo;
}
Also used : FBO(org.terasology.engine.rendering.opengl.FBO) SwappableFBO(org.terasology.engine.rendering.opengl.SwappableFBO) SimpleUri(org.terasology.engine.core.SimpleUri)

Example 49 with SimpleUri

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

the class ShadowMapResolutionDependentFbo method request.

@Override
public FBO request(FboConfig fboConfig) {
    FBO fbo;
    SimpleUri fboName = fboConfig.getName();
    if (fboConfigs.containsKey(fboName)) {
        if (!fboConfig.equals(fboConfigs.get(fboName))) {
            throw new IllegalArgumentException("Requested FBO is already available with different configuration");
        }
        fbo = fboLookup.get(fboConfig.getName());
    } else {
        fbo = generateWithDimensions(fboConfig, shadowMapResolution);
    }
    retain(fboName);
    return fbo;
}
Also used : FBO(org.terasology.engine.rendering.opengl.FBO) SimpleUri(org.terasology.engine.core.SimpleUri)

Example 50 with SimpleUri

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

the class ReflectionUtil method getSimpleUriFor.

/**
 * Returns the {@link SimpleUri} for a type belonging to the {@link ModuleEnvironment}.
 * If the type does not belong to the module environment, null is returned.
 */
public static SimpleUri getSimpleUriFor(Type type, ModuleEnvironment environment) {
    Class<?> clazz = getRawType(type);
    if (clazz.getClassLoader() == null) {
        // Loaded with the bootstrap class loader, definitely not part of a module
        return null;
    }
    Name moduleProviding = environment.getModuleProviding(clazz);
    if (moduleProviding == null) {
        return null;
    }
    return new SimpleUri(moduleProviding, clazz.getSimpleName());
}
Also used : SimpleUri(org.terasology.engine.core.SimpleUri) Name(org.terasology.gestalt.naming.Name)

Aggregations

SimpleUri (org.terasology.engine.core.SimpleUri)51 Name (org.terasology.gestalt.naming.Name)13 Map (java.util.Map)6 ModuleManager (org.terasology.engine.core.module.ModuleManager)6 FBO (org.terasology.engine.rendering.opengl.FBO)6 ModuleEnvironment (org.terasology.gestalt.module.ModuleEnvironment)6 DependencyResolver (org.terasology.gestalt.module.dependencyresolution.DependencyResolver)6 ResolutionResult (org.terasology.gestalt.module.dependencyresolution.ResolutionResult)6 Config (org.terasology.engine.config.Config)5 BindableButton (org.terasology.engine.input.BindableButton)5 Module (org.terasology.gestalt.module.Module)5 Input (org.terasology.input.Input)5 Test (org.junit.jupiter.api.Test)4 RegisterBindButton (org.terasology.engine.input.RegisterBindButton)4 Lists (com.google.common.collect.Lists)3 List (java.util.List)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 GameManifest (org.terasology.engine.game.GameManifest)3 FboConfig (org.terasology.engine.rendering.opengl.FboConfig)3