浏览我们的产品
Aspose.3D for Java 19.9发行说明
此页面包含Aspose.3D for Java 19.9的发行说明
改进和变更
钥匙 | 摘要 | 类别 |
---|---|---|
THREEDNET-532 | 将3D场景导出到HTML | 新功能 |
THREEDNET-561 | 暴露几何变换属性 | 增强 |
THREEDNET-556 | 几何旋转似乎不正确 | Bug |
公共API和向后不兼容的更改
请参阅对公共API所做的任何更改的列表,如添加、重命名、删除或不推荐使用的成员,以及对Aspose.3D for Java所做的任何非向后兼容的更改。如果您对列出的任何更改有疑问,请在Aspose.3D支持论坛。
添加了新的文件格式HTML5/ASPOSE3D_WEB
/**
\* Aspose.3D Web format.
*/
public static final FileFormat ASPOSE3D_WEB;
/**
\* HTML5 File
*/
public static final FileFormat HTML5;
当您将场景导出到HTML5文件时,实际上会有3个文件,一个HTML文件,一个Aspose3的DWeb文件 (*.a3dw) 和一个渲染的JavaScript文件,您只能通过指定Aspose3的DWeb作为导出类型来导出a3dw文件,并在您自己的HTML页面中重用javascript文件。
示例代码:
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode(new Cylinder());
LambertMaterial mat = new LambertMaterial();
mat.setDiffuseColor(new Vector3(0.34,0.59, 0.41));
node.setMaterial(mat);
Light light = new Light();
light.setLightType(LightType.POINT);
scene.getRootNode().createChildNode(light).getTransform().setTranslation(10, 0, 10);
scene.save("test.html", FileFormat.HTML5);
由于浏览器的安全限制,导出的HTML文件不能直接打开,您需要通过网络服务器打开它,如果您安装了python3,您可以在导出目录中的命令行中启动网络服务器
python3 -m http.server
然后打开它http:// localhost:8000/test.html。web渲染器使用WebGL2,您可以使用https://get.webgl.org/webgl2/检查您的浏览器是否支持它。
添加了新类com.aspose.threed.HTML5SaveOptions
这允许您自定义导出的3D HTML页面
示例代码:
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode(new Cylinder());
LambertMaterial mat = new LambertMaterial();
mat.setDiffuseColor(new Vector3(0.34,0.59, 0.41));
node.setMaterial(mat);
Light light = new Light();
light.setLightType(LightType.POINT);
scene.getRootNode().createChildNode(light).getTransform().setTranslation(10, 0, 10);
HTML5SaveOptions opt = new HTML5SaveOptions();
opt.setShowGrid(false); // Turn off the grid
opt.setShowUI(false); //Turn off the user interface
scene.save("test.html", FileFormat.HTML5);
在类com.aspose.threed.IOConfig中添加了新的属性文件格式
/**
* Gets the file format that specified in current Save/Load option.
*/
public FileFormat getFileFormat();
在类com.aspose.threed.Node中添加了新方法evalateglobaltransform
/**
* Evaluate the global transform, include the geometric transform or not.
* @param withGeometricTransform Whether the geometric transform is needed.
*/
public Matrix4 evaluateGlobalTransform(boolean withGeometricTransform);
Node.GlobalTransform.TransformMatrix之间的区别在于,它允许您获得具有几何变换的变换矩阵,该变换矩阵仅影响附加实体并保持子节点不受影响。
在类com.aspose.threed中添加了新的吸气剂/setter getGeometricTranslation/setGeometricScaling/setGeometricRotation/setgeometrication
/**
* Gets the geometric translation.
* Geometric transformation only affects the entities attached and leave the child nodes unaffected.
* It will be merged as local transformation when you export the geometric transformation to file types that does not support it.
*/
public Vector3 getGeometricTranslation();
/**
* Sets the geometric translation.
* Geometric transformation only affects the entities attached and leave the child nodes unaffected.
* It will be merged as local transformation when you export the geometric transformation to file types that does not support it.
* @param value New value
*/
public void setGeometricTranslation(Vector3 value);
/**
* Gets the geometric scaling.
* Geometric transformation only affects the entities attached and leave the child nodes unaffected.
* It will be merged as local transformation when you export the geometric transformation to file types that does not support it.
*/
public Vector3 getGeometricScaling();
/**
* Sets the geometric scaling.
* Geometric transformation only affects the entities attached and leave the child nodes unaffected.
* It will be merged as local transformation when you export the geometric transformation to file types that does not support it.
* @param value New value
*/
public void setGeometricScaling(Vector3 value);
/**
* Gets the geometric euler rotation(measured in degree).
* Geometric transformation only affects the entities attached and leave the child nodes unaffected.
* It will be merged as local transformation when you export the geometric transformation to file types that does not support it.
*/
public Vector3 getGeometricRotation();
/**
* Sets the geometric euler rotation(measured in degree).
* Geometric transformation only affects the entities attached and leave the child nodes unaffected.
* It will be merged as local transformation when you export the geometric transformation to file types that does not support it.
* @param value New value
*/
public void setGeometricRotation(Vector3 value);
示例代码:
Node n = new Node();
n.getTransform().setGeometricTranslation(new Vector3(10, 0, 0));
System.out.println(n.evaluateGlobalTransform(true));
System.out.println(n.evaluateGlobalTransform(false));
第一个print语句将输出包含几何变换的变换矩阵,而第二个则不输出。