Code Monkey home page Code Monkey logo

Comments (6)

vorg avatar vorg commented on June 16, 2024

If we would get rid of component constructors and allow

const lineBuilder = world.entity({ //OK
  transform: { positions: [0, 0, 0] }
  geometry: createCube(),
  material: { baseColor: [1, 0, 0, 1] }
});

how does one discovers possible components and their values?

from pex-renderer.

dmnsgn avatar dmnsgn commented on June 16, 2024

Given that pex-renderer is no longer Renderer but generic ECS machine should the main object be called World or Scene?

Do we need a separate pex-ecs for world/entity adding?

import createContext from "pex-context";
import createWorld from "pex-ecs"; // or if too many packages, import { createWorld } from "pex-renderer"
import { systems as rendererSystems } from "pex-renderer";

const ctx = createContext()
const world = createWorld({ ctx }) // world properties

world.addSystem(rendererSystems.geometry());
world.addSystem(rendererSystems.transform());
world.addSystem(rendererSystems.render());

If we would get rid of component constructors and allow

const lineBuilder = world.entity({ //OK
  transform: { positions: [0, 0, 0] }
  geometry: createCube(),
  material: { baseColor: [1, 0, 0, 1] }
});

how does one discovers possible components and their values?

I am all in favour of using plain object and removing renderer.material() calls that are a bit heavy to parse.

from pex-renderer.

vorg avatar vorg commented on June 16, 2024

i don't see value in completely separate pex-ecs (I can see use cases like html canvas projects) but i would just use pex-renderer createWorld with 100% custom systems first as a test case. systems namespace is fine although i prefer flat apis. Any particular reasons for world.geometrySystem() -> rendererSystem.geometry() ?

from pex-renderer.

dmnsgn avatar dmnsgn commented on June 16, 2024

v4: we settled on:

  • world: as a list of entities and systems and keeping track of deltaTime for animation in update.
  • default renderEngine: update (all its system, kind of like world?) and render selected entities
  • components: pex-renderer components which goal is to set default values. If that's 100% true, why are systems still checking so many default values
    sharedUniforms[`uDirectionalLights[${i}].castShadows`] = light.castShadows;
    sharedUniforms[`uDirectionalLights[${i}].projectionMatrix`] = light._projectionMatrix || tempMat4; //FIXME
    sharedUniforms[`uDirectionalLights[${i}].viewMatrix`] = light._viewMatrix || tempMat4; //FIXME;
    sharedUniforms[`uDirectionalLights[${i}].near`] = light._near || 0.1;
    sharedUniforms[`uDirectionalLights[${i}].far`] = light._far || 100;
    sharedUniforms[`uDirectionalLights[${i}].bias`] = light.bias || 0.1;
    sharedUniforms[`uDirectionalLights[${i}].shadowMapSize`] = light.castShadows ? [light._shadowMap.width, light._shadowMap.height] : [0, 0];
    sharedUniforms[`uDirectionalLightShadowMaps[${i}]`] = light.castShadows ? light._shadowMap : dummyTexture2D;

from pex-renderer.

dmnsgn avatar dmnsgn commented on June 16, 2024
  • are renderEngine and world overlapping (both a collection of systems with an update method)
  • we need to check who sets default value instead of having it define it 2 places (components and renderer) cc #307

from pex-renderer.

vorg avatar vorg commented on June 16, 2024

Also relevant: how do we plan on adding and optimising queries / searching for nodes with given component. Right now every system filters all entities. This could be something that the world takes care of.

from pex-renderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.