Browse Source

initial commit

master
Victor Giers 3 years ago
commit
89227c151a

BIN
PlayerCharacter.bin View File


+ 1
- 0
PlayerCharacter.gltf
File diff suppressed because it is too large
View File


BIN
img/splashscreen.jpg View File


+ 25
- 0
painted_world.css View File

@@ -0,0 +1,25 @@
body {
font-family: Monospace;
background-color: #222222;
margin: 0px;
overflow: hidden;
}


#container {
background-image: url('img/splashscreen.jpg');
margin: 50px auto;
width:1024px;
height:768px;
}

.v3d-canvas {
position:inherit;
}

#overlay{
background-color: rgba(0,0,0,0);
z-index: 2;
width: inherit;
height: inherit;
}

+ 23
- 0
painted_world.html View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>

<html>
<head>
<title>Painted World</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="author" content="Victor Giers">
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="painted_world.css">
</head>

<body>
<div id="container"><div id="overlay"></div></div>

<script src="v3d.js"></script>
<script src="painted_world.js"></script>
</body>

</html>

+ 240
- 0
painted_world.js View File

@@ -0,0 +1,240 @@
'use strict';

var ctxSettings = {};
ctxSettings.alpha = true;
ctxSettings.preserveDrawingBuffer = true;
var app = new v3d.App('container', ctxSettings, null);
app.clearBkgOnLoad = true;
app.renderer.setClearColor(0x000000, 0);
app.renderCallbacks.push(renderCb);
app.compileCallbacks.push(compileCb);
var pause = false, loading = false;

function compileCb(){
dof(0.0,200, 0.025, 1);
bloom(7.5, 0.2, 0.4);
}

var controllerMatrix;

app.loadScene('PlayerCharacter.gltf', function() {
app.run();

//app.enableControls();
controllerCam = app.scene.children.find(controllerCam => controllerCam.name == 'ControllerCam');
playerCharacter = app.scene.children.find(playerCharacter => playerCharacter.name == "PlayerRig");


switchField('s1', 'f1', 'sp1');
mainMenu = false;
});

$('document').ready(function(){
// switchField('s1', 'f1', 'sp1');
// mainMenu = false;
});


//var movingLeft, movingRight, movingUp, movingDown;
let mainMenu = true;
var playerCharacter;
var controllerCam;
var upDirector;
var groundPlane;
var fieldScene, fieldCollider, fieldPortals, fieldCamera;
var movementSpeed = 0.05;
let PI = 3.1416;
//var finishedLoading = false;

var playerPosition = new v3d.Vector3();
var nextPosition = new v3d.Vector3();

var colliderBoxes = [];
var portalBoxes = [];

function collides(vector){
/*
for(var i = 0; i < portalBoxes.length; i++){
if(portalBoxes[i].containsPoint(vector)){
var target = fieldPortals[i].userData.v3d.customProps.target.split(/[$-/:-?{-~!"^_`\[\]]/gi);
console.log(target[0] + " " + target[1] + " " + target[2]);
if(!loading){
switchField(target[0], target[1], target[2]);
return false;
}
}
}
*/
var collides = false;
colliderBoxes.forEach(function(box){
if(box.containsPoint(vector)){
collides = true;
}
});
return collides;
}

function renderCb(){
if(playerCharacter != undefined){
playerPosition.set(playerCharacter.position.x, playerCharacter.position.y-1.75, playerCharacter.position.z);
//if(finishedLoading){
for(var i = 0; i < portalBoxes.length; i++){
if(portalBoxes[i].containsPoint(playerPosition) && !loading){
loading = true;
var target = fieldPortals[i].userData.v3d.customProps.target.split(/[$-/:-?{-~!"^_`\[\]]/gi);
console.log(target[0] + " " + target[1] + " " + target[2]);
switchField(target[0], target[1], target[2]);
//finishedLoading = false;
//return false;
}
}
}
}

function switchField(scene, field, spawnpoint) {
//pause = true;


if(app.controls != undefined){
app.controls.dispose();
//app.unload(app.camera);
}

//controllerCam.position.set(0,1.75,0);
//controllerCam.applyMatrix4(controllerMatrix);
//playerCharacter

var fieldName = scene + field;
var fieldURI = "scenes/" + fieldName + "/" + fieldName + ".gltf";
var bgimageURI = "scenes/" + fieldName + "/" + fieldName + "_bg.png";

if(fieldScene != undefined){
app.setCamera(controllerCam);
app.unload(fieldScene);
}

app.appendScene(fieldURI, function(){
$("#container").css("background-image", "url(" + bgimageURI + ")");
$('#overlay').hide();

fieldScene = app.scene.children.find(fieldScene => fieldScene.name == 'Scene');

groundPlane = fieldScene.children.find(groundPlane => groundPlane.name == 'Ground');

console.log(fieldScene);

fieldCollider = fieldScene.children.filter(fieldCollider => fieldCollider.groupNames.includes('Collider'));
colliderBoxes = [];
for (let i = 0; i < fieldCollider.length; i++) {
colliderBoxes.push(new v3d.Box3());
colliderBoxes[i].copy(fieldCollider[i].geometry.boundingBox).applyMatrix4(fieldCollider[i].matrixWorld);
}

fieldPortals = fieldScene.children.filter(fieldPortals => fieldPortals.groupNames.includes('Portals'));
portalBoxes = [];
for (let i = 0; i < fieldPortals.length; i++) {
portalBoxes.push(new v3d.Box3());
portalBoxes[i].copy(fieldPortals[i].geometry.boundingBox).applyMatrix4(fieldPortals[i].matrixWorld);
}


fieldCamera = fieldScene.children.find(fieldCamera => fieldCamera.name == 'Camera');
app.setCamera(fieldCamera);

let spawnPoint = fieldScene.children.find(spawnPoint => spawnPoint.name == scene + "_" + field + "_" + spawnpoint);
//alles superkacke hier :D
controllerCam.position.set(0,1.75,0);
controllerCam.setRotationFromMatrix(spawnPoint.matrix);
playerCharacter.setRotationFromMatrix(spawnPoint.matrix);
controllerCam.applyMatrix4(spawnPoint.matrix);

app.enableControls();
app.controls.object = controllerCam;
loading = false;

}, fieldLoadProgress, fieldLoadError, true, true);
}

function fieldLoadProgress(progress){
//console.log(progress);
$('#overlay').show().css('background-color', 'rgba(0,0,0,' + progress / 100 + ')');
}
function fieldLoadError(error){
console.log("Error loading Field, dumping: " + error);
}


var cube;

document.addEventListener('keydown', function(event){

if(mainMenu){
/*
if(event.key == 'Enter'){
switchField('s1', 'f1', 'sp1');
mainMenu = false;
}
*/
} else {
/*
if(event.key == 'Enter'){
switchField('s1', 'f1', 'sp1');
}
if(event.key == 'p'){
pause = !pause;
}

if(event.key == '1'){
switchField('s1', 'f1', 'sp1');
}
if(event.key == '2'){
switchField('s1', 'f2', 'sp1');
}
if(event.key == '3'){
switchField('s1', 'f3', 'sp1');
}
if(event.key == '4'){
switchField('s1', 'f4', 'sp1');
}
if(event.key == '5'){
switchField('s1', 'f5', 'sp1');
}
*/

if(event.key == 'ArrowUp'){
playerCharacter.rotation.y = PI * 2;
}
if(event.key == 'ArrowDown'){
playerCharacter.rotation.y = PI;
}
if(event.key == 'ArrowLeft'){
playerCharacter.rotation.y = PI / 2;
}
if(event.key == 'ArrowRight'){
playerCharacter.rotation.y = PI + PI / 2;
}

}
});

document.addEventListener('keyup', function(event){

});

function dof(focus, aperture, maxblur, depthLeakThreshold) {
app.enablePostprocessing([{
type: 'dof',
focus: focus,
aperture: aperture,
maxblur: maxblur,
depthLeakThreshold: depthLeakThreshold
}]);
}
function bloom(threshold, strength, radius) {
app.enablePostprocessing([{
type: 'bloom',
threshold: threshold,
strength: strength,
radius: radius
}]);
}

BIN
scenes/s1f1/s1f1 (Kopie).bin View File


+ 1
- 0
scenes/s1f1/s1f1 (Kopie).gltf
File diff suppressed because it is too large
View File


BIN
scenes/s1f1/s1f1.bin View File


BIN
scenes/s1f1/s1f1.blend View File


BIN
scenes/s1f1/s1f1.blend1 View File


+ 1
- 0
scenes/s1f1/s1f1.gltf
File diff suppressed because it is too large
View File


BIN
scenes/s1f1/s1f1_1.png View File


BIN
scenes/s1f1/s1f1_2.png View File


BIN
scenes/s1f1/s1f1_3.png View File


BIN
scenes/s1f1/s1f1_bg.png View File


BIN
scenes/s1f2/s1f2.bin View File


+ 1
- 0
scenes/s1f2/s1f2.gltf
File diff suppressed because it is too large
View File


BIN
scenes/s1f2/s1f2_bg.png View File


BIN
scenes/s1f3/s1f3.bin View File


+ 1
- 0
scenes/s1f3/s1f3.gltf
File diff suppressed because it is too large
View File


BIN
scenes/s1f3/s1f3_bg.png View File


BIN
scenes/s1f4/s1f4.bin View File


+ 1
- 0
scenes/s1f4/s1f4.gltf
File diff suppressed because it is too large
View File


BIN
scenes/s1f4/s1f4_bg.png View File


BIN
scenes/s1f5/s1f5.bin View File


+ 1
- 0
scenes/s1f5/s1f5.gltf
File diff suppressed because it is too large
View File


BIN
scenes/s1f5/s1f5_bg.png View File


+ 1
- 0
v3d.js
File diff suppressed because it is too large
View File


BIN
workbench/Asset_Zoo.blend View File


BIN
workbench/Empty_Scene.blend View File


BIN
workbench/PlayerCharacter.blend View File


BIN
workbench/Sane_Empty_Blendfile.blend View File


BIN
workbench/Scene Photos/Arch2O-BrutalistArchitecture-11.jpg View File


BIN
workbench/Scene Photos/IMG_20161006_141005.jpg View File


BIN
workbench/Scene Photos/IMG_20161006_141213.jpg View File


+ 28
- 0
workbench/dialogueBoxes/dialogueBoxes.pde View File

@@ -0,0 +1,28 @@
class DialogueBox {
String text;
int ID;
DialogueBox(String t) {
text = t;
ID = DialogueBoxNo;
DialogueBoxNo++;
String[] pages = text.split("\\f");
}
}

DialogueBox dbox;
int DialogueBoxNo = 0;

void setup() {
size(600, 400);
//noLoop();
dbox = new DialogueBox("Yo was geht\fSeite 2");
}

void draw() {
background(255);
}

void mouseClicked(){
}

+ 4188335
- 0
workbench/ephebe.OBJ
File diff suppressed because it is too large
View File


BIN
workbench/painted_world.xcf View File


BIN
workbench/splashscreen.jpg View File


BIN
workbench/wip.blend View File


BIN
workbench/wip.blend1 View File


Loading…
Cancel
Save