Skip to content

Commit 167c161

Browse files
committed
Added main README, updated source README, and cleaned up other code.
1 parent a1e31bf commit 167c161

File tree

5 files changed

+63
-53
lines changed

5 files changed

+63
-53
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Program
2+
=======
3+
This program is based on the open-source
4+
[webgl-loader](http://code.google.com/p/webgl-loader/) project by Won
5+
Chun. It is based on r82 with many little additions to the converter. The
6+
output should be completely compatible with the original program. The
7+
objnormalize program was written by myself, and its functionality is now
8+
(in part) integrated into the original webgl-loader.
9+
10+
11+
Samples
12+
-------
13+
The samples directory contains a _very_ basic WebGL viewer for the
14+
produced models. It has problems with scale sometimes and does not show
15+
the backs of surfaces.
16+
17+
18+
Online Version
19+
--------------
20+
You can go to
21+
[webgl-tests.crbs.ucsd.edu/obj-viewer/](http://webgl-tests.crbs.ucsd.edu/obj-viewer/)
22+
for an online-usable version of the program.

samples/converter/obj2utf8-mini.bat

Lines changed: 0 additions & 21 deletions
This file was deleted.

samples/converter/obj2utf8.bat

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/README

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
1-
Usage: ./objcompress in.obj [out.utf8]
1+
Usage: ./objnormalize in.obj out.obj
22

3-
If 'out' is specified, then attempt to write out a compressed,
4-
UTF-8 version to 'out.'
3+
"Normalize" an obj file. This simply shifts all vertices so that
4+
the middle of the object is at (0,0,0). This is required for some
5+
viewing environments such as the open-3d-viewer and the included
6+
sample viewer.
7+
8+
Usage: ./objcompress [-w] in.obj out.utf8 >out.js
59

6-
If not, write a JSON version to STDOUT.
10+
Converts and compresses the OBJ file to the UTF8 format. The
11+
necessary JavaScript file is output onto STDOUT. If -w is included
12+
then all missing materials will be replaced with a bsaic solid
13+
white material. If not provided, any missing materials will cause
14+
the process to fail. The actual output file names are prepended
15+
with a hash of the file data. This is because a single OBJ file
16+
can include multiple models while an UTF8 file cannot.
717

8-
Usage: ./objanalyze in.obj [list of cache sizes]
9-
10-
Perform vertex cache analysis on in.obj using specified sizes.
11-
For example: ./objanalyze in.obj 6 16 24 32
12-
Maximum cache size is 32.
18+
objanalyze is non-functioning, other tools can be used for this purpose.
1319

1420
Building:
1521

1622
Since there are no external dependences outside of the C/C++ standard
17-
libraries, you can pretty much build this however you please. I've
18-
included a cheeky way to do this on POSIX-like systems by including a
23+
libraries, you can pretty much build this however you please. One compile
24+
option is using -D MINI_JS. When defined the output JavaScript will be
25+
minified.
26+
27+
I've included a cheeky way to do this on POSIX-like systems by including a
1928
build shell script at the top of the file itself. You can build by
2029
making the .cc file executable, and running it on the command line.
30+
31+
For Windows there is a build.bat script which will compile the code using
32+
mingw-w64. Make sure to have both the i686 and x86_64 builds installed.

src/objnormalize.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
#if 0 // A cute trick to making this .cc self-building from shell.
2+
g++ $0 -O2 -Wall -Werror -o `basename $0 .cc`;
3+
exit;
4+
#endif
5+
// Copyright 2011 Google Inc. All Rights Reserved.
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License"); you
8+
// may not use this file except in compliance with the License. You
9+
// may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16+
// implied. See the License for the specific language governing
17+
// permissions and limitations under the License.
18+
119
#define _CRT_SECURE_NO_WARNINGS
220

321
#include <stdlib.h>

0 commit comments

Comments
 (0)