Search in sources :

Example 1 with MeshAnimationBundle

use of org.terasology.engine.rendering.assets.animation.MeshAnimationBundle in project Terasology by MovingBlocks.

the class LwjglGraphicsManager method registerCoreAssetTypes.

public void registerCoreAssetTypes(ModuleAwareAssetTypeManager assetTypeManager) {
    // cast lambdas explicitly to avoid inconsistent compiler behavior wrt. type inference
    assetTypeManager.createAssetType(Font.class, FontImpl::new, "fonts");
    AssetType<Texture, TextureData> texture = assetTypeManager.createAssetType(Texture.class, (urn, assetType, data) -> (OpenGLTexture.create(urn, assetType, data, this)), "textures", "fonts");
    assetTypeManager.getAssetFileDataProducer(texture).addAssetFormat(new PNGTextureFormat(Texture.FilterMode.NEAREST, path -> {
        if (path.getPath().get(0).equals(ModuleAssetScanner.OVERRIDE_FOLDER)) {
            return path.getPath().get(2).equals("textures");
        } else {
            return path.getPath().get(1).equals("textures");
        }
    }));
    assetTypeManager.getAssetFileDataProducer(texture).addAssetFormat(new PNGTextureFormat(Texture.FilterMode.LINEAR, path -> {
        if (path.getPath().get(0).equals(ModuleAssetScanner.OVERRIDE_FOLDER)) {
            return path.getPath().get(2).equals("fonts");
        } else {
            return path.getPath().get(1).equals("fonts");
        }
    }));
    assetTypeManager.createAssetType(Shader.class, (urn, assetType, data) -> GLSLShader.create(urn, assetType, data, this), "shaders");
    assetTypeManager.createAssetType(Material.class, (urn, assetType, data) -> GLSLMaterial.create(urn, this, assetType, data), "materials");
    assetTypeManager.createAssetType(Mesh.class, (urn, assetType, data) -> OpenGLMesh.create(urn, assetType, data, this), "mesh");
    assetTypeManager.createAssetType(SkeletalMesh.class, (urn, assetType, data) -> OpenGLSkeletalMesh.create(urn, assetType, data, this), "skeletalMesh");
    assetTypeManager.createAssetType(MeshAnimation.class, MeshAnimationImpl::new, "animations", "skeletalMesh");
    assetTypeManager.createAssetType(Atlas.class, Atlas::new, "atlas");
    assetTypeManager.createAssetType(MeshAnimationBundle.class, MeshAnimationBundle::new, "skeletalMesh", "animations");
    assetTypeManager.createAssetType(Subtexture.class, Subtexture::new);
}
Also used : PNGTextureFormat(org.terasology.engine.rendering.assets.texture.PNGTextureFormat) Atlas(org.terasology.engine.rendering.assets.atlas.Atlas) Shader(org.terasology.engine.rendering.assets.shader.Shader) Texture(org.terasology.engine.rendering.assets.texture.Texture) ModuleAssetScanner(org.terasology.gestalt.assets.module.ModuleAssetScanner) GL_TEXTURE_WRAP_T(org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_T) GL_TEXTURE_WRAP_S(org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_S) GLSLMaterial(org.terasology.engine.rendering.opengl.GLSLMaterial) GL11.glBindTexture(org.lwjgl.opengl.GL11.glBindTexture) GL_TEXTURE_2D(org.lwjgl.opengl.GL11.GL_TEXTURE_2D) ByteBuffer(java.nio.ByteBuffer) Subtexture(org.terasology.engine.rendering.assets.texture.subtexture.Subtexture) Lists(com.google.common.collect.Lists) OpenGLTexture(org.terasology.engine.rendering.opengl.OpenGLTexture) Font(org.terasology.engine.rendering.assets.font.Font) ModuleAwareAssetTypeManager(org.terasology.gestalt.assets.module.ModuleAwareAssetTypeManager) OpenGLMesh(org.terasology.engine.rendering.opengl.OpenGLMesh) GL12(org.lwjgl.opengl.GL12) FontImpl(org.terasology.engine.rendering.assets.font.FontImpl) GL11(org.lwjgl.opengl.GL11) MeshAnimationImpl(org.terasology.engine.rendering.assets.animation.MeshAnimationImpl) BlockingDeque(java.util.concurrent.BlockingDeque) AssetType(org.terasology.gestalt.assets.AssetType) OpenGLSkeletalMesh(org.terasology.engine.rendering.opengl.OpenGLSkeletalMesh) GL11.glGenTextures(org.lwjgl.opengl.GL11.glGenTextures) SkeletalMesh(org.terasology.engine.rendering.assets.skeletalmesh.SkeletalMesh) GameThread(org.terasology.engine.core.GameThread) DisplayDeviceInfo(org.terasology.engine.core.subsystem.DisplayDeviceInfo) RenderingSubsystemFactory(org.terasology.engine.core.subsystem.RenderingSubsystemFactory) MeshAnimationBundle(org.terasology.engine.rendering.assets.animation.MeshAnimationBundle) Consumer(java.util.function.Consumer) Queues(com.google.common.collect.Queues) List(java.util.List) Context(org.terasology.engine.context.Context) Material(org.terasology.engine.rendering.assets.material.Material) PNGTextureFormat(org.terasology.engine.rendering.assets.texture.PNGTextureFormat) GLSLShader(org.terasology.engine.rendering.opengl.GLSLShader) GL11.glDeleteTextures(org.lwjgl.opengl.GL11.glDeleteTextures) TextureData(org.terasology.engine.rendering.assets.texture.TextureData) Mesh(org.terasology.engine.rendering.assets.mesh.Mesh) MeshAnimation(org.terasology.engine.rendering.assets.animation.MeshAnimation) GL11.glTexParameterf(org.lwjgl.opengl.GL11.glTexParameterf) Atlas(org.terasology.engine.rendering.assets.atlas.Atlas) TextureData(org.terasology.engine.rendering.assets.texture.TextureData) Subtexture(org.terasology.engine.rendering.assets.texture.subtexture.Subtexture) Texture(org.terasology.engine.rendering.assets.texture.Texture) GL11.glBindTexture(org.lwjgl.opengl.GL11.glBindTexture) OpenGLTexture(org.terasology.engine.rendering.opengl.OpenGLTexture) MeshAnimationImpl(org.terasology.engine.rendering.assets.animation.MeshAnimationImpl) FontImpl(org.terasology.engine.rendering.assets.font.FontImpl) MeshAnimationBundle(org.terasology.engine.rendering.assets.animation.MeshAnimationBundle)

Aggregations

Lists (com.google.common.collect.Lists)1 Queues (com.google.common.collect.Queues)1 ByteBuffer (java.nio.ByteBuffer)1 List (java.util.List)1 BlockingDeque (java.util.concurrent.BlockingDeque)1 Consumer (java.util.function.Consumer)1 GL11 (org.lwjgl.opengl.GL11)1 GL_TEXTURE_2D (org.lwjgl.opengl.GL11.GL_TEXTURE_2D)1 GL_TEXTURE_WRAP_S (org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_S)1 GL_TEXTURE_WRAP_T (org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_T)1 GL11.glBindTexture (org.lwjgl.opengl.GL11.glBindTexture)1 GL11.glDeleteTextures (org.lwjgl.opengl.GL11.glDeleteTextures)1 GL11.glGenTextures (org.lwjgl.opengl.GL11.glGenTextures)1 GL11.glTexParameterf (org.lwjgl.opengl.GL11.glTexParameterf)1 GL12 (org.lwjgl.opengl.GL12)1 Context (org.terasology.engine.context.Context)1 GameThread (org.terasology.engine.core.GameThread)1 DisplayDeviceInfo (org.terasology.engine.core.subsystem.DisplayDeviceInfo)1 RenderingSubsystemFactory (org.terasology.engine.core.subsystem.RenderingSubsystemFactory)1 MeshAnimation (org.terasology.engine.rendering.assets.animation.MeshAnimation)1