Skip to content

Commit

Permalink
noesis plugin now supports specular texture
Browse files Browse the repository at this point in the history
  • Loading branch information
majimboo committed May 16, 2017
1 parent 99cfc7c commit 33e0834
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 11 deletions.
Binary file modified noesis/plugins/python/__pycache__/data_quake2.cpython-32.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/fmt_pvrtc_pvr.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/fmt_quake2_bsp.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/fmt_quake2_wal.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/fmt_sof1pc_m32.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/fmt_uoclassic.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/fmt_ys_aia.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/inc_adpcm.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/inc_noesis.cpython-32.pyc
Binary file not shown.
Binary file modified noesis/plugins/python/__pycache__/noewin.cpython-32.pyc
Binary file not shown.
44 changes: 33 additions & 11 deletions noesis/plugins/python/fmt_artstation_mview.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,28 @@ def loadModel(data, mdlList):
# load all the materials
for mat in scene["materials"]:
name = mat["name"]

fdiffuse = mat["albedoTex"]
ftypediffuse = os.path.splitext(fdiffuse)[1]
diffuse = loadTex(files, fdiffuse)
texList.append(diffuse)
material = NoeMaterial(name, fdiffuse)

if "normalTex" in mat:
fnormal = mat["normalTex"]
normal = loadTex(files, fnormal)
texList.append(normal)
material.setNormalTexture(fnormal)

diffuse = None
if ftypediffuse == ".jpg":
diffuse = find(files["image/jpeg"], "filename", fdiffuse)["data"]
if ftypediffuse == ".png":
diffuse = find(files["image/png"], "filename", fdiffuse)["data"]
if "reflectivityTex" in mat:
fspecular = mat["reflectivityTex"]
specular = loadTex(files, fspecular)
texList.append(specular)
material.setSpecularTexture(fspecular)

texture_d = rapi.loadTexByHandler(diffuse, ftypediffuse)
texture_d.name = fdiffuse
if "alphaTest" in mat:
material.setAlphaTest(mat["alphaTest"])

texList.append(texture_d)
matList.append(NoeMaterial(name, fdiffuse))
matList.append(material)

# load all the mesh
for mesh in scene["meshes"]:
Expand Down Expand Up @@ -194,4 +202,18 @@ def find(lst, key, value):
for i, dic in enumerate(lst):
if dic[key] == value:
return lst[i]
return -1
return -1

def loadTex(files, fname):
ftype = os.path.splitext(fname)[1]

data = None
if ftype == ".jpg":
data = find(files["image/jpeg"], "filename", fname)["data"]
if ftype == ".png":
data = find(files["image/png"], "filename", fname)["data"]

tex = rapi.loadTexByHandler(data, ftype)
tex.name = fname

return tex

0 comments on commit 33e0834

Please sign in to comment.