tresjs / cientos Goto Github PK
View Code? Open in Web Editor NEWCollection of useful helpers and fully functional, ready-made abstractions for TresJS
Home Page: https://cientos.tresjs.org/
License: MIT License
Collection of useful helpers and fully functional, ready-made abstractions for TresJS
Home Page: https://cientos.tresjs.org/
License: MIT License
Vue 3.3.4 added an experimental feature called propsDeconstruct allowing us to dispense withDefaults
in favor of a more natural deconstruction that keeps the reactivity.
const { args = [1, 1, 1], color = '0xffffff' } = defineProps<{
args?: ConstructorParameters<typeof BoxGeometry>
color?: TresColor
}>()
As of now, the following components has been updated, we need to update the rest
No response
No response
Using ScrollControls on the Nuxt playground gets broken
https://deploy-preview-52--tresjs-playground.netlify.app/experiments/scroll-controls
No response
System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M1 Pro
Memory: 100.84 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.14.1 - ~/.nvm/versions/node/v18.14.1/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v18.14.1/bin/npm
Browsers:
Brave Browser: 114.1.52.130
Chrome: 114.0.5735.198
Firefox: 114.0.2
Safari: 16.5.1
npmPackages:
@tresjs/cientos: 2.3.0 => 2.3.0
@tresjs/core: ^2.4.0 => 2.4.0
@tresjs/nuxt: 1.0.0 => 1.0.0
@tresjs/post-processing: ^0.3.0 => 0.3.0
pnpm
Floating component similar https://github.com/pmndrs/drei/blob/master/src/core/Float.tsx
Is your feature request related to a problem? Please describe.
In order to create a real first person shooter control, in combination with the PointerLock Controls or any other Mesh that you want to move
const map = [
{ name: Controls.forward, keys: ['ArrowUp', 'KeyW'] },
{ name: Controls.back, keys: ['ArrowDown', 'KeyS'] },
{ name: Controls.left, keys: ['ArrowLeft', 'KeyA'] },
{ name: Controls.right, keys: ['ArrowRight', 'KeyD'] },
{ name: Controls.jump, keys: ['Space'] },
]
<KeyboardControls map={map}>
<PointerLockControls/> // here could be a Mesh or a Camera
</KeyboardControls>
Describe the solution you'd like
Abstraction in Cientos
Suggested solution
Check drei implementation
Additional context
Add any other context or screenshots about the feature request here.
Using <Environment />
from cientos gives several errors on the console, probably related to the color space breaking change from ThreeJS v152.
Don't rely on the reproduction
https://stackblitz.com/edit/tresjs-basic-o2zzmn?file=src%2Fcomponents%2FTheExperience.vue
Check the console
System:
OS: macOS 13.2.1
CPU: (8) arm64 Apple M1 Pro
Memory: 93.86 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.14.1 - ~/.nvm/versions/node/v18.14.1/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v18.14.1/bin/npm
npmPackages:
@tresjs/cientos: 2.1.2 => 2.1.1
@tresjs/core: 2.1.2 => 2.1.2
@tresjs/post-processing: ^0.1.0 => 0.1.0
pnpm
Is your feature request related to a problem? Please describe.
A Particle abstraction implementation is one abstraction that helps a user to create stars in the sky, sparkles, etc
<Particles :amount="1" :texture"MYCUSTOMTEXTURE" :depth="0.4" :speed="10" />
Describe the solution you'd like
Abstraction in Cientos
Suggested solution
Check drei [implementation](https://github.com/pmndrs/drei/blob/master/src/core/Cloud.tsx)
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
GLTF Model is trying to return the model by ref before the variable is initialized on model load
Reproduction
Reproduction
Expected behavior
Error on console disappears and model is returned successfully via templateref
System Info
Output of npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers
System:
OS: Linux 5.0 undefined
CPU: (5) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@tresjs/cientos: ^2.0.0-alpha.0 => 2.0.0-alpha.1
@tresjs/core: ^2.0.0-alpha.0 => 2.0.0-alpha.1
vite: ^3.2.4 => 3.2.5
Same as Tresjs/tres#269 in cientos
Adapt cientos
package to Tresjs/tres#331 changes
No response
No response
Add a lint-pr.yaml
to the CI/CD to check quality of PRs using https://github.com/amannn/action-semantic-pull-request
feat(ui): Add `Button` component
^ ^ ^
| | |__ Subject
| |_______ Scope
|____________ Type
name: "Lint PR"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Describe the bug
GLTF Model is not loading and rendering the model
Reproduction
Reproduction
Steps
Steps to reproduce the behavior:
Expected behavior
GLTFModel renders the model
Screenshots
If applicable, add screenshots to help explain your problem.
System Info
Output of npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers
System:
OS: Linux 5.0 undefined
CPU: (5) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@tresjs/cientos: ^2.0.0-alpha.0 => 2.0.0-alpha.0
@tresjs/core: ^2.0.0-alpha.0 => 2.0.0-alpha.0
vite: ^3.2.4 => 3.2.5
Additional context
Add any other context about the problem here.
Blank page and possible memory leak
For more options on outside environment
https://github.com/pmndrs/drei#sky
No response
No response
Is your feature request related to a problem? Please describe.
Shining floors everywhere!!
Describe the solution you'd like
Same concept as R3F Drei https://github.com/pmndrs/drei#meshreflectormaterial
Suggested solution
Shaders
Good controls for presentation purposes
https://github.com/pmndrs/drei#presentationcontrols
No response
No response
When the mouse wheel is used, this error occurs all the time, causing the scene to fail to zoom
No response
No response
npm
Is your feature request related to a problem? Please describe.
A Clouds (or smoke) implementation, is one abstraction that helps a user to create smoking effect
<Clouds :opacity="1" :texture"MYCUSTOMTEXTURE" :speen="0.4" :segments="10" color="#000000" />
Describe the solution you'd like
Abstraction in Cientos
Suggested solution
Check drei implementation
Additional context
Add any other context or screenshots about the feature request here.
As a developer using TresJS, I want
so that:
background
propertyModify the useEnvironment/component.ts
component so:
Modify the useEnvironment/index.ts
composable so:
No response
No response
Move cientos
docs here
Describe the bug
Setting position
on GLTFModel doesn't seem to work. Must probably forgot to pass down the props to the mesh
Reproduction
Please provide a link using this template on Stackblitz
Steps
Steps to reproduce the behavior:
position
to the Expected behavior
The model should translate to the provided position
System Info
Output of npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@tresjs/cientos: ^1.0.0 => 1.0.0
@tresjs/core: ^1.0.0 => 1.0.0
vite: ^3.2.4 => 3.2.4
Additional context
Add any other context about the problem here.
If a good name pam-camera-mouse?
And should we move to the controls sections in the docs?
Something seems broken with the MouseParallax abstraction
Uncaught (in promise) TypeError: 'set' on proxy: trap returned falsish for property 'args'
https://playground.tresjs.org/experiments/mouse-parallax
No response
No response
pnpm
There is a problem in the docs with the MeshWobbleMaterial.
I can't access to it, nor in local
https://cientos.tresjs.org/guide/materials/wobble-material.html
Go to https://cientos.tresjs.org/guide/materials/wobble-material.html
Brave browser
pnpm
Is your feature request related to a problem? Please describe.
Continuing with the controls abstraction, will be useful to add MapControls to cientos catalog
Describe the solution you'd like
Suggested solution
Similar to other controls already implemented
Describe the bug
Text3D component comes with two main problems
Reproduction
Please provide a link using this template on Stackblitz
Steps
Steps to reproduce the behavior:
Expected behavior
One mesh should be added to the scene
System Info
Output of npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers
Is your feature request related to a problem? Please describe.
Atm is possible to set the loading screen with the async behavior, ex when a model is being loaded, but not to access all the information that the callback provides.
const loadingManager = new THREE.LoadingManager(
// ...
// Progress
(itemUrl, itemsLoaded, itemsTotal) =>
{
console.log(itemUrl, itemsLoaded, itemsTotal)
}
)
Describe the solution you'd like
A composable that wraps THREE.DefaultLoadingManager's progress status.
https://github.com/pmndrs/drei/blob/master/src/core/useProgress.tsx
I used the component OrbitControls๏ผ
But set enableDamping, the controls has no damping
https://stackblitz.com/edit/tresjs-basic-krexte?file=src%2Fcomponents%2FTheExperience.vue
No response
No response
npm
Some shapes have problems with colors
https://stackblitz.com/edit/tresjs-basic-1skx4b?file=src%2Fcomponents%2FTheExperience.vue
Check the console on the reprodution link
pnpm
npm
Is your feature request related to a problem? Please describe.
Currently, there is no straightforward way to tie HTML content to any object of a TresJS scene and have it projected to the object's whereabouts automatically. This feature would be useful for users who want to create rich, interactive 3D scenes with HTML content that moves and scales along with the 3D objects.
Describe the solution you'd like
I would like to have a new HTML component that allows users to tie HTML content to any object in their TresJS scene. The component should support a variety of properties for customization, such as the wrapping element, className, positioning, scaling, occlusion, and more.
Suggested solution
In the TresJS library, we could provide the following implementation as a Vue component:
<template>
<Html
:as="'div'"
:wrapperClass="wrapperClass"
:prepend="prepend"
:center="center"
:fullscreen="fullscreen"
:distanceFactor="10"
:zIndexRange="[100, 0]"
:portal="domnodeRef"
:transform="transform"
:sprite="sprite"
:calculatePosition="calculatePosition"
:occlude="occlude"
:onOcclude="onOcclude"
v-bind="groupProps"
v-bind="divProps"
>
<h1>hello</h1>
<p>world</p>
</Html>
</template>
<script>
import { Html } from 'path/to/html-component';
export default {
components: {
Html,
},
// ...
};
</script>
This implementation should cover the desired features and provide users with the ability to create dynamic 3D scenes with HTML content.
https://github.com/pmndrs/drei/blob/master/src/web/Html.tsx
This feature is inspired by the React Three Fiber (R3F) library, which provides a similar functionality for React users. Implementing this feature in TresJS would allow Vue developers to achieve the same level of interactivity and customization in their 3D scenes.
Add similar to these ones on the core https://github.com/Tresjs/tres/blob/main/.github/ISSUE_TEMPLATE/bug_report.yml?plain=1
I'm trying to change the direction of the scrolling to horizontal when progress > 0.5
like this:
<ScrollControls ref="scRef"
v-model="progress"
:distance="10"
:smooth-scroll="0.1"
html-scroll
:horizontal="progress > 0.5"
>
but props are not reactive
https://stackblitz.com/edit/stackblitz-starters-jq66po?file=src%2Fcomponents%2FTheExperience.vue
Scroll until the point that horizontal should be true
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.20.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.6.3 - /usr/local/bin/pnpm
npmPackages:
@tresjs/cientos: 2.3.0 => 2.3.0
@tresjs/core: 2.4.0 => 2.4.0
vite: ^4.4.3 => 4.4.3
pnpm
Is your feature request related to a problem? Please describe.
Currently, TresJS does not provide a built-in material that allows geometry to wobble and wave around. This feature would be useful for users who want to create visually appealing and dynamic 3D scenes with unique effects on their geometry.
Describe the solution you'd like
I would like to have a new MeshWobbleMaterial component that allows users to apply a wobble and wave effect on their geometry. The material should be self-contained and adapted from the three.js examples.
https://github.com/pmndrs/drei/blob/master/src/core/MeshWobbleMaterial.tsx
Suggested solution
In the TresJS library, we could provide the following implementation as a Vue component:
<TresMesh>
<TresBoxGeometry :args="[1,1,1]" />
<MeshWobbleMaterial factor="1" speed="10" />
</TresMesh>
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
In order to update the textGeometry and have the v-model "reactive text" effect I propose adding a new needsUpdate prop
Example:
Suggested solution
To achieve this effect we need to listen to changes in the text prop and when it changes, trigger a dispose() method in the current geometry. I have done this with "watch", but for perfomance reasons it could be better to try with computed()
Also if needsUpdate prop is set to false (default value), we just skip the listen and render the plain text
Additional context
When using OrbitControls, the scene freezes unrecoverably.
No response
pnpm
We can create a wrapper using extend to add CSM and apply shaders to other materials, as we can see in that example. We're applying vertex shader to a physical material using the glass demo,
a wrapper around https://www.npmjs.com/package/three-custom-shader-material
I don't know if there are another alternatives, but CSM is one of the most used
The Idea is to create just a wrapper
To allow users to easily load video as a texture
https://github.com/pmndrs/drei#usevideotexture
No response
No response
Is your feature request related to a problem? Please describe.
We should have a CameraControls component as it is a very handy tool.
Describe the solution you'd like
Abstraction in cientos.
Suggested solution
See drei.
Clicking on examples lands on 404 page not found.
https://cientos.tresjs.org/examples.html
No response
No response
npm
Pointerlock + Keyboard is not respecting the initial camera position
Transition between initial camera position and pointerlock
should be seamless
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.20.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.6.3 - /usr/local/bin/pnpm
npmPackages:
@tresjs/cientos: 2.2.0 => 2.2.0
@tresjs/core: 2.4.0 => 2.4.0
vite: ^4.3.9 => 4.3.9
pnpm
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/lint-pr.yml
amannn/action-semantic-pull-request v5
.github/workflows/lint.yml
actions/checkout v4
pnpm/action-setup v2
actions/setup-node v4
ubuntu 20.04
docs/package.json
@tresjs/leches ^0.14.0
markdown-it ^14.0.0
unocss ^0.59.4
vite-svg-loader ^5.1.0
package.json
@tresjs/core 3.9.0
@vueuse/core ^10.9.0
camera-controls ^2.8.3
stats-gl ^2.2.8
stats.js ^0.17.0
three-custom-shader-material ^5.4.0
three-stdlib ^2.29.11
@release-it/conventional-changelog ^8.0.1
@tresjs/core ^3.2.1
@tresjs/eslint-config ^1.1.0
@tweakpane/core ^1.1.9
@types/node ^20.12.10
@types/three ^0.164.0
@typescript-eslint/eslint-plugin ^7.8.0
@typescript-eslint/parser ^7.8.0
@vitejs/plugin-vue ^5.0.4
eslint ^9.1.1
eslint-plugin-vue ^9.25.0
gsap ^3.12.5
husky ^9.0.11
kolorist ^1.8.0
pathe ^1.1.2
release-it ^17.2.1
rollup-plugin-analyzer ^4.0.0
rollup-plugin-visualizer ^5.12.0
three ^0.164.1
tweakpane ^3.1.10
typescript ^5.4.5
unocss ^0.59.4
vite ^5.2.11
vite-plugin-banner ^0.7.1
vite-plugin-dts 3.9.1
vite-plugin-glsl ^1.3.0
vite-svg-loader ^5.1.0
vitepress 1.1.4
@tresjs/core >=3.2
three >=0.133
tweakpane >=3.0.0
vue >=3.3
pnpm 8.10.2
playground/package.json
@tresjs/core 3.9.0
vue-router ^4.2.5
@tresjs/leches ^0.14.0
unplugin-auto-import ^0.17.5
unplugin-vue-components ^0.27.0
vite-plugin-glsl ^1.2.1
vite-plugin-qrcode ^0.2.3
vue-tsc ^2.0.16
Is your feature request related to a problem? Please describe.
We can implement a rain abstraction where particles flow to infinity. This effect works also for snow effect and even for beam
Describe the solution you'd like
Examples here:
https://github.com/PacktPublishing/Learn-Three.js-Fourth-edition/blob/main/source/samples/chapters/chapter-7/rain.js
https://github.com/PacktPublishing/Learn-Three.js-Fourth-edition/blob/main/source/samples/chapters/chapter-7/snow.js
Suggested solution
Additional context
I would like feedback about this specific feature, name and props
Provide memory destruction for useGLTF's dracoloader
When using routing to exit the page, the instance of dracoLoader will always occupy memory
Inside the useGLTF file
export function useDracoLoaderDispose() {
dracoLoader?.dispose()
dracoLoader = null
}
No response
none
Is your feature request related to a problem? Please describe.
packages/cientos/core/OrbitControls.vue
offers limited props
export interface OrbitControlsProps {
/**
* Whether to make this the default controls.
*
* @default false
* @type {boolean}
* @memberof OrbitControlsProps
* @see https://threejs.org/docs/#examples/en/controls/OrbitControls
*/
makeDefault?: boolean
/**
* The camera to control.
*
* @type {Camera}
* @memberof OrbitControlsProps
* @see https://threejs.org/docs/#examples/en/controls/OrbitControls
*/
camera?: Camera
/**
* The dom element to listen to.
*
* @type {HTMLElement}
* @memberof OrbitControlsProps
* @see https://threejs.org/docs/#examples/en/controls/OrbitControls
*/
domElement?: HTMLElement
/**
* The target to orbit around.
*
* @type {Ref<Vector3>}
* @memberof OrbitControlsProps
* @see https://threejs.org/docs/#examples/en/controls/OrbitControls
*/
target?: Ref<Vector3>
/**
* Whether to enable damping.
*
* @default false
* @type {boolean}
* @memberof OrbitControlsProps
* @see https://threejs.org/docs/#examples/en/controls/OrbitControls
*/
enableDamping?: boolean
}
Describe the solution you'd like
The ThreeJS OrbitControls has way more features and properties we could support
Suggested solution
Add rest of the properties to abstraction
Additional context
Add any other context or screenshots about the feature request here.
Check if we can avoid deep exposure .value.value
The first step for making the first person control is to add the pointer lock control abstraction.
The abstraction should be put in Cientos, and slots can be used for the initial button trigger.
For this abstraction, we only need the composable and the component with:
very simple props: camera, domElement
some events: lock, unlock, change (this are provide by the browser)
some methods: moveForward, moveRight, getDirection, isLocked, etc
a logger that indicates or prevents the use of other controls at the same time
Then we can create a composable for first-person control or more elaborate examples.
Is your feature request related to a problem? Please describe.
A contact shadow implementation, facing upwards (positive Y) by default. scale can be a positive number or a 2D array [x: number, y: number].
<ContactShadows opacity="1" scale="10" blur="1" far="10" resolution="256" color="#000000" />
Since this is a rather expensive effect you can limit the number of frames it renders when your objects are static. For instance, making it render only once:
<ContactShadows frames="1" />
Describe the solution you'd like
Abstraction in cientos
Suggested solution
Check drei implementation
Additional context
Add any other context or screenshots about the feature request here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.