Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
跨域图像资源支持 fix #1;模型json的textures字段支持填入http(s)协议的url
Browse files Browse the repository at this point in the history
  • Loading branch information
journey-ad committed Dec 9, 2017
1 parent 277ac8b commit 6d06b8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/LAppModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ LAppModel.prototype.load = function(gl, modelSettingPath, callback)
for (var i = 0; i < thisRef.modelSetting.getTextureNum(); i++)
{

if( /^https?:\/\/|^\/\//i.test(thisRef.modelSetting.getTextureFile(i)) )
{
var texPaths = thisRef.modelSetting.getTextureFile(i);
}
else
{
var texPaths = thisRef.modelHomeDir +
thisRef.modelSetting.getTextureFile(i);
}

thisRef.loadTexture(i, texPaths, function() {

Expand Down
1 change: 1 addition & 0 deletions src/PlatformManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ PlatformManager.prototype.loadTexture = function(model/*ALive2DModel*/, no/*
// load textures
var loadedImage = new Image();
loadedImage.src = path;
loadedImage.crossOrigin = 'Anonymous';

var thisRef = this;
loadedImage.onload = function() {
Expand Down

0 comments on commit 6d06b8e

Please sign in to comment.