Artemis odb, Libgdx; Визуализация 3D-объектов на экране

Я возвращаюсь еще раз, чтобы задать конкретные вопросы,

Я создал мир, конструктор конфигураций и т. Д., ECS на основе Artemis odb, который используется поверх Libgdx. И как только все будет готово и отрисовано, ничего не отображается,

Некоторый код может помочь найти ключ;

 WorldConfiguration setup = new WorldConfigurationBuilder()
                .with(new HelloSystemArtemis()) //basic
                .with(new IGMessageSystem()) //HelloSystemArtemis clone
                .with(new GroupManager()) //Needed
                .with(new TagManager()) //Needed
                .with(new EntitySpawnerSystem()) //Spawn Entities
                .with(new MapRenderSystem()) //Render Map
                .with(new PlayerAndWeaponRenderSystem()) // Render Player and Weapon
                .with(new PlayerSystem())  //For handling Player displacements and actions
                .with(new PlayerNameRenderSystem()) //Retrieving Player Name
                .with(new PlayerLevelRenderSystem()) //Retrieving Player Level
                .with(new HealthRenderSystem()) //Retrieving Player Health
                .with(new ManaRenderSystem()) //Retrieving Player Mana
                .with(new EnergyRenderSystem()) //Retrieving Player Energy
                .with(new XPRenderSystem()) //Retrieving Player XP
                .with(new CameraSystem()) //For sake
                .with(new CameraFocusSystem()) //For sake
                .with(new MovementSystem(this))  //done
                .with(new StatusSystem(this))  //to verify
                .with(new EnemySystem(this))  //to verify
                .build();
        world = new World(setup);

в части рендеринга:

world.setDelta(delta);
world.process();

Для примера скажем, моя MapRenderSystem:

@All({MapModelComponentArtemis.class})
public class MapRenderSystem extends EntitySystem {
    public OxyddiA game;
    private static final float FOV = 67F;
    private final PerspectiveCamera perspectiveCamera;
    private final PerspectiveCamera weaponCamera;
    public final Environment environment;
    public final ModelBatch batch;
    private Entity weapon;
    public float delta;
    public Vector3 position;
    ComponentMapper<MapModelComponentArtemis> mm;
    ModelInstance mInst;

    public MapRenderSystem() {
        super(Aspect.all(MapModelComponentArtemis.class));
        batch = new ModelBatch();
        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.8f, 0.8f, 0.8f, 1f));
        perspectiveCamera = new PerspectiveCamera(FOV, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        perspectiveCamera.near = 0.1f;
        perspectiveCamera.far = 3000f;
        weaponCamera = new PerspectiveCamera(FOV, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        weaponCamera.near = 0.1f;
        weaponCamera.far = 20f;
    }

    @Override
    protected boolean checkProcessing() {
        return true;
    }

    public void resize(int width, int height) {
        perspectiveCamera.viewportHeight = height;
        perspectiveCamera.viewportWidth = width;
    }

    protected void processEntities(ImmutableBag<Entity> entities) {
        for (int i = 0; i < entities.size(); i++) {
            MapModelComponentArtemis mod = entities.get(i).getComponent(MapModelComponentArtemis.class);
            mInst = mod.getModelInstance();
            batch.begin(perspectiveCamera);
            batch.render(mInst, environment);
            batch.end();
        }
    }

    @Override
    protected void processSystem() {
        if(checkProcessing()) {
            begin();
            processEntities(getEntities());
            end();
        }
    }
}

мой MapComponent:

public class MapModelComponentArtemis extends Component {
    @Wire
    public Model model;
    public ModelInstance instance;
    private boolean isVisible = false;

    public MapModelComponentArtemis(){}

    public MapModelComponentArtemis(Model model, float x, float y, float z) {
        this.model = model;
        instance = new ModelInstance(model);
    }

    public MapModelComponentArtemis(Model model) {
        this.model = model;
    }

    public Model getModel() {
        return model;
    }

    public void setModel(Model model) {
        this.model = model;
    }

    public void setModelInstance(Model model, ModelInstance modelInstance){
        this.instance = new ModelInstance(model);
    }
    public ModelInstance getModelInstance() {
        return instance;
    }

    public void setMeshView(ModelInstance modelInstance) {
        this.instance = modelInstance;
    }

    public boolean isVisible() {
        return isVisible;
    }

    public void setVisible(boolean isVisible) {
        this.isVisible = isVisible;
    }
}

Да, это дерьмо и так далее, но мне нужен результат:P Любая помощь будет очень благодарна:)

0 ответов

Другие вопросы по тегам