标签:Material 1.0 Color material Appearance Cesium new
image.png
比较通用的有两个:
Cesium.MaterialAppearance(options) 可以设置纹理图案
Cesium.PerInstanceColorAppearance(options) 主要用于颜色属性,与 Cesium.GeometryInstance中attributes中 colo属性 ; 每个GeometryInstance 一个颜色;
另外需要注意:
EllipsoidSurfaceAppearance / MaterialAppearance / PolylineMaterialAppearance 可设置Material属性
PerInstanceColorAppearance / PolylineColorAppearance 不可设置Material属性,只可更改颜色
//Add Primitives
scene.primitives.add(new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : Cesium.BoxGeometry.fromDimensions({
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0)
}),
modelMatrix : Cesium.Matrix4.multiplyByTranslation(
Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-105.0, 45.0)),
new Cesium.Cartesian3(0.0, 0.0, 250000), new Cesium.Matrix4()),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED.withAlpha(0.5))
}
}),
appearance : new Cesium.PerInstanceColorAppearance({
closed: true
})
}));
MaterialAppearance
http://localhost:8080/Apps/Sandcastle/index.html?src=Materials.html&label=Development
image.png
function applyDiffuseMaterial(primitive, scene) {
Sandcastle.declare(applyDiffuseMaterial); // For highlighting in Sandcastle.
primitive.appearance.material = new Cesium.Material({
fabric : {
type : 'DiffuseMap',
uniforms : {
image : '../images/Cesium_Logo_Color.jpg'
}
}
});
}
MaterialAppearance2
image.png
scene.primitives.add(new Cesium.Primitive({
geometryInstances : polygonInstance,
appearance : new Cesium.MaterialAppearance({
material : Cesium.Material.fromType('Checkerboard'),
materialSupport : Cesium.MaterialAppearance.MaterialSupport.TEXTURED
})
}));
PolylineColorAppearance
image.png
Material 文档
// Create a color material with fromType:
polygon.material = Cesium.Material.fromType('Color');
polygon.material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0);
// Create the default material:
polygon.material = new Cesium.Material();
// Create a color material with full Fabric notation:
polygon.material = new Cesium.Material({
fabric : {
type : 'Color',
uniforms : {
color : new Cesium.Color(1.0, 1.0, 0.0, 1.0)
}
}
});
本文转自 https://www.jianshu.com/p/ad1b6271e937,如有侵权,请联系删除。
标签:Material,1.0,Color,material,Appearance,Cesium,new 来源: https://www.cnblogs.com/hustshu/p/15248850.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。