Search in sources :

Example 1 with MeshData

use of org.terasology.rendering.assets.mesh.MeshData in project Terasology by MovingBlocks.

the class Tessellator method generateMeshData.

public MeshData generateMeshData() {
    MeshData result = meshData;
    meshData = new MeshData();
    return result;
}
Also used : MeshData(org.terasology.rendering.assets.mesh.MeshData)

Example 2 with MeshData

use of org.terasology.rendering.assets.mesh.MeshData in project Terasology by MovingBlocks.

the class Tessellator method generateMesh.

public Mesh generateMesh(ResourceUrn urn) {
    Preconditions.checkNotNull(urn);
    Mesh result = Assets.generateAsset(urn, meshData, Mesh.class);
    meshData = new MeshData();
    return result;
}
Also used : MeshData(org.terasology.rendering.assets.mesh.MeshData) Mesh(org.terasology.rendering.assets.mesh.Mesh)

Example 3 with MeshData

use of org.terasology.rendering.assets.mesh.MeshData in project Terasology by MovingBlocks.

the class Tessellator method generateMesh.

public Mesh generateMesh() {
    Mesh result = Assets.generateAsset(meshData, Mesh.class);
    meshData = new MeshData();
    return result;
}
Also used : MeshData(org.terasology.rendering.assets.mesh.MeshData) Mesh(org.terasology.rendering.assets.mesh.Mesh)

Example 4 with MeshData

use of org.terasology.rendering.assets.mesh.MeshData in project Terasology by MovingBlocks.

the class HeadlessGraphics method registerCoreAssetTypes.

@Override
public void registerCoreAssetTypes(ModuleAwareAssetTypeManager assetTypeManager) {
    assetTypeManager.registerCoreAssetType(Font.class, (AssetFactory<Font, FontData>) FontImpl::new, "fonts");
    assetTypeManager.registerCoreAssetType(Texture.class, (AssetFactory<Texture, TextureData>) HeadlessTexture::new, "textures", "fonts");
    assetTypeManager.registerCoreFormat(Texture.class, new PNGTextureFormat(Texture.FilterMode.NEAREST, path -> path.getName(2).toString().equals("textures")));
    assetTypeManager.registerCoreFormat(Texture.class, new PNGTextureFormat(Texture.FilterMode.LINEAR, path -> path.getName(2).toString().equals("fonts")));
    assetTypeManager.registerCoreAssetType(Shader.class, (AssetFactory<Shader, ShaderData>) HeadlessShader::new, "shaders");
    assetTypeManager.registerCoreAssetType(Material.class, (AssetFactory<Material, MaterialData>) HeadlessMaterial::new, "materials");
    assetTypeManager.registerCoreAssetType(Mesh.class, (AssetFactory<Mesh, MeshData>) HeadlessMesh::new, "mesh");
    assetTypeManager.registerCoreAssetType(SkeletalMesh.class, (AssetFactory<SkeletalMesh, SkeletalMeshData>) HeadlessSkeletalMesh::new, "skeletalMesh");
    assetTypeManager.registerCoreAssetType(MeshAnimation.class, (AssetFactory<MeshAnimation, MeshAnimationData>) MeshAnimationImpl::new, "animations");
    assetTypeManager.registerCoreAssetType(Atlas.class, (AssetFactory<Atlas, AtlasData>) Atlas::new, "atlas");
    assetTypeManager.registerCoreAssetType(Subtexture.class, (AssetFactory<Subtexture, SubtextureData>) Subtexture::new);
}
Also used : PNGTextureFormat(org.terasology.rendering.assets.texture.PNGTextureFormat) EngineSubsystem(org.terasology.engine.subsystem.EngineSubsystem) RenderingSubsystemFactory(org.terasology.engine.subsystem.RenderingSubsystemFactory) Texture(org.terasology.rendering.assets.texture.Texture) MeshData(org.terasology.rendering.assets.mesh.MeshData) HeadlessMaterial(org.terasology.engine.subsystem.headless.assets.HeadlessMaterial) HeadlessDisplayDevice(org.terasology.engine.subsystem.headless.device.HeadlessDisplayDevice) HeadlessTexture(org.terasology.engine.subsystem.headless.assets.HeadlessTexture) MeshAnimationData(org.terasology.rendering.assets.animation.MeshAnimationData) FontData(org.terasology.rendering.assets.font.FontData) Material(org.terasology.rendering.assets.material.Material) MaterialData(org.terasology.rendering.assets.material.MaterialData) Mesh(org.terasology.rendering.assets.mesh.Mesh) Shader(org.terasology.rendering.assets.shader.Shader) PNGTextureFormat(org.terasology.rendering.assets.texture.PNGTextureFormat) CanvasRenderer(org.terasology.rendering.nui.internal.CanvasRenderer) Atlas(org.terasology.rendering.assets.atlas.Atlas) HeadlessSkeletalMesh(org.terasology.engine.subsystem.headless.assets.HeadlessSkeletalMesh) HeadlessShader(org.terasology.engine.subsystem.headless.assets.HeadlessShader) Context(org.terasology.context.Context) ModuleAwareAssetTypeManager(org.terasology.assets.module.ModuleAwareAssetTypeManager) MeshAnimationImpl(org.terasology.rendering.assets.animation.MeshAnimationImpl) SkeletalMeshData(org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData) ShaderManager(org.terasology.rendering.ShaderManager) AssetFactory(org.terasology.assets.AssetFactory) MeshAnimation(org.terasology.rendering.assets.animation.MeshAnimation) SubtextureData(org.terasology.rendering.assets.texture.subtexture.SubtextureData) SkeletalMesh(org.terasology.rendering.assets.skeletalmesh.SkeletalMesh) FontImpl(org.terasology.rendering.assets.font.FontImpl) ShaderData(org.terasology.rendering.assets.shader.ShaderData) HeadlessCanvasRenderer(org.terasology.engine.subsystem.headless.renderer.HeadlessCanvasRenderer) HeadlessRenderingSubsystemFactory(org.terasology.engine.subsystem.headless.renderer.HeadlessRenderingSubsystemFactory) HeadlessMesh(org.terasology.engine.subsystem.headless.assets.HeadlessMesh) ShaderManagerHeadless(org.terasology.engine.subsystem.headless.renderer.ShaderManagerHeadless) DisplayDevice(org.terasology.engine.subsystem.DisplayDevice) Font(org.terasology.rendering.assets.font.Font) Subtexture(org.terasology.rendering.assets.texture.subtexture.Subtexture) TextureData(org.terasology.rendering.assets.texture.TextureData) AtlasData(org.terasology.rendering.assets.atlas.AtlasData) Atlas(org.terasology.rendering.assets.atlas.Atlas) FontData(org.terasology.rendering.assets.font.FontData) SkeletalMeshData(org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData) Mesh(org.terasology.rendering.assets.mesh.Mesh) HeadlessSkeletalMesh(org.terasology.engine.subsystem.headless.assets.HeadlessSkeletalMesh) SkeletalMesh(org.terasology.rendering.assets.skeletalmesh.SkeletalMesh) HeadlessMesh(org.terasology.engine.subsystem.headless.assets.HeadlessMesh) HeadlessMaterial(org.terasology.engine.subsystem.headless.assets.HeadlessMaterial) Material(org.terasology.rendering.assets.material.Material) HeadlessSkeletalMesh(org.terasology.engine.subsystem.headless.assets.HeadlessSkeletalMesh) SkeletalMesh(org.terasology.rendering.assets.skeletalmesh.SkeletalMesh) Shader(org.terasology.rendering.assets.shader.Shader) HeadlessShader(org.terasology.engine.subsystem.headless.assets.HeadlessShader) Texture(org.terasology.rendering.assets.texture.Texture) HeadlessTexture(org.terasology.engine.subsystem.headless.assets.HeadlessTexture) Font(org.terasology.rendering.assets.font.Font) MeshData(org.terasology.rendering.assets.mesh.MeshData) SkeletalMeshData(org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData) ShaderData(org.terasology.rendering.assets.shader.ShaderData) AtlasData(org.terasology.rendering.assets.atlas.AtlasData) TextureData(org.terasology.rendering.assets.texture.TextureData) SubtextureData(org.terasology.rendering.assets.texture.subtexture.SubtextureData) MeshAnimation(org.terasology.rendering.assets.animation.MeshAnimation) MeshAnimationData(org.terasology.rendering.assets.animation.MeshAnimationData) MaterialData(org.terasology.rendering.assets.material.MaterialData) Subtexture(org.terasology.rendering.assets.texture.subtexture.Subtexture)

Example 5 with MeshData

use of org.terasology.rendering.assets.mesh.MeshData in project Terasology by MovingBlocks.

the class LwjglGraphics method registerCoreAssetTypes.

@Override
public void registerCoreAssetTypes(ModuleAwareAssetTypeManager assetTypeManager) {
    // cast lambdas explicitly to avoid inconsistent compiler behavior wrt. type inference
    assetTypeManager.registerCoreAssetType(Font.class, (AssetFactory<Font, FontData>) FontImpl::new, "fonts");
    assetTypeManager.registerCoreAssetType(Texture.class, (AssetFactory<Texture, TextureData>) (urn, assetType, data) -> (new OpenGLTexture(urn, assetType, data, this)), "textures", "fonts");
    assetTypeManager.registerCoreFormat(Texture.class, new PNGTextureFormat(Texture.FilterMode.NEAREST, path -> {
        if (path.getName(1).toString().equals(ModuleAssetDataProducer.OVERRIDE_FOLDER)) {
            return path.getName(3).toString().equals("textures");
        } else {
            return path.getName(2).toString().equals("textures");
        }
    }));
    assetTypeManager.registerCoreFormat(Texture.class, new PNGTextureFormat(Texture.FilterMode.LINEAR, path -> {
        if (path.getName(1).toString().equals(ModuleAssetDataProducer.OVERRIDE_FOLDER)) {
            return path.getName(3).toString().equals("fonts");
        } else {
            return path.getName(2).toString().equals("fonts");
        }
    }));
    assetTypeManager.registerCoreAssetType(Shader.class, (AssetFactory<Shader, ShaderData>) GLSLShader::new, "shaders");
    assetTypeManager.registerCoreAssetType(Material.class, (AssetFactory<Material, MaterialData>) GLSLMaterial::new, "materials");
    assetTypeManager.registerCoreAssetType(Mesh.class, (AssetFactory<Mesh, MeshData>) (urn, assetType, data) -> new OpenGLMesh(urn, assetType, bufferPool, data), "mesh");
    assetTypeManager.registerCoreAssetType(SkeletalMesh.class, (AssetFactory<SkeletalMesh, SkeletalMeshData>) (urn, assetType, data) -> new OpenGLSkeletalMesh(urn, assetType, data, bufferPool), "skeletalMesh");
    assetTypeManager.registerCoreAssetType(MeshAnimation.class, (AssetFactory<MeshAnimation, MeshAnimationData>) MeshAnimationImpl::new, "animations");
    assetTypeManager.registerCoreAssetType(Atlas.class, (AssetFactory<Atlas, AtlasData>) Atlas::new, "atlas");
    assetTypeManager.registerCoreAssetType(Subtexture.class, (AssetFactory<Subtexture, SubtextureData>) Subtexture::new);
}
Also used : RenderingSubsystemFactory(org.terasology.engine.subsystem.RenderingSubsystemFactory) MeshData(org.terasology.rendering.assets.mesh.MeshData) LoggerFactory(org.slf4j.LoggerFactory) Config(org.terasology.config.Config) LWJGLException(org.lwjgl.LWJGLException) ByteBuffer(java.nio.ByteBuffer) FontData(org.terasology.rendering.assets.font.FontData) Material(org.terasology.rendering.assets.material.Material) PNGTextureFormat(org.terasology.rendering.assets.texture.PNGTextureFormat) ImageIO(javax.imageio.ImageIO) Atlas(org.terasology.rendering.assets.atlas.Atlas) GL11(org.lwjgl.opengl.GL11) TextureUtil(org.terasology.rendering.assets.texture.TextureUtil) Context(org.terasology.context.Context) ModuleAwareAssetTypeManager(org.terasology.assets.module.ModuleAwareAssetTypeManager) BufferedImage(java.awt.image.BufferedImage) ShaderManager(org.terasology.rendering.ShaderManager) RenderingConfig(org.terasology.config.RenderingConfig) SubtextureData(org.terasology.rendering.assets.texture.subtexture.SubtextureData) GameState(org.terasology.engine.modes.GameState) ShaderData(org.terasology.rendering.assets.shader.ShaderData) Queues(com.google.common.collect.Queues) List(java.util.List) LwjglCanvasRenderer(org.terasology.rendering.nui.internal.LwjglCanvasRenderer) DisplayDevice(org.terasology.engine.subsystem.DisplayDevice) Font(org.terasology.rendering.assets.font.Font) Subtexture(org.terasology.rendering.assets.texture.subtexture.Subtexture) TextureData(org.terasology.rendering.assets.texture.TextureData) GameEngine(org.terasology.engine.GameEngine) ModuleAssetDataProducer(org.terasology.assets.module.ModuleAssetDataProducer) ShaderManagerLwjgl(org.terasology.rendering.ShaderManagerLwjgl) Texture(org.terasology.rendering.assets.texture.Texture) GameThread(org.terasology.engine.GameThread) org.lwjgl.opengl(org.lwjgl.opengl) MeshAnimationData(org.terasology.rendering.assets.animation.MeshAnimationData) Lists(com.google.common.collect.Lists) MaterialData(org.terasology.rendering.assets.material.MaterialData) Mesh(org.terasology.rendering.assets.mesh.Mesh) Shader(org.terasology.rendering.assets.shader.Shader) CanvasRenderer(org.terasology.rendering.nui.internal.CanvasRenderer) Logger(org.slf4j.Logger) MeshAnimationImpl(org.terasology.rendering.assets.animation.MeshAnimationImpl) SkeletalMeshData(org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData) BlockingDeque(java.util.concurrent.BlockingDeque) AssetFactory(org.terasology.assets.AssetFactory) MeshAnimation(org.terasology.rendering.assets.animation.MeshAnimation) IOException(java.io.IOException) SkeletalMesh(org.terasology.rendering.assets.skeletalmesh.SkeletalMesh) FontImpl(org.terasology.rendering.assets.font.FontImpl) org.terasology.rendering.opengl(org.terasology.rendering.opengl) Consumer(java.util.function.Consumer) AtlasData(org.terasology.rendering.assets.atlas.AtlasData) PNGTextureFormat(org.terasology.rendering.assets.texture.PNGTextureFormat) Atlas(org.terasology.rendering.assets.atlas.Atlas) FontData(org.terasology.rendering.assets.font.FontData) SkeletalMeshData(org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData) Mesh(org.terasology.rendering.assets.mesh.Mesh) SkeletalMesh(org.terasology.rendering.assets.skeletalmesh.SkeletalMesh) Material(org.terasology.rendering.assets.material.Material) SkeletalMesh(org.terasology.rendering.assets.skeletalmesh.SkeletalMesh) Shader(org.terasology.rendering.assets.shader.Shader) Texture(org.terasology.rendering.assets.texture.Texture) Font(org.terasology.rendering.assets.font.Font) MeshData(org.terasology.rendering.assets.mesh.MeshData) SkeletalMeshData(org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData) ShaderData(org.terasology.rendering.assets.shader.ShaderData) AtlasData(org.terasology.rendering.assets.atlas.AtlasData) TextureData(org.terasology.rendering.assets.texture.TextureData) SubtextureData(org.terasology.rendering.assets.texture.subtexture.SubtextureData) MeshAnimation(org.terasology.rendering.assets.animation.MeshAnimation) MeshAnimationData(org.terasology.rendering.assets.animation.MeshAnimationData) MaterialData(org.terasology.rendering.assets.material.MaterialData) Subtexture(org.terasology.rendering.assets.texture.subtexture.Subtexture)

Aggregations

MeshData (org.terasology.rendering.assets.mesh.MeshData)6 Mesh (org.terasology.rendering.assets.mesh.Mesh)5 AssetFactory (org.terasology.assets.AssetFactory)3 ModuleAwareAssetTypeManager (org.terasology.assets.module.ModuleAwareAssetTypeManager)3 MeshAnimation (org.terasology.rendering.assets.animation.MeshAnimation)3 MeshAnimationData (org.terasology.rendering.assets.animation.MeshAnimationData)3 MeshAnimationImpl (org.terasology.rendering.assets.animation.MeshAnimationImpl)3 Atlas (org.terasology.rendering.assets.atlas.Atlas)3 AtlasData (org.terasology.rendering.assets.atlas.AtlasData)3 Font (org.terasology.rendering.assets.font.Font)3 FontData (org.terasology.rendering.assets.font.FontData)3 FontImpl (org.terasology.rendering.assets.font.FontImpl)3 Material (org.terasology.rendering.assets.material.Material)3 MaterialData (org.terasology.rendering.assets.material.MaterialData)3 Shader (org.terasology.rendering.assets.shader.Shader)3 ShaderData (org.terasology.rendering.assets.shader.ShaderData)3 SkeletalMesh (org.terasology.rendering.assets.skeletalmesh.SkeletalMesh)3 SkeletalMeshData (org.terasology.rendering.assets.skeletalmesh.SkeletalMeshData)3 PNGTextureFormat (org.terasology.rendering.assets.texture.PNGTextureFormat)3 Texture (org.terasology.rendering.assets.texture.Texture)3