Skip to content
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

feat: code cleanup #23

Merged
merged 4 commits into from
Oct 6, 2024
Merged
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
24 changes: 14 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Deploy to Github Pages
name: Deploy to Production Environment

on:
push:
branches:
- master
release:
types: [published]

jobs:
deploy:
name: Deploy to GH Pages
deploy-client:
name: Build and Deploy GitHub Pages
if: github.event.release.target_commitish == 'master'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@master
- name: Deploy
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: List files for publish
run: cd public && ls -l -a
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_dir: public
publish_branch: gh-pages
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# webgl-jsonloader

> Three.js model loader for 3d object (**.obj**) files.
> Three.js model loader for 3d object (**.obj**) files.

![screenshot](assets/screenshot2.png)

### Requirements

### Prerequisites
This project has no dependencies since it only contains static website files. Other local web servers that allow the hosting of static files are alternate options for local host development.

1. NodeJS
- node version 10.16.3
- npm version 6.9.0
2. Windows OS 64 bit
3. Web browser
- Chrome version 80.0.3987.149 (Official Build) (64-bit)
4. Three.js
1. Three.js
- version r114
- _(already included in the scripts folders)_
2. (Optional) Docker
- Required to run a Dockerized Node web server for local development


### Demo
Expand All @@ -23,22 +22,23 @@

## Installation

1. Clone this repository.
1. Clone this repository.<br>
`https://github.com/muonlineph/webgl-jsonloader.git`

2. Install dependencies.
`npm install`
2. Pull the local web server image (this requires Docker installed).<br>
`docker pull weaponsforge/livereload-basic:latest`

3. Run the local web server.
`npm run start`
3. Run the local web server. Navigate to the project root directory using a terminal, then run the local web server.<br>
`docker run -it --rm -p 3000:3000 -v %cd%\public:/opt/app/public -e IS_DOCKER=true -e USE_POLLING=true weaponsforge/livereload-basic:latest`

4. Load the webgl json loader from
4. Load the webgl json loader from<br>
`http://localhost:3000`

5. Load the basic-usage object loader demo from
5. Load the basic-usage object loader demo from<br>
`http://localhost:3000/simple.html`


6. Edit the existing static files from the **./public** directory and wait for live reload. Your updates will reflect on the web browser.

## Usage

Expand All @@ -47,10 +47,10 @@

> This is the recommended usage for rendering object models as all Three.js scenes are already set-up in the **Viewer** object.

1. Include the required Three.js files in your website (from the **/public/js** directory):
1. Include the required Three.js files in your website (from the **/public/js** directory):<br>
`three.min.js`, `DDSLoader.js`, `MTLLoader.js`, `TGALoader.js`, `OBJLoader.js`.

2. Include the custom loader and model viewer (from the **/public** directory):
2. Include the custom loader and model viewer (from the **/public** directory):<br>
`loader.js`, `viewer.js`

3. Load your object model(s) using **async-await**, but do not add them to the **scene**. See [**Object Loader (Basic Usage)**, #4]() for more usage information.
Expand All @@ -59,21 +59,21 @@
let b = await loadModel(...)
let c = await loadModel(...)

4. Initialize a new **Viewer** object with the loaded models from #1 as parameters.
4. Initialize a new **Viewer** object with the loaded models from #1 as parameters.<br>
`const viewer = new Viewer([a, b, c])`


### Object Loader (Basic Usage)

1. Include the required Three.js files in your website (from the **/public/js** directory):
1. Include the required Three.js files in your website (from the **/public/js** directory):<br>
`three.min.js`, `DDSLoader.js`, `MTLLoader.js`, `OBJLoader.js`.

2. Include the custom loader and model viewer (from the **/public** directory):
2. Include the custom loader and model viewer (from the **/public** directory):<br>
`loader.js`, `simple.js`

3. Initialize a ThreeJS scene, camera and renderer. See `public/simple.js` **init()** for more information.

4. Load ojbect model file(s) (.obj) and add to the ThreeJS scene with optional values for `position`, `rotation` and `scale`.
4. Load ojbect model file(s) (.obj) and add to the ThreeJS scene with optional values for `position`, `rotation` and `scale`.

let staff = await loadModel('objects/staffofkundun/', 'kundun-OBJ.mtl', 'kundun-OBJ.obj', {
position: { y:10 },
Expand All @@ -88,5 +88,6 @@



@weaponsforge
20200320
@weaponsforge<br>
20200320<br>
20241006
Binary file added assets/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions index.js

This file was deleted.

Loading