akashraihan05

Members
  • Content Count

    4
  • Joined

  • Last visited

About akashraihan05

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. this my node.js code var http = require('http'), path = require('path'), fs = require('fs'), extensions = { //<--specify MIME file types. ".html" : "text/html", ".css" : "text/css", ".js" : "application/javascript", ".png" : "image/png", ".gif" : "image/gif", ".jpg" : "image/jpeg", ".babylon" : "application/babylon" //<--- ADD .babylon MIME type. }; //helper function handles file verification function getFile(filePath,res,page404,mimeType){ //does the requested file exist? fs.exists(filePath,function(exists){ //if it does... if(exists){ //read file and send response. fs.readFile(filePath,function(err,contents){ if(!err){ res.writeHead(200,{ "Content-type" : mimeType, //<-- SET dynamic MIME TYPE. "Content-Length" : contents.length }); res.end(contents); } }); } }); }; //handler for HTTP requests function requestHandler(req, res) { var fileName = path.basename(req.url) || 'index.html', ext = path.extname(fileName), localFolder = __dirname + '/public/', page404 = localFolder + '404.html'; if(!extensions[ext]){ //<-- CHECK file MIME type. //for now just send a 404 and a short message res.writeHead(404, {'Content-Type': 'text/html'}); res.end("Not Found"); }; getFile((localFolder + fileName),res,page404,extensions[ext]); }; http.createServer(requestHandler).listen(8008); console.log('Node server is running on http://localhost:8008');
  2. when i used and Espilit.babylon.manifest file { "version" : 1, "enableSceneOffline" : true, "enableTexturesOffline" : true } ,browser showed that's error.
  3. As server i am using babyloninnode but i can not load any external .babylon file. For two weeks, I tried a lot to render any external babylon file on any browser but I can not . so anyone can help to solve this problem? server.js <!DOCTYPE html> <html> <head> <title>BabylonJS - Espilit demo</title> <script src="http://www.babylonjs.com/hand.minified-1.2.js"></script> <script src="http://www.babylonjs.com/Oimo.js"></script> <script src="http://www.babylonjs.com/babylon.js"></script> <style> html, body { width: 100%; height: 100%; padding: 0; margin: 0; overflow: hidden; } #renderCanvas { width: 100%; height: 100%; touch-action: none; -ms-touch-action: none; } #lcContainer { position: absolute; top: 30px; left: 30px; color: gold; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <div id="lcContainer"> <ul id="listColliders"> </ul> </div> <script> var engine; var canvas; var scene; document.addEventListener("DOMContentLoaded", startGame, false); function startGame() { if (BABYLON.Engine.isSupported()) { canvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(canvas, false); BABYLON.SceneLoader.Load("Espilit/", "Espilit.babylon", engine, function (loadedScene) { scene = loadedScene; // Wait for textures and shaders to be ready scene.executeWhenReady(function () { // Attach camera to canvas inputs scene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function () { scene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); } } </script> </body> </html>