How to successfully integrate the three.js example of webgl_loader_obj_mtl.html into an ASP.NET WebForm, even when encountering issues with mtlLoader.setPath

While attempting to integrate the webgl_loader_obj_mtl.html example from three.js into an ASP.NET WebForm, I encountered an issue. Upon running the HTML, Visual Studio 2015 failed at mtlLoader.setPath. Has anyone else experienced the same problem? Additionally, I am unable to debug the JavaScript using Visual Studio 2015. When I try to place a breakpoint in Visual Studio 2015, it displays "the breakpoint will not be hit - no symbols loaded".

var mtlLoader = new THREE.MTLLoader();
mtlLoader.setBaseUrl( 'ObjModels3D/male02/' );
mtlLoader.setPath('ObjModels3D/male02/');
mtlLoader.load( 'male02_dds.mtl', function( materials ) {

materials.preload();

var objLoader = new THREE.OBJLoader();
objLoader.setMaterials( materials );
objLoader.setPath('ObjModels3D/male02/');
objLoader.load( 'male02.obj', function ( object ) {
    object.position.y = - 95;
    scene.add( object );
}, onProgress, onError );

});

Answer №1

After some troubleshooting, I managed to resolve the issue by adjusting the Web.Config file.

<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".mtl" mimeType="text/plain" />
        <mimeMap fileExtension=".obj" mimeType="text/plain" />
        <mimeMap fileExtension=".dds" mimeType="image/x-dds" />
    </staticContent>        
</system.webServer>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the reasoning behind using labels px, nx, py, ny, pz, nz for the faces of a cubemap?

In my WebGL project, I am working with a cubemap and my colleague gave me image assets labeled as front, back, left, right, top and bottom. However, when I looked at Three.js's example code, it used images marked with 2 letters, such as p or n followe ...

modifying button depending on the state of bootstrap collapse

I'm currently utilizing Bootstrap in my project. Here is the snippet of HTML code I have: <div class="row"> <button id="dog-btn" data-toggle="collapse" data-target="#dog-section" onclick=" ...

Three.js failing to display content

When I attempt to render a Blender model using the code below (starting with the default cube), nothing appears on the screen: <html> <head> <title>Testing page for the </title> <meta name="viewport" content= ...

Retrieve data from the api

Can someone provide the JavaScript code to loop through an API, extract the coordinates/address, and map it? Here is a simple demonstration of fetching the API data: const fetch = require("node-fetch"); fetch('url').then(function (resp ...

Can you explain the significance of this HTML code?

While examining some source code, I came across the following: <div class="classname {height: 300px; width: 200px}"></div> I am aware that element styling can be done using the style="" attribute. Could you explain what this code snippet sig ...

Display information using an ASP.Net barcode scanner

Currently, I am developing a WCF service application that involves receiving characters from a barcode reader and displaying the data on the UI for the user. My issue arises when inputting data using the keyboard into a textbox; everything functions corr ...

Experiencing a strange response while attempting to parse the result of an Angular 2 HTTP JSON request

After successfully implementing the http.get call and retrieving data from the request, I encountered an issue: this.http.get('https://data.cityofnewyork.us/resource/xx67-kt59.json').subscribe(data => { // Read the result field from the ...

Tips for moving a div to reveal new content whenever a toggle-slide is activated

I'm attempting to alternate between two divs every time the toggle-slide button is clicked. Additionally, the other button should hide/show each time the switch button is clicked. Here is the HTML code: <div id="divParticipants"> Click &a ...

The prototype chaining for JavaScript inheritance was not functioning as expected

I have been studying Stoyan Stefanov's book on JavaScript Patterns and I seem to be stuck...I am having trouble inheriting the prototype. What could I possibly be doing wrong? (Please execute this code in NodeJS) // implementing inheritance function ...

Making AJAX requests repeatedly within a loop

My current challenge involves implementing multiple ajax requests within a loop to populate several dropdown lists. Running the requests sequentially has resulted in only the last item in the loop being populated with values. var targetcontrols = []; ...

javascript change string into an array of objects

let dataString = "{lat: -31.563910, lng: 147.154312};{lat: -33.718234, lng: 150.363181};{lat: -33.727111, lng: 150.371124}"; let dataArray = dataString.split(';'); Produces the following output: let dataArray = [ "{lat: -31.563910, lng: 147 ...

The title of the Electron application remains consistent

My application is being packaged using electron-packager, but it's not changing its name and still displays "Electron." It's supposed to use the productName in my package.json file, but for some reason, it doesn't change. Even after creati ...

Exploring the benefits of integrating JQuery AJAX with non-unicode websites

Using JQuery's '.serialize' and '.post', I am sending form data via ajax to a non-unicode ASP-based website. The resulting data is URL-encoded in unicode, with characters encoded in double values. Is it possible to encode the form ...

Express middleware for serving static files using express.static() is not properly handling routing and is throwing an error stating that next()

During the development and testing phase on my local machine, everything was working as expected. However, once deployed to our UAT environment using Docker, I encountered some issues that are puzzling me: next() is not a function Another problem I'm ...

Learn how to implement form validation on a sliding form in just 5 easy steps using jQuery

I am new to programming and I struggle to comprehend complex JavaScript code written by others. Instead of using intricate code that I don't understand, I would like to request help in creating a simplified jQuery script for me to implement. Current ...

What is the best way to reveal information from an object in Javascript?

For debugging purposes, I need to extract the variables stored in connectData. Despite checking the type with 'typeof', I have found that when I try to access connectData[1] thinking it's an array, it returns undefined. If I simply want to ...

Delay reading body until npm request completes

My current challenge involves using npm request and cheerio to extract webpages and analyze their HTML structure. Everything works smoothly in scenarios where the HTML is available upon request. However, I am facing a problem when a website initially displ ...

Ensure that the main div remains centered on the page even when the window size is adjusted

Here is the code snippet: <div id="root"> <div id="child1">xxxx</div> <div id="child2">yyyy</div> </div> CSS : #root{ width: 86%; margin: 0 auto; } #root div { width: 50%; float: left; border: ...

Adjust the navigation menu to display or hide as the page is being scrolled

Implementing an offset to display/hide the navigation menu when the page is scrolled 100px. Attempted to modify from lastScroll = 0 to lastScroll = 100 but it did not work as expected. Jquery: Fiddle // Script lastScroll = 0; $(window).on('scroll&ap ...

Deciphering the node.js code: Understanding the significance of the syntax `(res) =>`

Would someone be able to clarify the syntax used in the nodejs docs for me? I'm having trouble understanding this particular line: (res) => { ...