Search in sources :

Example 1 with MaterialOptions

use of org.cesiumjs.cs.scene.options.MaterialOptions in project gwt-cs by iSergio.

the class Materials method applyNormalMapMaterial.

public void applyNormalMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/bumpmap.png"));
    JSONObject diffuseMaterial = new JSONObject();
    diffuseMaterial.put("type", new JSONString("DiffuseMap"));
    diffuseMaterial.put("uniforms", uniforms);
    uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/normalmap.png"));
    uniforms.put("strength", new JSONNumber(0.6));
    JSONObject normalMap = new JSONObject();
    normalMap.put("type", new JSONString("NormalMap"));
    normalMap.put("uniforms", uniforms);
    JSONObject materials = new JSONObject();
    materials.put("diffuseMaterial", diffuseMaterial);
    materials.put("normalMap", normalMap);
    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("diffuseMaterial.diffuse"));
    components.put("specular", new JSONNumber(0.01));
    components.put("normal", new JSONString("normalMap.normal"));
    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);
    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) MaterialOptions(org.cesiumjs.cs.scene.options.MaterialOptions) JSONNumber(com.google.gwt.json.client.JSONNumber) Material(org.cesiumjs.cs.scene.Material) JSONString(com.google.gwt.json.client.JSONString)

Example 2 with MaterialOptions

use of org.cesiumjs.cs.scene.options.MaterialOptions in project gwt-cs by iSergio.

the class Materials method applyWaterMaterial.

public void applyWaterMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("specularMap", new JSONString(GWT.getModuleBaseURL() + "images/earthspec1k.jpg"));
    uniforms.put("normalMap", new JSONString(GWT.getModuleBaseURL() + "images/waterNormals.jpg"));
    uniforms.put("frequency", new JSONNumber(10000.0));
    uniforms.put("animationSpeed", new JSONNumber(0.01));
    uniforms.put("amplitude", new JSONNumber(1.0));
    JSONObject fabric = new JSONObject();
    fabric.put("type", new JSONString("Water"));
    fabric.put("uniforms", uniforms);
    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) MaterialOptions(org.cesiumjs.cs.scene.options.MaterialOptions) JSONNumber(com.google.gwt.json.client.JSONNumber) Material(org.cesiumjs.cs.scene.Material) JSONString(com.google.gwt.json.client.JSONString)

Example 3 with MaterialOptions

use of org.cesiumjs.cs.scene.options.MaterialOptions in project gwt-cs by iSergio.

the class Materials method applyBumpMapMaterial.

public void applyBumpMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/bumpmap.png"));
    JSONObject diffuseMaterial = new JSONObject();
    diffuseMaterial.put("type", new JSONString("DiffuseMap"));
    diffuseMaterial.put("uniforms", uniforms);
    uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/bumpmap.png"));
    uniforms.put("strength", new JSONNumber(0.8));
    JSONObject bumpMaterial = new JSONObject();
    bumpMaterial.put("type", new JSONString("BumpMap"));
    bumpMaterial.put("uniforms", uniforms);
    JSONObject materials = new JSONObject();
    materials.put("diffuseMaterial", diffuseMaterial);
    materials.put("bumpMaterial", bumpMaterial);
    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("diffuseMaterial.diffuse"));
    components.put("specular", new JSONNumber(0.01));
    components.put("normal", new JSONString("bumpMaterial.normal"));
    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);
    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) MaterialOptions(org.cesiumjs.cs.scene.options.MaterialOptions) JSONNumber(com.google.gwt.json.client.JSONNumber) Material(org.cesiumjs.cs.scene.Material) JSONString(com.google.gwt.json.client.JSONString)

Example 4 with MaterialOptions

use of org.cesiumjs.cs.scene.options.MaterialOptions in project gwt-cs by iSergio.

the class Materials method applyAlphaMapMaterial.

public void applyAlphaMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/Cesium_Logo_Color.jpg"));
    uniforms.put("channel", new JSONString("r"));
    JSONObject alphaMaterial = new JSONObject();
    alphaMaterial.put("type", new JSONString("AlphaMap"));
    alphaMaterial.put("uniforms", uniforms);
    JSONObject materials = new JSONObject();
    materials.put("alphaMaterial", alphaMaterial);
    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("vec3(1.0)"));
    components.put("alpha", new JSONString("alphaMaterial.alpha"));
    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);
    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) MaterialOptions(org.cesiumjs.cs.scene.options.MaterialOptions) Material(org.cesiumjs.cs.scene.Material) JSONString(com.google.gwt.json.client.JSONString)

Example 5 with MaterialOptions

use of org.cesiumjs.cs.scene.options.MaterialOptions in project gwt-cs by iSergio.

the class Materials method applyDiffuseMaterial.

public void applyDiffuseMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/Cesium_Logo_Color.jpg"));
    JSONObject fabric = new JSONObject();
    fabric.put("type", new JSONString("DiffuseMap"));
    fabric.put("uniforms", uniforms);
    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) MaterialOptions(org.cesiumjs.cs.scene.options.MaterialOptions) Material(org.cesiumjs.cs.scene.Material) JSONString(com.google.gwt.json.client.JSONString)

Aggregations

JSONObject (com.google.gwt.json.client.JSONObject)9 JSONString (com.google.gwt.json.client.JSONString)9 Material (org.cesiumjs.cs.scene.Material)9 MaterialOptions (org.cesiumjs.cs.scene.options.MaterialOptions)9 JSONNumber (com.google.gwt.json.client.JSONNumber)4