Skip to content

Commit

Permalink
3d
Browse files Browse the repository at this point in the history
  • Loading branch information
jcm236 committed Sep 5, 2024
1 parent 2c027f9 commit 5b68966
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 74 deletions.
35 changes: 20 additions & 15 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@
href="{{ site.baseurl }}/favicon.png"
{% endif %}
>
<style>
<style>

.renderCanvas {

width: 10%;

height: 10%;

touch-action: none;

}

body {

body {

overflow: hidden;

Expand All @@ -36,20 +28,33 @@
height: 100%;

margin: 0;

padding: 0;

}



.renderCanvas {

width: 500px;

height: 300px;

touch-action: none;

}

</style>



<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://cdn.babylonjs.com/babylon.js"></script>

<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>

<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
<script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>

<script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js"
></script>
Expand Down
24 changes: 8 additions & 16 deletions _includes/three.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<canvas class="renderCanvas card" id="renderCanvas{{ include.id }}" touch-action="none" ></canvas>





<script>

const canvas{{ include.id }}= document.getElementById("renderCanvas{{ include.id }}"); // Get the canvas element
Expand All @@ -21,10 +18,10 @@


// BABYLON.MeshBuilder.CreateBox("box", {});
BABYLON.SceneLoader.ImportMesh(
var mesh = BABYLON.SceneLoader.ImportMesh(
undefined, // Name of meshes to load
"/assets/models/", // Path on a server for the file
"saturn.gltf", // The file name that should be loaded from the above path
"{{ include.path }}", // Path on a server for the file
"{{ include.model }}", // The file name that should be loaded from the above path
scene{{ include.id }}, // The scene to load this mesh/model file into
function (
meshes,
Expand All @@ -39,9 +36,11 @@


const camera{{ include.id }} = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 15, new BABYLON.Vector3(0, 0, 0));

camera{{ include.id }}.lowerRadiusLimit = 15;
camera{{ include.id }}.upperRadiusLimit = 15;

camera{{ include.id }}.attachControl(canvas{{ include.id }}, true);

const light{{ include.id }} = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));

// Skybox
Expand All @@ -52,14 +51,7 @@
skybox.material = skyboxMaterial;
skybox.infiniteDistance = true;
skyboxMaterial.disableLighting = true;
// window.setTimeout(() => {
// var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene{{ include.id }});
// skyboxMaterial.backFaceCulling = false;
// skyboxMaterial.emissiveColor = new BABYLON.Color3(0, 0, 1);
// skyboxMaterial.forceCompilation(skybox, () => {
// skybox.material = skyboxMaterial;
// });
// }, 1000);


return scene{{ include.id }};

Expand Down
2 changes: 1 addition & 1 deletion assets/models/saturn.gltf

Large diffs are not rendered by default.

42 changes: 0 additions & 42 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,6 @@ hero_tag_text: "Warning: This mod is in alpha"

This mod adds many new planets, moons and even solar systems!

<style>



body {

overflow: hidden;

width: 100%;

height: 100%;

margin: 0;

padding: 0;

}



.renderCanvas {

width: 500px;

height: 300px;

touch-action: none;

}

</style>



<script src="https://cdn.babylonjs.com/babylon.js"></script>

<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>

<script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>



MOD STAGE : Very Alpha (can be only played in creative mode)

For questions and help, join out [discord](https://discord.gg/cdc6sgEExF)!
Expand Down
10 changes: 10 additions & 0 deletions tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Testing Page
subtitle: Website Tests
layout: page
hero_tag: true
hero_tag_class: is-large is-danger
hero_tag_text: "Warning: Do Not Look"
---

{% include three.html id="test" path="/assets/models/" model="saturn.gltf" %}

0 comments on commit 5b68966

Please sign in to comment.