<commit_before>package com.jacudibu.entitySystem;

import com.badlogic.ashley.core.Engine;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.EntitySystem;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.utils.ImmutableArray;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.jacudibu.MainCamera;
import com.jacudibu.components.ArrowComponent;
import com.jacudibu.components.Mappers;
import com.jacudibu.components.ModelComponent;

/**
 * Created by <NAME> (Jacudibu) on 07.05.2017.
 */
public class RenderSystem extends EntitySystem {
    private ImmutableArray<Entity> modelEntities;
    private ImmutableArray<Entity> arrowEntities;

    private ModelBatch modelBatch;
    private Environment environment;

    public RenderSystem() {
        modelBatch = new ModelBatch();
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
    }

    @Override
    public void addedToEngine(Engine engine) {
        modelEntities = engine.getEntitiesFor((Family.all(ModelComponent.class).get()));
        arrowEntities = engine.getEntitiesFor((Family.all(ArrowComponent.class).get()));
    }

    @Override
    public void update(float deltaTime) {
        updateCamera(deltaTime);
        modelBatch.begin(MainCamera.getCamera());

        for (int i = 0; i < modelEntities.size(); i++) {
            Entity entity = modelEntities.get(i);
            ModelComponent model = Mappers.model.get(entity);
            modelBatch.render(model.instance, environment);
        }

        // Ashley doesn't seem to take inheritance into account,
        // therefore modelEntitites won't contain entities with arrowComponents.
        for (int i = 0; i < arrowEntities.size(); i++) {
            Entity entity = arrowEntities.get(i);
            ArrowComponent arrow = Mappers.arrow.get(entity);
            modelBatch.render(arrow.instance, environment);
        }

        modelBatch.end();
    }

    private void updateCamera(float deltaTime) {

    }


}<commit_msg>Removed an unnesseccary call in renderSystem<commit_after>package com.jacudibu.entitySystem;

import com.badlogic.ashley.core.Engine;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.EntitySystem;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.utils.ImmutableArray;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.jacudibu.MainCamera;
import com.jacudibu.components.ArrowComponent;
import com.jacudibu.components.Mappers;
import com.jacudibu.components.ModelComponent;

/**
 * Created by <NAME> (Jacudibu) on 07.05.2017.
 */
public class RenderSystem extends EntitySystem {
    private ImmutableArray<Entity> modelEntities;
    private ImmutableArray<Entity> arrowEntities;

    private ModelBatch modelBatch;
    private Environment environment;

    public RenderSystem() {
        modelBatch = new ModelBatch();
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
    }

    @Override
    public void addedToEngine(Engine engine) {
        modelEntities = engine.getEntitiesFor((Family.all(ModelComponent.class).get()));
        arrowEntities = engine.getEntitiesFor((Family.all(ArrowComponent.class).get()));
    }

    @Override
    public void update(float deltaTime) {
        modelBatch.begin(MainCamera.getCamera());

        for (int i = 0; i < modelEntities.size(); i++) {
            Entity entity = modelEntities.get(i);
            ModelComponent model = Mappers.model.get(entity);
            modelBatch.render(model.instance, environment);
        }

        // Ashley doesn't seem to take inheritance into account,
        // therefore modelEntitites won't contain entities with arrowComponents.
        for (int i = 0; i < arrowEntities.size(); i++) {
            Entity entity = arrowEntities.get(i);
            ArrowComponent arrow = Mappers.arrow.get(entity);
            modelBatch.render(arrow.instance, environment);
        }

        modelBatch.end();
    }

}
{'fraction_non_alphanumeric': 0.11333896158716758, 'fraction_numerical': 0.013507809202195019, 'mean_word_length': 3.470754716981132, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '410653', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1419, 'n_words': 280}