Skip to content

THREE.TextureLoader().loadについて #6

@nopnop2002

Description

@nopnop2002

有益なサンプル、ありがとうございます。

const texture = new THREE.TextureLoader().load("imgs/earthmap1k.jpg");

camera_basic_earth.htmlの上記の部分ですが、Google Chromeでは以下のエラーとなります。

file:///C:/Users/user/Downloads/tutorial-three-main/samples/imgs/earthmap1k.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: chrome, chrome-extension, chrome-untrusted, data, http, https, isolated-app.

以下の様に変更することでローカル環境でも動作するようになりました。

      //const texture = new THREE.TextureLoader().load("imgs/earthmap1k.jpg");
      const texture = new THREE.TextureLoader().load("https://threejs.org/examples/textures/planets/earth_atmos_2048.jpg");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions