Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SwordMaterialIDEA
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangwenjie
SwordMaterialIDEA
Commits
5d6eba45
Commit
5d6eba45
authored
Jul 25, 2018
by
huangwenjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:添加使用说明
parent
c33f03b1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
131 additions
and
254 deletions
+131
-254
matConfig.json
SwordMaterialIDEA/models/babylon/car_1/matConfig.json
+1
-1
Glossiness.png
SwordMaterialIDEA/models/obj/mutong/Glossiness.png
+0
-0
matConfig.json
SwordMaterialIDEA/models/obj/mutong/matConfig.json
+23
-0
UIFrame.ts
SwordMaterialIDEA/tsSrc/UIFrame.ts
+13
-14
exportConfigs.ts
SwordMaterialIDEA/tsSrc/exportConfigs.ts
+70
-69
filesManager.ts
SwordMaterialIDEA/tsSrc/filesManager.ts
+2
-2
importConfigs.ts
SwordMaterialIDEA/tsSrc/importConfigs.ts
+21
-4
sceneManager.ts
SwordMaterialIDEA/tsSrc/sceneManager.ts
+1
-1
SwordMaterialIDEA使用说明.docx
SwordMaterialIDEA使用说明.docx
+0
-0
matConfig.json
matConfig.json
+0
-163
No files found.
SwordMaterialIDEA/models/babylon/car_1/matConfig.json
View file @
5d6eba45
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
"
specularColor
":{R: 0.3 G:0.3 B:0.3},
"
specularColor
":{R: 0.3 G:0.3 B:0.3},
"
specularPower
":17.92,
"
specularPower
":17.92,
"
useSpecularOverAlpha
":true,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_Details_A
.jpg
",
"
diffuseTexture
":"
E
:
/WorkFiles/NW_Sword_Material_IDEA/SwordMaterialIDEA/models/babylon/car_
1
/Car_Camaro_Paint_A_Game
.jpg
",
"
ambientTexture
":"
undefined
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
...
...
SwordMaterialIDEA/models/obj/mutong/Glossiness.png
0 → 100644
View file @
5d6eba45
This diff is collapsed.
Click to expand it.
SwordMaterialIDEA/models/obj/mutong/matConfig.json
0 → 100644
View file @
5d6eba45
{
'meshName'
:
'mutong'
,
'materialName'
:
'mutong'
,
'customType'
:
'StandardMaterial'
,
'wireframe'
:
false
,
'backFaceCulling'
:
true
,
'needDepthPrePass'
:
false
,
'alpha'
:
1
,
'ambientColor'
:{
R
:
0
G
:
0
B
:
0
},
'diffuseColor'
:{
R
:
1
G
:
1
B
:
1
},
'emissiveColor'
:{
R
:
0
G
:
0
B
:
0
},
'specularColor'
:{
R
:
1
G
:
1
B
:
1
},
'specularPower'
:
9.605383909452431
,
'useSpecularOverAlpha'
:
false
,
'diffuseTexture'
:
'E
:
/WorkFiles/NW_Sword_Material_IDEA/SwordMaterialIDEA/models/obj/mutong/Diffuse.png'
,
'ambientTexture'
:
'E
:
/WorkFiles/NW_Sword_Material_IDEA/SwordMaterialIDEA/models/obj/mutong/Ambient
Occlusion
Map
from
Mesh
MuShuiTong_ML_initialShadingGroup.png'
,
'emissiveTexture'
:
'undefined'
,
'lightmapTexture'
:
'undefined'
,
'opacityTexture'
:
'undefined'
,
'reflectionTexture'
:
'undefined'
,
'refractionTexture'
:
'undefined'
,
'bumpTexture'
:
'E
:
/WorkFiles/NW_Sword_Material_IDEA/SwordMaterialIDEA/models/obj/mutong/Normal.png'
}
\ No newline at end of file
SwordMaterialIDEA/tsSrc/UIFrame.ts
View file @
5d6eba45
import
{
FilesManager
}
from
'./filesManager'
;
import
{
FilesManager
}
from
'./filesManager'
;
import
{
ExportConfigs
}
from
'./exportConfigs'
;
import
{
ExportConfigs
}
from
'./exportConfigs'
;
import
{
SceneManager
}
from
'./sceneManager'
;
import
{
SceneManager
}
from
'./sceneManager'
;
import
{
ImportConfigs
}
from
'./importConfigs'
;
let
sceneManager
:
any
;
let
sceneManager
:
any
;
...
@@ -48,6 +49,8 @@ export class UiFrame {
...
@@ -48,6 +49,8 @@ export class UiFrame {
}
}
private
filesManager
=
new
FilesManager
();
public
init
(){
public
init
(){
...
@@ -260,7 +263,6 @@ export class UiFrame {
...
@@ -260,7 +263,6 @@ export class UiFrame {
let
texture
:
BABYLON
.
Texture
=
null
;
let
texture
:
BABYLON
.
Texture
=
null
;
let
textureName
:
string
;
let
textureName
:
string
;
let
texturePath
:
string
;
let
texturePath
:
string
;
let
filesManager
=
new
FilesManager
();
if
(
!
matName
||
matName
===
''
){
if
(
!
matName
||
matName
===
''
){
alert
(
'请输入新材质的名称!'
)
alert
(
'请输入新材质的名称!'
)
}
else
{
}
else
{
...
@@ -282,7 +284,7 @@ export class UiFrame {
...
@@ -282,7 +284,7 @@ export class UiFrame {
$('.w2ui-msg-button.w2ui-msg-close').click();
$('.w2ui-msg-button.w2ui-msg-close').click();
}else{
}else{
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
scope.
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
currObj.material = new BABYLON.StandardMaterial(matName,sceneManager.scene)
currObj.material = new BABYLON.StandardMaterial(matName,sceneManager.scene)
texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene);
texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene);
currObj.material.diffuseTexture = texture;
currObj.material.diffuseTexture = texture;
...
@@ -310,7 +312,7 @@ export class UiFrame {
...
@@ -310,7 +312,7 @@ export class UiFrame {
$('.w2ui-msg-button.w2ui-msg-close').click();
$('.w2ui-msg-button.w2ui-msg-close').click();
}else{
}else{
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
scope.
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
currObj.material = new BABYLON.PBRMaterial(matName,sceneManager.scene)
currObj.material = new BABYLON.PBRMaterial(matName,sceneManager.scene)
texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene);
texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene);
currObj.material.albedoTexture = texture;
currObj.material.albedoTexture = texture;
...
@@ -411,7 +413,6 @@ export class UiFrame {
...
@@ -411,7 +413,6 @@ export class UiFrame {
let index:any;
let index:any;
let textureName:string;
let textureName:string;
let texturePath:string;
let texturePath:string;
let filesManager:FilesManager = new FilesManager();;
sceneManager.scene.meshes.forEach(mesh=>{
sceneManager.scene.meshes.forEach(mesh=>{
if(mesh.name === currObjName){
if(mesh.name === currObjName){
if(mesh.material == null){
if(mesh.material == null){
...
@@ -423,7 +424,6 @@ export class UiFrame {
...
@@ -423,7 +424,6 @@ export class UiFrame {
index = newUrl.lastIndexOf("
\\
");
index = newUrl.lastIndexOf("
\\
");
textureName = newUrl.substring(index + 1, newUrl.length);
textureName = newUrl.substring(index + 1, newUrl.length);
texturePath = newUrl.split(textureName)[0];
texturePath = newUrl.split(textureName)[0];
debugger
if(texturePath === currFilePath){
if(texturePath === currFilePath){
// 如果图片路径在当前指定文件夹路径下则直接读取
// 如果图片路径在当前指定文件夹路径下则直接读取
let texture = new BABYLON.Texture(newUrl, sceneManager.scene)
let texture = new BABYLON.Texture(newUrl, sceneManager.scene)
...
@@ -435,7 +435,7 @@ export class UiFrame {
...
@@ -435,7 +435,7 @@ export class UiFrame {
$('#currTexture .uploadTexture').text('更换贴图')
$('#currTexture .uploadTexture').text('更换贴图')
}else{
}else{
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
scope.
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
let texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene)
let texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene)
mat[currTextureType] = texture;
mat[currTextureType] = texture;
$('.currTextureImg img').attr('src', `${currFilePath}${textureName}`)
$('.currTextureImg img').attr('src', `${currFilePath}${textureName}`)
...
@@ -452,7 +452,6 @@ export class UiFrame {
...
@@ -452,7 +452,6 @@ export class UiFrame {
index = newUrl.lastIndexOf("
\\
");
index = newUrl.lastIndexOf("
\\
");
textureName = newUrl.substring(index + 1, newUrl.length);
textureName = newUrl.substring(index + 1, newUrl.length);
texturePath = newUrl.split(textureName)[0];
texturePath = newUrl.split(textureName)[0];
debugger
if(texturePath === currFilePath){
if(texturePath === currFilePath){
// 如果图片路径在当前指定文件夹路径下则直接读取
// 如果图片路径在当前指定文件夹路径下则直接读取
let texture = new BABYLON.Texture(newUrl, sceneManager.scene)
let texture = new BABYLON.Texture(newUrl, sceneManager.scene)
...
@@ -464,7 +463,7 @@ export class UiFrame {
...
@@ -464,7 +463,7 @@ export class UiFrame {
$('#currTexture .uploadTexture').text('更换贴图')
$('#currTexture .uploadTexture').text('更换贴图')
}else{
}else{
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
// 如果图片路径在不同路径下,则先复制到当前路径再读取当前路径下的图片
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
scope.
filesManager.copyFile(newUrl,`${currFilePath}${textureName}`).then(()=>{
let texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene)
let texture = new BABYLON.Texture(`${currFilePath}${textureName}`, sceneManager.scene)
mesh.material[currTextureType] = texture;
mesh.material[currTextureType] = texture;
$('.currTextureImg img').attr('src', `${currFilePath}${textureName}`)
$('.currTextureImg img').attr('src', `${currFilePath}${textureName}`)
...
@@ -481,7 +480,7 @@ export class UiFrame {
...
@@ -481,7 +480,7 @@ export class UiFrame {
// $('.currTextureImg .revocation').css('display','block')
// $('.currTextureImg .revocation').css('display','block')
});
});
// 撤销更改
// $('.currTextureImg .revocation').click(()=>{
// $('.currTextureImg .revocation').click(()=>{
// let oldMat:BABYLON.Material;
// let oldMat:BABYLON.Material;
// sceneManager.changedMats.forEach(mat=>{
// sceneManager.changedMats.forEach(mat=>{
...
@@ -657,7 +656,7 @@ export class UiFrame {
...
@@ -657,7 +656,7 @@ export class UiFrame {
}
}
private loadNewModel(e){
private loadNewModel(e){
let scope = this;
// 重置属性,清空场景
// 重置属性,清空场景
currObj = null
currObj = null
currObjName = null
currObjName = null
...
@@ -683,14 +682,14 @@ export class UiFrame {
...
@@ -683,14 +682,14 @@ export class UiFrame {
currFilePath = abUrl;
currFilePath = abUrl;
let to = `${abUrl}${fileName}`;
let to = `${abUrl}${fileName}`;
// 复制文件到指定目录下
// 复制文件到指定目录下
console.log(from,to)
console.log(from,to);
let filesManager = new FilesManager();
let copyfile = scope.filesManager.filesOperation(from, to);
let copyfile = filesManager.filesOperation(from, to);
copyfile.then(()=>{
copyfile.then(()=>{
// 导入模型到场景
// 导入模型到场景
sceneManager.loadMeshes('default', rootUrl, fileName, sceneManager.scene);
sceneManager.loadMeshes('default', rootUrl, fileName, sceneManager.scene);
// 查询是否有材质配置文件,如果有则加载配置文件,没有则不加载
// 查询是否有材质配置文件,如果有则加载配置文件,没有则不加载
let importConfigs = new ImportConfigs();
importConfigs.load(currFilePath);
$('#currTexture .TextureTabs ul li:first-child').click();
$('#currTexture .TextureTabs ul li:first-child').click();
})
})
}
}
...
...
SwordMaterialIDEA/tsSrc/exportConfigs.ts
View file @
5d6eba45
...
@@ -31,34 +31,34 @@ export class ExportConfigs {
...
@@ -31,34 +31,34 @@ export class ExportConfigs {
}
}
multiMat
=
`
${
multiMat
}
,
multiMat
=
`
${
multiMat
}
,
{
{
"materialName":"
${
mat
.
name
}
"
,
'materialName':'
${
mat
.
name
}
'
,
"customType"
:
${
matType
}
,
'customType'
:
${
matType
}
,
"wireframe"
:
${
mat
.
wireframe
}
,
'wireframe'
:
${
mat
.
wireframe
}
,
"backFaceCulling"
:
${
mat
.
backFaceCulling
}
,
'backFaceCulling'
:
${
mat
.
backFaceCulling
}
,
"needDepthPrePass"
:
${
mat
.
needDepthPrePass
}
,
'needDepthPrePass'
:
${
mat
.
needDepthPrePass
}
,
"alpha"
:
${
mat
.
alpha
}
,
'alpha'
:
${
mat
.
alpha
}
,
"ambientColor"
:
${
mat
.
ambientColor
}
,
'ambientColor'
:
${
mat
.
ambientColor
}
,
"diffuseColor"
:
${
mat
.
diffuseColor
}
,
'diffuseColor'
:
${
mat
.
diffuseColor
}
,
"emissiveColor"
:
${
mat
.
emissiveColor
}
,
'emissiveColor'
:
${
mat
.
emissiveColor
}
,
"specularColor"
:
${
mat
.
specularColor
}
,
'specularColor'
:
${
mat
.
specularColor
}
,
"specularPower"
:
${
mat
.
specularPower
}
,
'specularPower'
:
${
mat
.
specularPower
}
,
"useSpecularOverAlpha"
:
${
mat
.
useSpecularOverAlpha
}
,
'useSpecularOverAlpha'
:
${
mat
.
useSpecularOverAlpha
}
,
"diffuseTexture":"
${
mat
.
diffuseTexture
}
"
,
'diffuseTexture':'
${
mat
.
diffuseTexture
}
'
,
"ambientTexture":"
${
mat
.
ambientTexture
}
"
,
'ambientTexture':'
${
mat
.
ambientTexture
}
'
,
"emissiveTexture":"
${
mat
.
emissiveTexture
}
"
,
'emissiveTexture':'
${
mat
.
emissiveTexture
}
'
,
"lightmapTexture":"
${
mat
.
lightmapTexture
}
"
,
'lightmapTexture':'
${
mat
.
lightmapTexture
}
'
,
"opacityTexture":"
${
mat
.
opacityTexture
}
"
,
'opacityTexture':'
${
mat
.
opacityTexture
}
'
,
"reflectionTexture":"
${
mat
.
reflectionTexture
}
"
,
'reflectionTexture':'
${
mat
.
reflectionTexture
}
'
,
"refractionTexture":"
${
mat
.
refractionTexture
}
"
,
'refractionTexture':'
${
mat
.
refractionTexture
}
'
,
}`
}`
});
});
this
.
configJson
=
`
this
.
configJson
=
`
${
this
.
configJson
}
,
${
this
.
configJson
}
,
{
{
"meshName":"
${
currentObj
.
name
}
"
,
'meshName':'
${
currentObj
.
name
}
'
,
"materialName":"
${
material
.
name
}
"
,
'materialName':'
${
material
.
name
}
'
,
"customType":"MultiMaterial"
,
'customType':'MultiMaterial'
,
"subMaterial":"
${
multiMat
}
"
'subMaterial':'
${
multiMat
}
'
}`
}`
}
else
if
(
currentObj
.
material
instanceof
BABYLON
.
StandardMaterial
)
{
}
else
if
(
currentObj
.
material
instanceof
BABYLON
.
StandardMaterial
)
{
// 是标准材质时
// 是标准材质时
...
@@ -66,27 +66,27 @@ export class ExportConfigs {
...
@@ -66,27 +66,27 @@ export class ExportConfigs {
this
.
configJson
=
`
this
.
configJson
=
`
${
this
.
configJson
}
,
${
this
.
configJson
}
,
{
{
"meshName":"
${
currentObj
.
name
}
"
,
'meshName':'
${
currentObj
.
name
}
'
,
"materialName":"
${
mat
.
name
}
"
,
'materialName':'
${
mat
.
name
}
'
,
"customType":"StandardMaterial"
,
'customType':'StandardMaterial'
,
"wireframe"
:
${
mat
.
wireframe
}
,
'wireframe'
:
${
mat
.
wireframe
}
,
"backFaceCulling"
:
${
mat
.
backFaceCulling
}
,
'backFaceCulling'
:
${
mat
.
backFaceCulling
}
,
"needDepthPrePass"
:
${
mat
.
needDepthPrePass
}
,
'needDepthPrePass'
:
${
mat
.
needDepthPrePass
}
,
"alpha"
:
${
mat
.
alpha
}
,
'alpha'
:
${
mat
.
alpha
}
,
"ambientColor"
:
${
mat
.
ambientColor
}
,
'ambientColor'
:
${
mat
.
ambientColor
}
,
"diffuseColor"
:
${
mat
.
diffuseColor
}
,
'diffuseColor'
:
${
mat
.
diffuseColor
}
,
"emissiveColor"
:
${
mat
.
emissiveColor
}
,
'emissiveColor'
:
${
mat
.
emissiveColor
}
,
"specularColor"
:
${
mat
.
specularColor
}
,
'specularColor'
:
${
mat
.
specularColor
}
,
"specularPower"
:
${
mat
.
specularPower
}
,
'specularPower'
:
${
mat
.
specularPower
}
,
"useSpecularOverAlpha"
:
${
mat
.
useSpecularOverAlpha
}
,
'useSpecularOverAlpha'
:
${
mat
.
useSpecularOverAlpha
}
,
"diffuseTexture":"
${
mat
.
diffuseTexture
}
"
,
'diffuseTexture':'
${
mat
.
diffuseTexture
}
'
,
"ambientTexture":"
${
mat
.
ambientTexture
}
"
,
'ambientTexture':'
${
mat
.
ambientTexture
}
'
,
"emissiveTexture":"
${
mat
.
emissiveTexture
}
"
,
'emissiveTexture':'
${
mat
.
emissiveTexture
}
'
,
"lightmapTexture":"
${
mat
.
lightmapTexture
}
"
,
'lightmapTexture':'
${
mat
.
lightmapTexture
}
'
,
"opacityTexture":"
${
mat
.
opacityTexture
}
"
,
'opacityTexture':'
${
mat
.
opacityTexture
}
'
,
"reflectionTexture":"
${
mat
.
reflectionTexture
}
"
,
'reflectionTexture':'
${
mat
.
reflectionTexture
}
'
,
"refractionTexture":"
${
mat
.
refractionTexture
}
"
,
'refractionTexture':'
${
mat
.
refractionTexture
}
'
,
"bumpTexture":"
${
mat
.
bumpTexture
}
"
'bumpTexture':'
${
mat
.
bumpTexture
}
'
}`
}`
}
else
if
(
currentObj
.
material
instanceof
BABYLON
.
PBRMaterial
)
{
}
else
if
(
currentObj
.
material
instanceof
BABYLON
.
PBRMaterial
)
{
// 是PBR材质时
// 是PBR材质时
...
@@ -94,35 +94,35 @@ export class ExportConfigs {
...
@@ -94,35 +94,35 @@ export class ExportConfigs {
this
.
configJson
=
`
this
.
configJson
=
`
${
this
.
configJson
}
,
${
this
.
configJson
}
,
{
{
"meshName":"
${
currentObj
.
name
}
"
,
'meshName':'
${
currentObj
.
name
}
'
,
"materialName":"
${
mat
.
name
}
"
,
'materialName':'
${
mat
.
name
}
'
,
"customType":"PBRMaterial"
,
'customType':'PBRMaterial'
,
"wireframe"
:
${
mat
.
wireframe
}
,
'wireframe'
:
${
mat
.
wireframe
}
,
"backFaceCulling"
:
${
mat
.
backFaceCulling
}
,
'backFaceCulling'
:
${
mat
.
backFaceCulling
}
,
"needDepthPrePass"
:
${
mat
.
needDepthPrePass
}
,
'needDepthPrePass'
:
${
mat
.
needDepthPrePass
}
,
"alpha"
:
${
mat
.
alpha
}
,
'alpha'
:
${
mat
.
alpha
}
,
"ambientColor"
:
${
mat
.
ambientColor
}
,
'ambientColor'
:
${
mat
.
ambientColor
}
,
"diffuseColor"
:
${
mat
.
diffuseColor
}
,
'diffuseColor'
:
${
mat
.
diffuseColor
}
,
"emissiveColor"
:
${
mat
.
emissiveColor
}
,
'emissiveColor'
:
${
mat
.
emissiveColor
}
,
"specularColor"
:
${
mat
.
specularColor
}
,
'specularColor'
:
${
mat
.
specularColor
}
,
"specularPower"
:
${
mat
.
specularPower
}
,
'specularPower'
:
${
mat
.
specularPower
}
,
"useSpecularOverAlpha"
:
${
mat
.
useSpecularOverAlpha
}
,
'useSpecularOverAlpha'
:
${
mat
.
useSpecularOverAlpha
}
,
"albedoTexture":"
${
mat
.
albedoTexture
}
"
,
'albedoTexture':'
${
mat
.
albedoTexture
}
'
,
"ambientTexture":"
${
mat
.
ambientTexture
}
"
,
'ambientTexture':'
${
mat
.
ambientTexture
}
'
,
"emissiveTexture":"
${
mat
.
emissiveTexture
}
"
,
'emissiveTexture':'
${
mat
.
emissiveTexture
}
'
,
"lightmapTexture":"
${
mat
.
lightmapTexture
}
"
,
'lightmapTexture':'
${
mat
.
lightmapTexture
}
'
,
"opacityTexture":"
${
mat
.
opacityTexture
}
"
,
'opacityTexture':'
${
mat
.
opacityTexture
}
'
,
"reflectionTexture":"
${
mat
.
reflectionTexture
}
"
,
'reflectionTexture':'
${
mat
.
reflectionTexture
}
'
,
"refractionTexture":"
${
mat
.
refractionTexture
}
"
,
'refractionTexture':'
${
mat
.
refractionTexture
}
'
,
"bumpTexture":"
${
mat
.
bumpTexture
}
"
'bumpTexture':'
${
mat
.
bumpTexture
}
'
}`
}`
}
}
}
else
{
}
else
{
// 没材质
// 没材质
this
.
configJson
=
`
${
this
.
configJson
}
,
this
.
configJson
=
`
${
this
.
configJson
}
,
{
{
"meshName":"
${
currentObj
.
name
}
"
,
'meshName':'
${
currentObj
.
name
}
'
,
"customType":"none"
'customType':'none'
}`
}`
}
}
})
})
...
@@ -130,11 +130,12 @@ export class ExportConfigs {
...
@@ -130,11 +130,12 @@ export class ExportConfigs {
// 将材质配置写入到对应目录的配置文件中
// 将材质配置写入到对应目录的配置文件中
filesManager
.
readConfig
().
then
((
path
)
=>
{
filesManager
.
readConfig
().
then
((
path
)
=>
{
filesManager
.
configPath
=
path
;
filesManager
.
configPath
=
path
;
filesManager
.
writeFile
(
`
${
to
}
matConfig.json`
,
this
.
configJson
,
{
flag
:
"w"
},
(
err
)
=>
{
filesManager
.
writeFile
(
`
${
to
}
matConfig.json`
,
this
.
configJson
,
{
flag
:
'w'
},
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
throw
err
;
throw
err
;
}
else
{
}
else
{
console
.
log
(
"写入成功"
);
console
.
log
(
'写入成功'
);
}
}
})
})
});
});
...
...
SwordMaterialIDEA/tsSrc/filesManager.ts
View file @
5d6eba45
...
@@ -106,7 +106,7 @@ export class FilesManager{
...
@@ -106,7 +106,7 @@ export class FilesManager{
let rootUrl = `./models/${format}/${name}/`;
let rootUrl = `./models/${format}/${name}/`;
let abUrl = `E:/WorkFiles/NW_Sword_Material_IDEA/SwordMaterialIDEA/models/${format}/${name}/`;
let abUrl = `E:/WorkFiles/NW_Sword_Material_IDEA/SwordMaterialIDEA/models/${format}/${name}/`;
let textureUrls:string[] = [];
let textureUrls:string[] = [];
fs.readFile(from,
'
utf
-
8
'
, (err, data) => {
fs.readFile(from,
{encoding:"utf-8"}
, (err, data) => {
// 读取文件失败/错误
// 读取文件失败/错误
if (err) {
if (err) {
throw err;
throw err;
...
@@ -117,7 +117,7 @@ export class FilesManager{
...
@@ -117,7 +117,7 @@ export class FilesManager{
let mtlUrl = data.toString().split("mtllib ")[1].split('
#
')[0].replace(/[
\
r
\
n]/g,"");
let mtlUrl = data.toString().split("mtllib ")[1].split('
#
')[0].replace(/[
\
r
\
n]/g,"");
let abMtlUrl = `${fromPath}${mtlUrl}`
let abMtlUrl = `${fromPath}${mtlUrl}`
this.copyFile(`${fromPath}/${name}.mtl`,`${abUrl}${name}.mtl`).then(()=>{
this.copyFile(`${fromPath}/${name}.mtl`,`${abUrl}${name}.mtl`).then(()=>{
fs.readFile(abMtlUrl,
'
utf
-
8
'
,(err, data)=>{
fs.readFile(abMtlUrl,
{encoding:"utf-8"}
,(err, data)=>{
if(err){
if(err){
throw err
throw err
}
}
...
...
SwordMaterialIDEA/tsSrc/importConfigs.ts
View file @
5d6eba45
import
{
FilesManager
}
from
'./filesManager'
;
export
class
ImportConfigs
{
export
class
ImportConfigs
{
// 导入材质配置
// 导入材质配置
constructor
(){
constructor
(){
}
}
private
fs
=
window
[
'require'
](
'fs'
);
public
load
(
from
){
public
load
(
from
){
let
filesManager
=
new
FilesManager
()
let
scope
=
this
;
const
fs
=
window
[
'require'
](
'fs'
);
let
url
=
`
${
from
}
matConfig.json`
fs
.
readFile
(
from
,
{
encoding
:
'unf8'
},
)
scope
.
fs
.
exists
(
url
,
function
(
exists
)
{
if
(
exists
){
// 如果存在材质的配置文件,则读取
scope
.
fs
.
readFile
(
url
,
{
encoding
:
"utf-8"
},
(
err
,
data
)
=>
{
// 读取文件失败/错误
debugger
if
(
err
)
{
throw
err
;
}
// 读取文件成功
console
.
log
(
'已读'
)
console
.
log
(
data
)
let
obj
=
JSON
.
parse
(
data
)
console
.
log
(
obj
)
})
}
});
}
}
}
}
\ No newline at end of file
SwordMaterialIDEA/tsSrc/sceneManager.ts
View file @
5d6eba45
...
@@ -35,7 +35,7 @@ export class SceneManager {
...
@@ -35,7 +35,7 @@ export class SceneManager {
scope
.
camera
.
attachControl
(
canvas
,
true
);
scope
.
camera
.
attachControl
(
canvas
,
true
);
// 相机的自动旋转行为
// 相机的自动旋转行为
scope
.
camera
.
useAutoRotationBehavior
=
true
;
scope
.
camera
.
useAutoRotationBehavior
=
true
;
scope
.
camera
.
inertia
=
0
;
scope
.
camera
.
inertia
=
0
.75
;
// 设置相机旋转速度
// 设置相机旋转速度
scope
.
camera
.
behaviors
.
forEach
(
behabior
=>
{
scope
.
camera
.
behaviors
.
forEach
(
behabior
=>
{
if
(
behabior
instanceof
BABYLON
.
AutoRotationBehavior
){
if
(
behabior
instanceof
BABYLON
.
AutoRotationBehavior
){
...
...
SwordMaterialIDEA使用说明.docx
0 → 100644
View file @
5d6eba45
File added
matConfig.json
deleted
100644 → 0
View file @
c33f03b1
,
{
"meshName"
:
"Car_DBS_S"
,
"customType"
:
"none"
},
{
"meshName"
:
"Mesh"
,
"customType"
:
"none"
},
{
"meshName"
:
"MeshWithAnim"
,
"materialName"
:
"Material #69"
,
"customType"
:
"MultiMaterial"
,
"subMaterial"
:
"{},
{
"
materialName
":"
Car_DBS_Paint_S_Game
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 1 G:1 B:1},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0 G:0 B:0},
"
specularPower
":25.6,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_Paint_S_Game.jpg
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
undefined
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
},
{
"
materialName
":"
Car_Dipan_All
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 1 G:1 B:1},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0.3 G:0.3 B:0.3},
"
specularPower
":17.92,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_Dipan_All.jpg
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
undefined
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
},
{
"
materialName
":"
Car_DBS_Details_A
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 1 G:1 B:1},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0.3 G:0.3 B:0.3},
"
specularPower
":17.92,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_Details_A.jpg
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
undefined
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
},
{
"
materialName
":"
Car_DBS_Logo_A
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 0.4179 G:0.4179 B:0.4179},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0.3 G:0.3 B:0.3},
"
specularPower
":17.92,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_Logo_A.png
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
Car_DBS_Logo_A.png
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
},
{
"
materialName
":"
Car_DBS_Glass_A
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 1 G:1 B:1},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0 G:0 B:0},
"
specularPower
":25.6,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_Glass_A.png
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
Car_DBS_Glass_A.png
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
},
{
"
materialName
":"
Car_DBS_Wheel_S
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 1 G:1 B:1},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0 G:0 B:0},
"
specularPower
":25.6,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_Wheel_S.jpg
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
undefined
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
},
{
"
materialName
":"
Car_DBS_UpS_Game
",
"
customType
":StandardMaterial,
"
wireframe
":false,
"
backFaceCulling
":true,
"
needDepthPrePass
":false,
"
alpha
":1,
"
ambientColor
":{R: 1 G:1 B:1},
"
diffuseColor
":{R: 1 G:1 B:1},
"
emissiveColor
":{R: 0 G:0 B:0},
"
specularColor
":{R: 0 G:0 B:0},
"
specularPower
":25.6,
"
useSpecularOverAlpha
":true,
"
diffuseTexture
":"
Car_DBS_UpS_Game.jpg
",
"
ambientTexture
":"
undefined
",
"
emissiveTexture
":"
undefined
",
"
lightmapTexture
":"
undefined
",
"
opacityTexture
":"
undefined
",
"
reflectionTexture
":"
undefined
",
"
refractionTexture
":"
undefined
",
}"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment