Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Closes #26. Adds the
@nanoforge/graphics-3dpackage: a beginner gets a lit, visible 3D object by adding components and the provideddraw3Dsystem, without writing any Three.js.Box3D,Sphere3D,Plane3D(one color each,@preset color),Camera3D,Light3D(ambient/directional/point), andObject3DComponent, which shows any Three.js object, e.g. anInstancedMesh.draw3D: creates each component's Three.js object inctx.graphics.scene, keeps it up to date, and removes it, disposing its geometries, materials and textures, when the component or the entity goes. AppliesPosition3D/Rotation3D/Scale3Dfrom basics-3d to every object,Object3DComponentincluded.Camera3D, the library's own camera is shown.toObject3D(object-3d.ts) turns a component's params into its Three.js object. It depends only on Three.js and also takes plain{ name: "Box3D", … }objects, so the editor's 3D Scene screen can reuse it.@nanoforge-dev/graphics-3dandthreeadded to thecorecatalog.2D and 3D build apart
graphics-2d and graphics-3d both type
ctx.graphics, differently, so one TS program can't load both (TS2717). A game never does, but this repo compiled every package together. Now:tsconfig.jsonbuilds everything except graphics-3d, which builds intsconfig.3d.json;buildruns both.2dand3d. 3D specs live intest/3d/and importtest/ecs.ts(the ECS helpers, no engine typings) instead oftest/helpers.ts, which loads graphics-2d's typings.draw3Dusesctx.graphicsdirectly, likedraw2D, with no cast.pnpm run typecheck(tsc on both spec configs, packages included, withoutskipLibCheck), run bylint. Vitest's typecheck only checks*.spec-d.tsfiles and there are none, so until now no type error reached CI. A package that imports both graphics libs now failslint.new-ecs-packageskill say where a new 3D package and its specs go.