Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8673017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:20:56+00:00 2026-06-12T19:20:56+00:00

I have recently started to play around with Haxe and Three.js. How do I

  • 0

I have recently started to play around with Haxe and Three.js. How do I load a 3D object using JSONLoader. I’m very new to the Haxe way of doing things and haven’t wrapped my head around the whole extern thing.

I’m making use of this lib to simplify things:

https://github.com/rjanicek/three.js-haXe

Most of the Three.js Classes are abstracted in the lib except for JSONLoader or any loader for that matter. How can I load the json model I exported from Blender in Haxe?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:20:58+00:00Added an answer on June 12, 2026 at 7:20 pm

    It seems like I was using the wrong lib 🙂

    This is a better abstraction:

    https://github.com/labe-me/haxe-three.js

    To load a 3D model, you’ll go about it this way:

    package co.za.anber;
    import js.three.Three;
    import js.Lib;
    
    class Main 
    {
        static private var scene:Scene;
    
        static function main() 
        {
            //Get the dimensions of the scene
            var w = Lib.window.innerWidth;
            var h = Lib.window.innerHeight;
    
            scene = new Scene();
    
            //add some light
            var pointLight = new PointLight(0xffffff, 1, 0);
            pointLight.position.set(10, 50, 130);
            scene.add(pointLight);
            //add a camera
            var camera = new PerspectiveCamera(70, w/h, 1, 1000);
            camera.position.z = 500;
            scene.add(camera);
    
            //setup renderer in the document
            var renderer = new WebGLRenderer(null);
            renderer.setSize(w, h);
            Lib.document.body.appendChild(renderer.domElement);
    
    
            //Load the Blender exported Mesh. 
            //This is where we load the Mesh and setup the onload handler. This was the part I wasn't so sure about.
            var loader:JSONLoader = new JSONLoader(true);
            //I don't like in-line functions. You need to make the returning function into a Dynamic type.
            var callbackModel:Dynamic  = function( geometry:Dynamic ){createScene(geometry); };
            loader.load("Suzanne.js", callbackModel);
    
    
            //Listen for mouse move. In-line function from somewhere else.
            var mouseX = 0, mouseY = 0;
            untyped Lib.document.addEventListener('mousemove', function(event){
                mouseX = (event.clientX - Lib.window.innerWidth/2);
                mouseY = (event.clientY - Lib.window.innerHeight/2);
            }, false);
    
            //Render the scene @60 frames per second. Inline function from somewhere else.
            var timer = new haxe.Timer(Math.round(1000/60));
            timer.run = function(){
                camera.position.x += (mouseX - camera.position.x) * 0.05;
                camera.position.y += (-mouseY - camera.position.y) * 0.05;
                camera.lookAt(scene.position);
                renderer.render(scene, camera);
            }
        }
    
        /**
         * Onload complete handler. Here we can add our Mesh.
         * @param   geometry
         */
        static function createScene( geometry:Dynamic):Void{
            var mesh:Mesh = new Mesh( geometry, new MeshLambertMaterial( { color: 0x00FF00 } ) );
            //We scale it up to be visible!
            mesh.scale.set( 150.15, 150.5, 150.5 );
            scene.add( mesh );
        }
    
    
    }
    

    Hope this help someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started using Ruby, so quite new to this. My current objective
Recently I have started to play around with Namespaces in PHP, I am not
I have recently started using Netbeans with following stack Liferay, icefaces with jBoss. Is
I have recently started using RSpec for Integration testing in my Rails application, to
I have recently started using DocCheck for checking the validity of JavaDoc's in code
I have recently started to learn Objective-C and write my tests using OCUnit that
i have recently started working on C# and i am very amateur at it
I have recently started using SQLALCHEMY to query a my-sql database. I want to
I have recently started using a shared-host for my clients so see project progress
I have recently started parsing JSON documents using SBJSON Parser, and I am able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.