-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
87 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"texture": {"w": 64, "h": 64}, | ||
"locals": { | ||
"x": 0, | ||
"y": 0, | ||
"z": 0 | ||
}, | ||
"right": { | ||
"texture": {"u": 12, "v": 16}, | ||
"offset": ["#x", "#y", "#z"], | ||
"cubes": [ | ||
{ "from": [-4, -8, -1], "size": [2, 2, 2] }, | ||
{ "from": [-3.5, -8.49, -1.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 3} }, | ||
{ "from": [-2.998, -8.49, -2.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 5} } | ||
] | ||
}, | ||
"left": { | ||
"texture": {"u": 12, "v": 16}, | ||
"offset": ["#x", "#y", "#z"], | ||
"mirror": true, | ||
"cubes": [ | ||
{ "from": [2, -8, -1], "size": [2, 2, 2] }, | ||
{ "from": [2.5, -8.49, -1.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 3} }, | ||
{ "from": [1.998, -8.49, -2.001], "size": [1, 1, 1], "texture": {"u": 0, "v": 5} } | ||
] | ||
} | ||
} |
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,60 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta content="text/html; charset=utf-8" http-equiv="Content-type"> | ||
<script type="text/javascript" src="../src/obj_utils.js"></script> | ||
<script type="text/javascript" src="../src/incomplete.js"></script> | ||
<script type="text/javascript" src="../src/mson_loader.js"></script> | ||
<script type="text/javascript" src="../src/fixtures.js"></script> | ||
<script type="text/javascript" src="../src/mson_vanilla.js"></script> | ||
<script type="text/javascript" src="../src/mson_more.js"></script> | ||
<style> | ||
html, body { | ||
height: 100%; | ||
width: 100%; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
div { | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
textarea { | ||
flex-grow: 1; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<input id="model_name" type="text"></input> | ||
<textarea id="model_input"></textarea> | ||
<button id="add_model">Add File</button> | ||
<button id="get_model">Get Model</button> | ||
<textarea id="output"></textarea> | ||
</div> | ||
<script type="text/javascript"> | ||
const modelNameIn = document.body.querySelector('#model_name'); | ||
const input = document.body.querySelector('#model_input'); | ||
const output = document.body.querySelector('#output'); | ||
let loader = Mson.createLoader(); | ||
function handled(func) { | ||
try { | ||
func(); | ||
} catch (e) { | ||
output.value = e; | ||
console.error(e); | ||
} | ||
} | ||
document.body.querySelector('#add_model').addEventListener('click', () => { | ||
handled(() => loader.addFile(modelNameIn.value, input.value)); | ||
}); | ||
document.body.querySelector('#get_model').addEventListener('click', () => { | ||
handled(() => output.value = JSON.stringify(loader.getModel(modelNameIn.value), null, ' ')); | ||
}); | ||
// Damn coRs | ||
// fetch('input.json').then(a => a.text()).then(a => input.value = a); | ||
|
||
</script> | ||
</body> | ||
</html> |