-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wip @threepipe/plugin-blend-importer for parsing and importing .b…
…lend file and an example.
- Loading branch information
Showing
31 changed files
with
1,999 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Blend Load</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<!-- Import maps polyfill --> | ||
<!-- Remove this when import maps will be widely supported --> | ||
<script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script> | ||
|
||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"threepipe": "./../../dist/index.mjs", | ||
"@threepipe/plugin-blend-importer": "./../../plugins/blend-importer/dist/index.mjs" | ||
} | ||
} | ||
|
||
</script> | ||
<style id="example-style"> | ||
html, body, #canvas-container, #mcanvas { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0; | ||
overflow: hidden; | ||
} | ||
</style> | ||
<script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | ||
<script id="example-script" type="module"> | ||
import {_testFinish, ThreeViewer} from 'threepipe' | ||
import {BlendLoadPlugin} from '@threepipe/plugin-blend-importer' | ||
|
||
const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas')}) | ||
viewer.addPluginsSync([BlendLoadPlugin]) | ||
|
||
async function init() { | ||
|
||
await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | ||
const result = await viewer.load('https://asset-samples.threepipe.org/minimal/default-cube.blend', { | ||
autoCenter: true, | ||
autoScale: false, | ||
}) | ||
console.log(result) | ||
} | ||
|
||
init().then(_testFinish) | ||
</script> | ||
</head> | ||
<body> | ||
<div id="canvas-container"> | ||
<canvas id="mcanvas"></canvas> | ||
</div> | ||
|
||
</body> |
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "@threepipe/plugin-blend-importer", | ||
"description": "Basic importer for .blend file", | ||
"version": "0.0.1", | ||
"devDependencies": { | ||
}, | ||
"dependencies": { | ||
"threepipe": "file:./../../src/" | ||
}, | ||
"clean-package": { | ||
"remove": [ | ||
"clean-package", | ||
"scripts", | ||
"devDependencies", | ||
"//", | ||
"markdown-to-html" | ||
], | ||
"replace": { | ||
"dependencies": { | ||
"threepipe": "^0.0.13" | ||
} | ||
} | ||
}, | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"scripts": { | ||
"new:pack": "npm run prepare && clean-package && npm pack && clean-package restore", | ||
"new:publish": "npm run prepare && clean-package && npm publish --access public && clean-package restore", | ||
"prepare": "npm run build", | ||
"build": "rimraf dist && NODE_ENV=production rollup -c", | ||
"dev": "rollup -c -w", | ||
"docs": "rimraf docs && npx typedoc" | ||
}, | ||
"author": "repalash <palash@shaders.app>", | ||
"license": "Apache-2.0", | ||
"keywords": [ | ||
"three", | ||
"three.js", | ||
"threepipe", | ||
"editor", | ||
"plugin" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/repalash/threepipe/issues" | ||
}, | ||
"homepage": "https://github.com/repalash/threepipe#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/repalash/threepipe.git" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// rollup.config.js | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import json from '@rollup/plugin-json'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import license from 'rollup-plugin-license' | ||
import packageJson from './package.json' assert {type: 'json'}; | ||
import path from 'path' | ||
import {fileURLToPath} from 'url'; | ||
import postcss from 'rollup-plugin-postcss' | ||
import replace from '@rollup/plugin-replace' | ||
import terser from "@rollup/plugin-terser"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const {name, version, author} = packageJson | ||
// const {main, module, browser} = packageJson["clean-package"].replace | ||
const isProduction = process.env.NODE_ENV === 'production' | ||
|
||
const settings = { | ||
globals: { | ||
"three": "threepipe", | ||
"threepipe": "threepipe" | ||
}, | ||
sourcemap: true | ||
} | ||
|
||
export default { | ||
input: './src/index.ts', | ||
output: [ | ||
// { | ||
// file: main, | ||
// name: main, | ||
// ...settings, | ||
// format: 'cjs', | ||
// plugins: [ | ||
// isProduction && terser() | ||
// ] | ||
// }, | ||
{ | ||
file: './dist/index.mjs', | ||
...settings, | ||
name: name, | ||
format: 'es', | ||
plugins: [ | ||
isProduction && terser() | ||
] | ||
}, | ||
{ | ||
file: './dist/index.js', | ||
...settings, | ||
name: name, | ||
format: 'umd', | ||
plugins: [ | ||
isProduction && terser() | ||
] | ||
} | ||
], | ||
external: Object.keys(settings.globals), | ||
plugins: [ | ||
replace({ | ||
'from \'three\'': 'from \'threepipe\'', | ||
delimiters: ['', ''], | ||
}), | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}), | ||
postcss({ | ||
modules: false, | ||
autoModules: true, // todo; issues with typescript import css, because inject is false | ||
inject: false, | ||
minimize: isProduction, | ||
// Or with custom options for `postcss-modules` | ||
}), | ||
json(), | ||
resolve({}), | ||
typescript({ | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**', | ||
extensions: ['.js'], | ||
ignoreGlobal: false, | ||
sourceMap: false | ||
}), | ||
license({ | ||
banner: ` | ||
@license | ||
${name} v${version} | ||
Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||
${packageJson.license} License | ||
`, | ||
thirdParty: { | ||
output: path.join(__dirname, 'dist', 'dependencies.txt'), | ||
includePrivate: true, // Default is false. | ||
}, | ||
}) | ||
] | ||
} |
Oops, something went wrong.