Package com.jme3.material

Examples of com.jme3.material.MatParam


    });
  }
 
  public void setAmbientLight(final boolean on) {
    if (al == null) {
      al = new AmbientLight();
      al.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
    }
    this.enqueue(new Callable<Integer>(){
      public Integer call() throws Exception {
        if (on) {
View Full Code Here


    //addEntity(ship);
   
   
   
    //addEntity(new RoidField("Roids", "Models/RoidField/Roid.mesh.xml"));
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White.mult(0.5f));
    mapNode.addLight(al);
   
   
    /*
    DirectionalLight sun = new DirectionalLight();
View Full Code Here

  }
 
  public void setDirectionalLight(final boolean on) {
    if (dl == null) {
      Vector3f lightDir = new Vector3f(-0.8719428f, -0.46824604f, 0.14304268f);
      dl = new DirectionalLight();
      dl.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
      dl.setDirection(lightDir);

      Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f);
      dl2 = new DirectionalLight();
      dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f));
      dl2.setDirection(lightDir2);
    }
    this.enqueue(new Callable<Integer>(){
      public Integer call() throws Exception {
View Full Code Here

      }
    });
  }
 
  private PointLight getPointLight() {
    PointLight ll = new PointLight();
    ll.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
    ll.setRadius(20f);
    return ll;
  }
View Full Code Here

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
        lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
        lightMdl.getMesh().setStatic();
        rootNode.attachChild(lightMdl);

        pl = new PointLight();
        pl.setColor(ColorRGBA.White);
        //pl.setRadius(3f);
        rootNode.addLight(pl);
    }
View Full Code Here

    return grassPatch;
  }

  private static boolean isGrassLayer(Vector3f pos, Geometry terrain,
      float intensitiyThreshold, float scaledWidth, int channelId) {
    MatParam matParam = terrain.getMaterial().getParam("AlphaMap");
    if (matParam == null)// try to get the default one..
      matParam = terrain.getMaterial().getParam("DiffuseMap");
    if (matParam == null)
      return false;
    Texture tex = (Texture) matParam.getValue();
    Image image = tex.getImage();
    Vector2f uv = getPointPercentagePosition(terrain, pos, scaledWidth);

    ByteBuffer buf = image.getData(0);
    int width = image.getWidth();
View Full Code Here

    public boolean equalsParams(ListMap params, TechniqueDef def) {
       
        int size = 0;

        for(int i = 0; i < params.size() ; i++ ) {
            MatParam param = (MatParam)params.getValue(i);
            String key = def.getShaderParamDefine(param.getName());
            if (key != null) {
                Object val = param.getValue();
                if (val != null) {

                    switch (param.getVarType()) {
                    case Boolean: {
                        String current = defines.get(key);
                        if (((Boolean) val).booleanValue()) {
                            if (current == null || current != ONE) {
                                return false;
View Full Code Here

                String multiplicity = mapping.getLeftVariable().getMultiplicity();
                try {
                    Integer.parseInt(multiplicity);
                } catch (NumberFormatException nfe) {
                    //multiplicity is not an int attempting to find for a material parameter.
                    MatParam mp = findMatParam(multiplicity);
                    if (mp != null) {
                        addDefine(multiplicity);
                        multiplicity = multiplicity.toUpperCase();
                    } else {
                        throw new MatParseException("Wrong multiplicity for variable" + mapping.getLeftVariable().getName() + ". " + multiplicity + " should be an int or a declared material parameter.", statement);
View Full Code Here

     * @throws IOException
     */
    public void extractCondition(String cond, Statement statement) throws IOException {
        List<String> defines = conditionParser.extractDefines(cond);
        for (String string : defines) {
            MatParam param = findMatParam(string);
            if (param != null) {
                addDefine(param.getName());
            } else {
                throw new MatParseException("Invalid condition, condition must match a Material Parameter named " + cond, statement);
            }
        }
    }
View Full Code Here

            }
            updateVarFromAttributes(mapping.getRightVariable(), mapping);
            //          updateCondition(mapping.getRightVariable(), mapping);
            storeAttribute(mapping.getRightVariable());
        } else if (right.getNameSpace().equals("MatParam")) {
            MatParam param = findMatParam(right.getName());
            if (param == null) {
                throw new MatParseException("Could not find a Material Parameter named " + right.getName(), statement1);
            }
            if (shaderNode.getDefinition().getType() == Shader.ShaderType.Vertex) {
                if (updateRightFromUniforms(param, mapping, vertexDeclaredUniforms, statement1)) {                 
                    storeVertexUniform(mapping.getRightVariable());
                }
            } else {
                if (updateRightFromUniforms(param, mapping, fragmentDeclaredUniforms, statement1)) {
                    if (mapping.getRightVariable().getType().contains("|")) {
                        String type = fixSamplerType(left.getType(), mapping.getRightVariable().getType());
                        if (type != null) {
                            mapping.getRightVariable().setType(type);
                        } else {
                            throw new MatParseException(param.getVarType().toString() + " can only be matched to one of " + param.getVarType().getGlslType().replaceAll("\\|", ",") + " found " + left.getType(), statement1);
                        }
                    }               
                    storeFragmentUniform(mapping.getRightVariable());
                }
            }
View Full Code Here

TOP

Related Classes of com.jme3.material.MatParam

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.