summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/splash/index.js3
-rw-r--r--megapixels/commands/misc/obj2ply.py79
-rw-r--r--package.json4
-rw-r--r--site/assets/demo/splash/index.html46
-rw-r--r--webpack.config.dev.js2
-rw-r--r--webpack.splash.dev.js59
-rw-r--r--webpack.splash.prod.js50
7 files changed, 241 insertions, 2 deletions
diff --git a/client/splash/index.js b/client/splash/index.js
new file mode 100644
index 00000000..4fc7609c
--- /dev/null
+++ b/client/splash/index.js
@@ -0,0 +1,3 @@
+/* teaser page */
+
+console.log('hey..')
diff --git a/megapixels/commands/misc/obj2ply.py b/megapixels/commands/misc/obj2ply.py
new file mode 100644
index 00000000..e3e18e54
--- /dev/null
+++ b/megapixels/commands/misc/obj2ply.py
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+
+"""
+Convert an OBJ 3D model (with vertex color) to a PLY file, which can be read by the draco_encoder.
+"""
+
+import click
+
+@click.command()
+@click.add_argument('--float_colors', action='store_true', help='pass if RGB colors are floats, not ints, in the obj')
+@click.add_argument('--unwind', action='store_true', help='pass to reverse winding order on faces (if surface normals are upside down)')
+@click.add_argument('--flip_y', action='store_true', help='flip Y axis')
+@click.add_argument('-i', '--input_fn', required=True, help='input OBJ filename')
+@click.add_argument('-o', '--output_fn', help='output PLY filename')
+@click.pass_context
+def cli(ctx, float_colors, unwind, flip_y, input_fn, output_fn):
+ """
+ click command for converting OBJ to PLY
+ """
+
+ ply_header = """ply
+ format ascii 1.0
+ element vertex {}
+ property float x
+ property float y
+ property float z
+ property uchar red
+ property uchar green
+ property uchar blue
+ element face {}
+ property list uchar int vertex_index
+ end_header
+ """
+
+ if output_fn is None:
+ output_fn = input_fn.replace('.obj', '.ply')
+
+ with open(input_fn, 'r') as f:
+ i = 0
+ vertexes = []
+ faces = []
+ for line in f.readlines():
+ N = line.strip().split(' ')
+ if N[0] == 'v':
+ if flip_y:
+ N[2] = str(float(N[2]) * -1)
+ if float_colors:
+ vertexes.append([
+ N[1],
+ N[2],
+ N[3],
+ str(int(255 * float(N[4]))),
+ str(int(255 * float(N[5]))),
+ str(int(255 * float(N[6]))),
+ ])
+ else:
+ vertexes.append(N[1:])
+ if N[0] == 'f':
+ if unwind:
+ faces.append([
+ "3",
+ str(int(N[3]) - 1),
+ str(int(N[2]) - 1),
+ str(int(N[1]) - 1),
+ ])
+ else:
+ faces.append([
+ "3",
+ str(int(N[1]) - 1),
+ str(int(N[2]) - 1),
+ str(int(N[3]) - 1),
+ ])
+
+ with open(output_fn, 'w') as out_file:
+ out_file.write(ply_header.format(len(vertexes), len(faces)))
+ for v in vertexes:
+ out_file.write(" ".join(v) + "\n")
+ for f in faces:
+ out_file.write(" ".join(f) + "\n")
diff --git a/package.json b/package.json
index d007cf2e..bcd22bd0 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,9 @@
"watch": "NODE_ENV=development webpack --config ./webpack.config.dev.js --colors --watch",
"buildDev": "NODE_ENV=development webpack --config ./webpack.config.dev.js --colors",
"build": "NODE_ENV=production webpack --config ./webpack.config.prod.js",
- "deploy": "NODE_ENV=production webpack --config ./webpack.config.prod.js && git commit -am 'deploy' && git push origin master && ssh vframe@vframe ./restart.sh"
+ "deploy": "NODE_ENV=production webpack --config ./webpack.config.prod.js && git commit -am 'deploy' && git push origin master && ssh vframe@vframe ./restart.sh",
+ "watchSplash": "NODE_ENV=development webpack --config ./webpack.splash.dev.js --colors --watch",
+ "buildSplash": "NODE_ENV=production webpack --config ./webpack.splash.prod.js"
},
"repository": {
"type": "git",
diff --git a/site/assets/demo/splash/index.html b/site/assets/demo/splash/index.html
new file mode 100644
index 00000000..292bff28
--- /dev/null
+++ b/site/assets/demo/splash/index.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<html>
+<head>
+ <title>MegaPixels</title>
+ <meta charset="utf-8" />
+ <meta name="author" content="info@megapixels.cc" />
+ <meta name="description" content="The Dark Side of Datasets" />
+ <meta name="referrer" content="no-referrer" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+ <link rel='stylesheet' href='/assets/css/fonts.css' />
+ <link rel='stylesheet' href='/assets/css/css.css' />
+ <link rel='stylesheet' href='/assets/css/splash.css' />
+</head>
+<body>
+ <header>
+ <a class='slogan' href="/">
+ <div class='logo'></div>
+ <div class='site_name'>MegaPixels</div>
+ </a>
+ <div class='links'>
+ <a href="/datasets/">Datasets</a>
+ <a href="/research/">Research</a>
+ <a href="/about/">About</a>
+ </div>
+ </header>
+ <div class="content">
+
+
+ </div>
+ <footer>
+ <div>
+ <a href="/">MegaPixels.cc</a>
+ <a href="/about/disclaimer/">Disclaimer</a>
+ <a href="/about/terms/">Terms of Use</a>
+ <a href="/about/privacy/">Privacy</a>
+ <a href="/about/">About</a>
+ <a href="/about/team/">Team</a>
+ </div>
+ <div>
+ MegaPixels &copy;2017-19 Adam R. Harvey /&nbsp;
+ <a href="https://ahprojects.com">ahprojects.com</a>
+ </div>
+ </footer>
+</body>
+<script src="/assets/js/dist/splash.js"></script>
+</html> \ No newline at end of file
diff --git a/webpack.config.dev.js b/webpack.config.dev.js
index 4137a948..504e7cc7 100644
--- a/webpack.config.dev.js
+++ b/webpack.config.dev.js
@@ -11,7 +11,7 @@ module.exports = {
},
output: {
path: path.resolve(__dirname, 'site/assets/js/dist'),
- filename: 'index.js'
+ filename: 'index.js',
},
devtool: 'inline-source-map',
resolve: {
diff --git a/webpack.splash.dev.js b/webpack.splash.dev.js
new file mode 100644
index 00000000..374630a7
--- /dev/null
+++ b/webpack.splash.dev.js
@@ -0,0 +1,59 @@
+require('dotenv').config()
+
+// const HtmlWebpackPlugin = require('html-webpack-plugin')
+// const CleanWebpackPlugin = require('clean-webpack-plugin')
+const webpack = require('webpack')
+const path = require('path')
+
+module.exports = {
+ entry: {
+ main: './client/splash/index.js'
+ },
+ output: {
+ path: path.resolve(__dirname, 'site/assets/js/dist'),
+ filename: 'splash.js'
+ },
+ devtool: 'inline-source-map',
+ plugins: [
+ // new CleanWebpackPlugin(['dist']),
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': '"development"',
+ 'process.env.S3_HOST': '"' + process.env.S3_HOST + '"',
+ 'process.env.API_HOST': '""',
+ }),
+ // new HtmlWebpackPlugin({
+ // title: 'VFrame Metadata',
+ // meta: {
+ // viewport: 'width=device-width,initial-scale=1.0'
+ // }
+ // }),
+ // new webpack.HotModuleReplacementPlugin()
+ ],
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: ['style-loader', 'css-loader']
+ },
+ {
+ test: /\.js$/,
+ // include: path.resolve(__dirname, 'client'),
+ exclude: /(node_modules|bower_components|build)/,
+ use: {
+ loader: 'babel-loader',
+ options: {
+ presets: ['env'],
+ plugins: [
+ require('babel-plugin-transform-runtime'),
+ require('babel-plugin-transform-es2015-arrow-functions'),
+ require('babel-plugin-transform-object-rest-spread'),
+ require('babel-plugin-transform-class-properties'),
+ require('babel-plugin-transform-react-jsx'),
+ require('react-hot-loader/babel')
+ ]
+ }
+ }
+ }
+ ]
+ }
+};
diff --git a/webpack.splash.prod.js b/webpack.splash.prod.js
new file mode 100644
index 00000000..78359a8c
--- /dev/null
+++ b/webpack.splash.prod.js
@@ -0,0 +1,50 @@
+require('dotenv').config()
+
+const webpack = require('webpack')
+const path = require('path')
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
+// const CleanWebpackPlugin = require('clean-webpack-plugin')
+
+module.exports = {
+ entry: {
+ main: './client/splash/index.js',
+ },
+ output: {
+ path: path.resolve(__dirname, 'site/assets/js/dist'),
+ filename: 'splash.js',
+ },
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': '"production"',
+ 'process.env.S3_HOST': '"' + process.env.S3_HOST + '"',
+ 'process.env.API_HOST': '""',
+ }),
+ new UglifyJsPlugin(),
+ new webpack.optimize.AggressiveMergingPlugin()
+ ],
+ devtool: 'inline-source-map',
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: ['style-loader', 'css-loader']
+ },
+ {
+ test: /\.js$/,
+ // include: path.resolve(__dirname, 'client'),
+ exclude: /(node_modules|bower_components|build)/,
+ loader: 'babel-loader',
+ options: {
+ presets: ['env'],
+ plugins: [
+ require('babel-plugin-transform-runtime'),
+ require('babel-plugin-transform-es2015-arrow-functions'),
+ require('babel-plugin-transform-object-rest-spread'),
+ require('babel-plugin-transform-class-properties'),
+ require('babel-plugin-transform-react-jsx'),
+ ]
+ }
+ }
+ ]
+ },
+};