com.supermap.data
类 Material3D
- java.lang.Object
-
- com.supermap.data.InternalHandle
-
- com.supermap.data.InternalHandleDisposable
-
- com.supermap.data.Material3D
-
- 所有已实现的接口:
- IDisposable
- 直接已知子类:
- Material3DPBR
public class Material3D extends com.supermap.data.InternalHandleDisposable
材质类。- 作者:
- wangyanyan
-
-
构造器概要
构造器 构造器和说明 Material3D()
默认构造函数,构造一个新的Material3D对象。Material3D(Material3D materialSrc)
根据给定的 Material3D 对象构造一个与其完全相同的新对象Material3D(String name)
根据材质名称,构造一个新的Material3D对象。
-
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 限定符和类型 方法和说明 int
addTexture(String imagePath)
添加纹理图片。int
addTexture(TextureData data)
材质增加纹理。boolean
check()
检查材质对象是否合法。void
dispose()
释放该对象所占用的资源。static Material3D
fromJSON(String jsonFile)
已过时。static Material3D
fromJSON(String jsonFile, boolean isExternalTextures)
通过JSON导入material3D。Color
getMaterialColor()
返回材质颜色。MaterialType
getMaterialType()
返回材质类型。Matrix
getMatrix(int iTexture)
返回材质矩阵。String
getName()
返回材质名称。TextureData
getTexture()
已过时。TextureData
getTexture(int index)
返回材质的纹理,根据索引获取纹理。int
getTextureCount()
返回材质上的纹理个数。ArrayList<TextureData>
getTextures()
返回纹理贴图集合。TextureWrapMode
getTextureWrapMode(int iTexture)
设置纹理贴图模式。boolean
removeTexture(int index)
材质移除纹理。void
removeTextures()
移除Material3D对象上的所有纹理。void
setMaterialColor(Color value)
设置材质颜色。void
setName(String value)
设置材质名称 材质名称作为材质的唯一标识,当设置的材质名称相同时,材质也需要相同。void
setPosition(int iTexture, Point3D pnt)
设置纹理坐标在XYZ方向上的偏移。void
setRotate(int iTexture, double dbX, double dbY, double dbZ)
设置纹理UV的旋转角度。void
setScale(int iTexture, double dbX, double dbY, double dbZ)
设置纹理UV的缩放比例。void
setTexture(TextureData value)
已过时。void
setTextures(ArrayList<TextureData> value)
设置纹理贴图集合。void
setTextureWrapMode(int iTexture, TextureWrapMode mode)
设置纹理贴图模式。boolean
toJSON(String jsonFile)
将模型数据中的材质输出为json文件,支持导出纹理。boolean
updateTexture(int index, TextureData data)
材质更新纹理。
-
-
-
构造器详细资料
-
Material3D
public Material3D()
默认构造函数,构造一个新的Material3D对象。
-
Material3D
public Material3D(Material3D materialSrc)
根据给定的 Material3D 对象构造一个与其完全相同的新对象- 参数:
materialSrc
- 给定的 Material3D 对象
-
Material3D
public Material3D(String name)
根据材质名称,构造一个新的Material3D对象。- 参数:
name
- 材质名称
-
-
方法详细资料
-
dispose
public void dispose()
释放该对象所占用的资源。当调用该方法后,此对象不再可用。
-
setName
public void setName(String value)
设置材质名称材质名称作为材质的唯一标识,当设置的材质名称相同时,材质也需要相同。如材质名称相同而材质不同,会出现被追加对象的材质修改成追加对象的材质。
- 参数:
value
- 指定的材质名称。
-
getName
public String getName()
返回材质名称。- 返回:
- 材质名称。
-
getTextures
public ArrayList<TextureData> getTextures()
返回纹理贴图集合。- 返回:
- 纹理贴图集合。
-
setTextures
public void setTextures(ArrayList<TextureData> value)
设置纹理贴图集合。- 参数:
value
- 纹理贴图集合。
-
addTexture
public int addTexture(TextureData data)
材质增加纹理。- 参数:
data
- 纹理数据。- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
removeTexture
public boolean removeTexture(int index)
材质移除纹理。- 参数:
index
- 将要移除纹理的序号。- 返回:
- 若返回 true表示删除成功;返回 false表示删除失败。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
updateTexture
public boolean updateTexture(int index, TextureData data)
材质更新纹理。- 参数:
index
- 将要更新纹理的序号。data
- 纹理数据。- 返回:
- 若返回 true表示更新成功;返回 false表示更新失败。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
getTexture
@Deprecated public TextureData getTexture()
已过时。
-
getTexture
public TextureData getTexture(int index)
返回材质的纹理,根据索引获取纹理。- 参数:
index
- 索引。- 返回:
- 纹理。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
setTexture
@Deprecated public void setTexture(TextureData value) throws IOException
已过时。- 抛出:
IOException
-
setMaterialColor
public void setMaterialColor(Color value)
设置材质颜色。- 参数:
value
- 材质颜色
-
getMaterialColor
public Color getMaterialColor()
返回材质颜色。- 返回:
- 材质颜色。
-
check
public boolean check()
检查材质对象是否合法。
-
setPosition
public void setPosition(int iTexture, Point3D pnt)
设置纹理坐标在XYZ方向上的偏移。- 参数:
iTexture
- 指定的贴图索引,如果只有一张贴图,则输入0。pnt
- 指定UV在XYZ方向上的偏移值,一般为Point3D类型。
-
setRotate
public void setRotate(int iTexture, double dbX, double dbY, double dbZ)
设置纹理UV的旋转角度。- 参数:
iTexture
- 指定的贴图索引,如果只有一张贴图,则输入0。dbX
- X方向的旋转角度(弧度)。dbY
- Y方向的旋转角度(弧度)。dbZ
- Z方向的旋转角度(弧度)。
-
setScale
public void setScale(int iTexture, double dbX, double dbY, double dbZ)
设置纹理UV的缩放比例。- 参数:
iTexture
- 指定的贴图索引,如果只有一张贴图,则输入0。dbX
- X方向缩放倍数。dbY
- Y方向缩放倍数。dbZ
- Z方向缩放倍数。
-
getMatrix
public Matrix getMatrix(int iTexture)
返回材质矩阵。- 参数:
iTexture
- 材质矩阵序号。- 返回:
- 材质矩阵。
-
setTextureWrapMode
public void setTextureWrapMode(int iTexture, TextureWrapMode mode)
设置纹理贴图模式。- 参数:
iTexture
- 指定的贴图索引,如果只有一张贴图,则输入0。mode
- 纹理贴图模式。
-
getTextureWrapMode
public TextureWrapMode getTextureWrapMode(int iTexture)
设置纹理贴图模式。- 参数:
iTexture
- 指定的贴图索引,如果只有一张贴图,则输入0。- 返回:
-
removeTextures
public void removeTextures()
移除Material3D对象上的所有纹理。
-
getMaterialType
public MaterialType getMaterialType()
返回材质类型。- 返回:
- 材质类型,默认PBR材质。
-
addTexture
public int addTexture(String imagePath)
添加纹理图片。- 参数:
imagePath
- 纹理图片路径。
-
getTextureCount
public int getTextureCount()
返回材质上的纹理个数。- 返回:
- 纹理个数。
-
fromJSON
@Deprecated public static Material3D fromJSON(String jsonFile)
已过时。通过JSON导入material3D。- 参数:
jsonFile
- json文件全路径。- 返回:
- 材质。
-
fromJSON
public static Material3D fromJSON(String jsonFile, boolean isExternalTextures)
通过JSON导入material3D。- 参数:
jsonFile
- json文件全路径。isExternalTextures
- 是否外挂纹理。- 返回:
- 材质。
-
toJSON
public boolean toJSON(String jsonFile)
将模型数据中的材质输出为json文件,支持导出纹理。- 参数:
jsonFile
- json文件全路径。- 返回:
- 返回true表示导出成功,false表示导出失败。
-
-
Copyright © 2021–2024 SuperMap. All rights reserved.