Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <!-- three.min.js r87 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/87/three.min.js"></script>

<!-- vox.js v1.0.1 -->
<script src="https://cdn.jsdelivr.net/gh/daishihmr/vox.js@1.0.1/build/vox.min.js"></script>

<!-- Old OrbitControls.js -->
<script src="https://codepen.io/siouxcitizen/pen/XWWXZZN.js"></script>

            
          
!

CSS

            
              * {
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

body {
  background: #000;
  font: 30px sans-serif;
}
            
          
!

JS

            
              // forked from siouxcitizen's "vox.js でMagicaVoxelで作成した「しかばね」を表示してみるテスト" http://jsdo.it/siouxcitizen/YjO6
// forked from siouxcitizen's "vox.js でMagicaVoxelで作成した「魔法使い(青髪)」を表示してみるテスト" http://jsdo.it/siouxcitizen/gRwG
// forked from siouxcitizen's "vox.js でMagicaVoxelで作成した「魔法使い(赤髪)」を表示してみるテスト" http://jsdo.it/siouxcitizen/Szdn
// forked from siouxcitizen's "vox.js でMagicaVoxelで作成した「僧侶」を表示してみるテスト" http://jsdo.it/siouxcitizen/I0vf
// forked from siouxcitizen's "vox.js でMagicaVoxelで作成した「勇者」を表示してみるテスト" http://jsdo.it/siouxcitizen/KnAG
//
//「しかばね」いろいろ表示してみました
//
//参考にした昔作成した自分のコード
//Three.js r70 でOBJファイル形式3Dモデルを表示その4(WebGL使用)
//http://jsdo.it/siouxcitizen/npxW
//
//Away3DでMagicaVoxelで作成した「しかばね」キャラクタを表示
//http://jsdo.it/siouxcitizen/7b0w
//
//Away3DでMagicaVoxelで作成した「しかばね」戦士を表示
//http://jsdo.it/siouxcitizen/8HDp
//
//Away3DでMagicaVoxelで作成した「しかばね」剣士を表示
//http://jsdo.it/siouxcitizen/yGGs
//
//Away3DでMagicaVoxelで作成した「しかばね」王を表示
//http://jsdo.it/siouxcitizen/d7Ud
//

var scene, camera, renderer, controls;
var ROTATE = true;

function init() {
    scene = new THREE.Scene();
    camera = new THREE.PerspectiveCamera(45, 450 / 450, 0.1, 1000);
    renderer = new THREE.WebGLRenderer();
    controls = new THREE.OrbitControls(camera, renderer.domElement);
    controls.userPan = false;
    controls.userPanSpeed = 0.0;
    controls.maxDistance = 5000.0;
    controls.maxPolarAngle = Math.PI * 0.495;
    controls.rotateUp(Math.PI * 0.1);
    controls.autoRotate = ROTATE; //true:自動回転する,false:自動回転しない
    controls.autoRotateSpeed = 4.0; //自動回転する時の速度

    renderer.setSize(465, 465);
    renderer.shadowMapEnabled = true;
    camera.position.x = 0;
    camera.position.y = 0;
    camera.position.z = 150;
    camera.lookAt(scene.position);

    var spotLight = new THREE.SpotLight(0xffffff);
    spotLight.position.set(100, 100, -100);
    scene.add(spotLight);

    var light = new THREE.DirectionalLight(0xffffff, 1.5);
    light.position.set(100, 100, 100).normalize();
    scene.add(light);

    var light2 = new THREE.DirectionalLight(0xffffff);
    light2.position.set(-100, -100, -100).normalize();
    scene.add(light2);

    document.body.appendChild(renderer.domElement);
    var parser = new vox.Parser();
    // shikabane.vox
    parser.parse("https://rawcdn.githack.com/siouxcitizen/3DModel/b2d06e45f6b64c3e342b724a4ec5a0c427a4ce0a/vox/shikabaneOu.vox").then(function(voxelData) {
        var builder = new vox.MeshBuilder(voxelData, {
            voxelSize: 1.0,
            vertexColor: true,
            optimizeFaces: false,
        });
        var v0 = builder.createMesh();
        v0.position.y = 30;
        scene.add(v0);
    });
    parser.parse("https://rawcdn.githack.com/siouxcitizen/3DModel/b2d06e45f6b64c3e342b724a4ec5a0c427a4ce0a/vox/shikabaneKenshi.vox").then(function(voxelData) {
        var builder = new vox.MeshBuilder(voxelData, {
            voxelSize: 1.0,
            vertexColor: true,
            optimizeFaces: false,
        });
        var v0 = builder.createMesh();
        v0.position.x = -10
        v0.position.y = 10;
        scene.add(v0);
        var v1  = builder.createMesh();
        v1.position.x = 10;
        v1.position.y = 10;
        scene.add(v1);
    });
    parser.parse("https://rawcdn.githack.com/siouxcitizen/3DModel/b2d06e45f6b64c3e342b724a4ec5a0c427a4ce0a/vox/shikabneSenshi.vox").then(function(voxelData) {
        var builder = new vox.MeshBuilder(voxelData, {
            voxelSize: 1.0,
            vertexColor: true,
            optimizeFaces: false,
        });
        var v0 = builder.createMesh();
        v0.position.x = -10
        v0.position.y = -10;
        scene.add(v0);
        var v1  = builder.createMesh();
        v1.position.x = 10;
        v1.position.y = -10;
        scene.add(v1);
        var v2  = builder.createMesh();
        v2.position.x = -30;
        v2.position.y = -10;
        scene.add(v2);
        var v3  = builder.createMesh();
        v3.position.x = 30;
        v3.position.y = -10;
        scene.add(v3);
    });
    parser.parse("https://rawcdn.githack.com/siouxcitizen/3DModel/b2d06e45f6b64c3e342b724a4ec5a0c427a4ce0a/vox/shikabane.vox").then(function(voxelData) {
        var builder = new vox.MeshBuilder(voxelData, {
            voxelSize: 1.0,
            vertexColor: true,
            optimizeFaces: false,
        });
        var v0 = builder.createMesh();
        v0.position.x = -10
        v0.position.y = -30;
        scene.add(v0);
        var v1  = builder.createMesh();
        v1.position.x = 10;
        v1.position.y = -30;
        scene.add(v1);
        var v2  = builder.createMesh();
        v2.position.x = -30;
        v2.position.y = -30;
        scene.add(v2);
        var v3  = builder.createMesh();
        v3.position.x = 30;
        v3.position.y = -30;
        scene.add(v3);
        var v4  = builder.createMesh();
        v4.position.x = -50;
        v4.position.y = -30;
        scene.add(v4);
        var v5  = builder.createMesh();
        v5.position.x = 50;
        v5.position.y = -30;
        scene.add(v5);
        var v6  = builder.createMesh();
        v6.position.x = -70;
        v6.position.y = -30;
        scene.add(v6);
        var v7  = builder.createMesh();
        v7.position.x = 70;
        v7.position.y = -30;
        scene.add(v7);
    });

    render();
}

function render() {
    controls.update();
    requestAnimationFrame(render);
    renderer.render(scene, camera);
}

init();

            
          
!
999px

Console