Skip to content

[ThreeJs] Add a new ux-threejs package to create/load 3D scene #2672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^11.1.6",
"@symfony/stimulus-testing": "^2.0.1",
"@types/three": "^0.174.0",
"@vitest/browser": "^2.1.1",
"lightningcss": "^1.28.2",
"playwright": "^1.47.0",
Expand Down
8 changes: 8 additions & 0 deletions src/Threejs/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.git* export-ignore
/.symfony.bundle.yaml export-ignore
/assets/src export-ignore
/assets/test export-ignore
/assets/vitest.config.js export-ignore
/doc export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
8 changes: 8 additions & 0 deletions src/Threejs/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Please do not submit any Pull Requests here. They will be closed.
---

Please submit your PR here instead:
https://github.com/symfony/ux

This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
20 changes: 20 additions & 0 deletions src/Threejs/.github/workflows/close-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Close Pull Request

on:
pull_request_target:
types: [opened]

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: |
Thanks for your Pull Request! We love contributions.

However, you should instead open your PR on the main repository:
https://github.com/symfony/ux

This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
6 changes: 6 additions & 0 deletions src/Threejs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/assets/node_modules/
/vendor/
/composer.lock
/phpunit.xml
/.phpunit.result.cache
/var/
3 changes: 3 additions & 0 deletions src/Threejs/.symfony.bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
branches: ["2.x"]
maintained_branches: ["2.x"]
doc_dir: "doc"
5 changes: 5 additions & 0 deletions src/Threejs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## 2.24.0

Create ux-threejs package
19 changes: 19 additions & 0 deletions src/Threejs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020-present Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
30 changes: 30 additions & 0 deletions src/Threejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Symfony UX Three.js

Symfony UX Three.js is a Symfony bundle integrating the [Three.js](https://threejs.org/)
library in Symfony applications. It is part of [the Symfony UX initiative](https://ux.symfony.com/).

**This repository is a READ-ONLY sub-tree split**. See
https://github.com/symfony/ux to create issues or submit pull requests.

## Sponsor

The Symfony UX packages are [backed][1] by [Mercure.rocks][2].

Create real-time experiences in minutes! Mercure.rocks provides a realtime API service
that is tightly integrated with Symfony: create UIs that update in live with UX Turbo,
send notifications with the Notifier component, expose async APIs with API Platform and
create low level stuffs with the Mercure component. We maintain and scale the complex
infrastructure for you!

Help Symfony by [sponsoring][3] its development!

## Resources

- [Documentation](https://symfony.com/bundles/ux-threejs/current/index.html)
- [Report issues](https://github.com/symfony/ux/issues) and
[send Pull Requests](https://github.com/symfony/ux/pulls)
in the [main Symfony UX repository](https://github.com/symfony/ux)

[1]: https://symfony.com/backers
[2]: https://mercure.rocks
[3]: https://symfony.com/sponsor
19 changes: 19 additions & 0 deletions src/Threejs/assets/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020-present Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
22 changes: 22 additions & 0 deletions src/Threejs/assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# @symfony/ux-threejs

JavaScript assets of the [symfony/ux-threejs](https://packagist.org/packages/symfony/ux-threejs) PHP package.

## Installation

This npm package is **reserved for advanced users** who want to decouple their JavaScript dependencies from their PHP dependencies (e.g., when building Docker images, running JavaScript-only pipelines, etc.).

We **strongly recommend not installing this package directly**, but instead install the PHP package [symfony/ux-threejs](https://packagist.org/packages/symfony/ux-threejs) in your Symfony application with [Flex](https://github.com/symfony/flex) enabled.

If you still want to install this package directly, please make sure its version exactly matches [symfony/ux-threejs](https://packagist.org/packages/symfony/ux-threejs) PHP package version:
```shell
composer require symfony/ux-threejs:2.23.0
npm add @symfony/[email protected]
```

## Resources

- [Documentation](https://symfony.com/bundles/ux-threejs/current/index.html)
- [Report issues](https://github.com/symfony/ux/issues) and
[send Pull Requests](https://github.com/symfony/ux/pulls)
in the [main Symfony UX repository](https://github.com/symfony/ux)
54 changes: 54 additions & 0 deletions src/Threejs/assets/dist/controller.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Controller } from '@hotwired/stimulus';
import * as THREE from 'three';
export type Material = {
color: string;
opacity: number;
map: string;
transparent: boolean;
type: string;
doubleSide: boolean;
skybox: boolean;
};
export type Mesh = {
geometry: any;
material: Material;
animation: any;
};
export type Light = {
type: String;
color: THREE.Color;
intensity: number;
position: THREE.Vector3;
target: THREE.Vector3;
};
export type Camera = {
type: String;
position: THREE.Vector3;
near: number;
far: number;
aspect: number;
fov: number;
top: number;
left: number;
right: number;
bottom: number;
};
export default class extends Controller {
threeValue: any;
static values: {
three: ObjectConstructor;
};
private renderer;
connect(): void;
createScene(data: any): void;
transform(object3D: THREE.Object3D, transformationData: any): any;
createMesh(meshData: Mesh, scene: THREE.Scene): THREE.Mesh;
createGeometry(geometryData: any): THREE.BufferGeometry;
createMaterial(materialData: Material): THREE.Material | undefined;
createLight(lightData: Light, scene: THREE.Scene): void;
createCamera(cameraData: Camera, renderer: THREE.WebGLRenderer): THREE.Camera;
setControls(controlCamera: THREE.Camera, renderer: THREE.WebGLRenderer): void;
createModel(modelData: any, scene: THREE.Scene): any;
private dispatchEvent;
threeValueChanged(): void;
}
Loading
Loading