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