Package org.terasology.rendering.logic

Examples of org.terasology.rendering.logic.MeshComponent


    @ReceiveEvent
    public void onBlockItemDropped(ItemDroppedEvent event, EntityRef itemEntity, BlockItemComponent blockItemComponent) {
        EntityBuilder builder = event.getPickup();
        BlockFamily blockFamily = blockItemComponent.blockFamily;
        if (builder.hasComponent(MeshComponent.class)) {
            MeshComponent mesh = builder.getComponent(MeshComponent.class);
            mesh.mesh = blockFamily.getArchetypeBlock().getMesh();
            mesh.material = Assets.getMaterial("engine:terrain");
        }
        if (blockFamily.getArchetypeBlock().getCollisionShape() instanceof BoxShape && builder.hasComponent(BoxShapeComponent.class)) {
            Vector3f extents = ((BoxShape) blockFamily.getArchetypeBlock().getCollisionShape()).getHalfExtentsWithoutMargin(new Vector3f());
View Full Code Here


    @ReceiveEvent
    public void onItemDropped(ItemDroppedEvent event, EntityRef itemEntity, ItemComponent itemComponent) {
        EntityBuilder builder = event.getPickup();
        if (builder.hasComponent(MeshComponent.class)) {
            MeshComponent mesh = builder.getComponent(MeshComponent.class);
            if (mesh.mesh == null && itemComponent.icon != null) {
                builder.getComponent(MeshComponent.class).mesh = IconMeshFactory.getIconMesh(itemComponent.icon);
            }
        }
    }
View Full Code Here

        ClientComponent clientComp = controller.getComponent(ClientComponent.class);
        if (clientComp != null) {
            ColorComponent colorComp = clientComp.clientInfo.getComponent(ColorComponent.class);
           
            MeshComponent meshComp = builder.getComponent(MeshComponent.class);
            meshComp.color = colorComp.color;
        }
       
        CharacterComponent playerComponent = builder.getComponent(CharacterComponent.class);
        playerComponent.spawnPosition.set(spawnPosition);
View Full Code Here

            BlockRegionComponent blockRegion = target.getComponent(BlockRegionComponent.class);
            if (blockComp != null || blockRegion != null) {
                Block block = worldProvider.getBlock(blockPos);
                aabb = block.getBounds(blockPos);
            } else {
                MeshComponent mesh = target.getComponent(MeshComponent.class);
                LocationComponent location = target.getComponent(LocationComponent.class);
                if (mesh != null && mesh.mesh != null && location != null) {
                    aabb = mesh.mesh.getAABB();
                    aabb = aabb.transform(location.getWorldRotation(), location.getWorldPosition(), location.getWorldScale());
                }
View Full Code Here

            List<Component> entityData = Lists.newArrayList();
            if (rand.nextFloat() < 0.75f) {
                entityData.add(new LocationComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new MeshComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new InventoryComponent());
            }
            if (rand.nextFloat() < 0.25f) {
View Full Code Here

    @Override
    public void run() {
        for (EntityRef entity : entityManager.getEntitiesWith(MeshComponent.class, LocationComponent.class)) {
            LocationComponent loc = entity.getComponent(LocationComponent.class);
            MeshComponent meshComp = entity.getComponent(MeshComponent.class);
            loc.getLocalPosition();
        }
    }
View Full Code Here

            List<Component> entityData = Lists.newArrayList();
            if (rand.nextFloat() < 0.75f) {
                entityData.add(new LocationComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new MeshComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new InventoryComponent());
            }
            if (rand.nextFloat() < 0.25f) {
View Full Code Here

            List<Component> entityData = Lists.newArrayList();
            if (rand.nextFloat() < 0.75f) {
                entityData.add(new LocationComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new MeshComponent());
            }
            if (rand.nextFloat() < 0.5f) {
                entityData.add(new InventoryComponent());
            }
            if (rand.nextFloat() < 0.25f) {
View Full Code Here

TOP

Related Classes of org.terasology.rendering.logic.MeshComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.