Giter VIP home page Giter VIP logo

cervus's People

Contributors

michalbe avatar stasm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cervus's Issues

implement entity-component architecture

  • Entities should be as small as possible (the only logic there should be probably managing children entities and components)
  • Components:
    • Body (like unity's transform)
    • Renderable
    • Movable

Add color setters

  • Colors should transform hexes to vectors when set.
  • there's no need for Entity::color.vecat all then.

Implement a component system

Features like moving, mouse look, rendering, or get_view_matrix should be abstracted and promoted to separate components which can be enabled/disabled and added/removed to Entities on runtime.

Make Z the "forward" axis

I initially suggested to @michalbe that the Z axis be the "up" axis, to stay in line with Blender. However it's clear to me now that this goes against OpenGL. Let's change it back.

While most of the time this isn't a big issue, it comes up as a problem during the look at and target to rotations. These operations should orient the forward face toward a point. Instead they assume that Z is forward and they currently orient the up face.

Animation support

Since basically every 3d software can export FBX format, let's use it in Cervus as well.
The MORPH component could probably be used in here, but further research is required
to confirm that.

Questions & concerns

  • Maybe md5 would be easier to work with?
  • The easiest would probably be simple JSON model format from this Online 3D Converter, it exports FBX animations and bones to JSON (tested on Mixamo models)
Old description
  • Clean up the voxel animation code
  • Add support for multiframe animations from Magica
  • remove the mesh builder and leave just the parser (as a module maybe?)
  • optimize animations (diff between frames?)

Add `lookAt` method to the camera

Ideas:

  • Entity can take a target entity and follow it all the time
  • this could also be a method that forces camera to change rotation (do entities need to have a forward and right vector then? They probably should - #13).

Implement `Entity.clone`

Keep in mind that each component keeps a reference to an Entity it's assigned to, and this Entity has map of components, so standard deepCloning won't work here.

Related issues:

Serialise game to JSON

It would be nice to have an ability to save the current game state as JSON, and then build the game using this JSON.

Related issues:

Global key listener

  • Remove key listener from the camera module
  • move it to the core or separate module
  • subscribe camera actions to this listener, and expose it outside.

Scale isn't working correctly.

Scale setter isn't working correctly, it's scaling by the vector, not to the vector.

Repro

  • set entitie's scale [5, 5, 5]
  • scale it down to the initial size with entity.scale = [1, 1, 1];
  • not that nothing happened, because entity.local_matrix was just scaled by [1, 1, 1] vector.

Entity.look_at

it's currently broken and I've removed it in #37. Let's bring it back.

Multiple viewports

Let's find a way to render multiple cameras to different parts of the screen. This way it will be easy to implement minimaps, VR rendering, etc.

unity like editor

Where components are inheriting from basic components (like Entity), and public methods are visible from the editor when not contain _ in name.

  • How to handle enums there?
    • and other data types?

Add Pointer lock

When using mouse look it will helpful to provide an option to hide the mouse cursor.

Raycaster

Casting rays is something that could be used in collision detection, or mouseclicks on elements.

Docs
screen shot 2017-09-30 at 18 03 01

Tweens?

It would be nice to have some. Investigate possibilities here.

Rotation is affecting movement.

Repro

  • Notice the red sphere in the middle. It's moving + 0.06 in the x direction each frame:
    movement-1
  • Now, let's rotate it in every frame:
  sphere.rotate_ud(16/1000);
  sphere.rotate_rl(16/1000);

With the same movement logic, the scene looks like this now:
movement-2

Remove the math namespace

core/math could simply export const vec3 = ...; and export const mat4 = ...'. This will allow the following usage in other files: import { vec3 } from './core/math'; vec3.method_name();.

Remove Entity.origin

Previous discussion: #23 (comment)

By removing Entity.origin we can keep the API surface small. The same effect can be achieved by introducing an intermediate parent in the object hierarchy. This solution also has the benefit of being consistent: rotating ancestors results in consistent rotation of all descendants relative to the ancestor's origin. With Entity.origin it's weird that rotating the entity may not happen around it's (0, 0, 0) point.

Architecture rewrite

Let's make it possible to imports parts of the engine so it will treeshake better. It should be possible to use final version this way:

import { Box } from 'cervus/shapes';
import { Phong } from 'cervus/material';

const voxel = new Box({ material: Phong });

Add Entity.origin

I removed Entity.origin in #37 because of implementation troubles. I know @michalbe would like to see it back, so let's discuss this here. Previous discussion: #35.

Smarter shader management

Some deeper research should be done here, but from what I know today, there are two basic approaches to that topic:

  • UBERSHADER, that contains the data for all materials, lights, textures etc. in just one, huge shader. Since if statements are slowing shaders down, all the branches should be handled with preprocessor commands. This way shaders handled for instance in Horde3D.
    If written in a smart way, this can support user defined rules as well (for instance using #ifdef CUSTOM_RULES const).
  • Another method is implemented in BabylonJS, where shaders are including needed parts of the program in the main material shader. Variation of this method could be something like GLSLify, a require kind of tool for glsl programs.

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.