Package com.jme3.scene.plugins.blender.file

Examples of com.jme3.scene.plugins.blender.file.Pointer


     * @throws BlenderFileException
     *             this exception is thrown when the blend file structure is somehow invalid or corrupted
     */
    private List<byte[]> getVerticesColors(Structure meshStructure, BlenderContext blenderContext) throws BlenderFileException {
        MeshHelper meshHelper = blenderContext.getHelper(MeshHelper.class);
        Pointer pMCol = (Pointer) meshStructure.getFieldValue(meshHelper.isBMeshCompatible(meshStructure) ? "mloopcol" : "mcol");
        List<byte[]> verticesColors = null;
        // it was likely a bug in blender untill version 2.63 (the blue and red factors were misplaced in their structure)
        // so we need to put them right
        boolean useBGRA = blenderContext.getBlenderVersion() < 263;
        if (pMCol.isNotNull()) {
            List<Structure> mCol = pMCol.fetchData();
            verticesColors = new ArrayList<byte[]>(mCol.size());
            for (Structure color : mCol) {
                byte r = ((Number) color.getFieldValue("r")).byteValue();
                byte g = ((Number) color.getFieldValue("g")).byteValue();
                byte b = ((Number) color.getFieldValue("b")).byteValue();
View Full Code Here


     */
    protected Properties loadProperties(Structure structure, BlenderContext blenderContext) throws BlenderFileException {
        Properties properties = null;
        Structure id = (Structure) structure.getFieldValue("ID");
        if (id != null) {
            Pointer pProperties = (Pointer) id.getFieldValue("properties");
            if (pProperties.isNotNull()) {
                Structure propertiesStructure = pProperties.fetchData().get(0);
                properties = new Properties();
                properties.load(propertiesStructure, blenderContext);
            }
        }
        return properties;
View Full Code Here

     * @return a list of vertices colors, each color belongs to a single vertex
     * @throws BlenderFileException
     *             this exception is thrown when the blend file structure is somehow invalid or corrupted
     */
    public MaterialContext[] getMaterials(Structure structureWithMaterials, BlenderContext blenderContext) throws BlenderFileException {
        Pointer ppMaterials = (Pointer) structureWithMaterials.getFieldValue("mat");
        MaterialContext[] materials = null;
        if (ppMaterials.isNotNull()) {
            List<Structure> materialStructures = ppMaterials.fetchData();
            if (materialStructures != null && materialStructures.size() > 0) {
                MaterialHelper materialHelper = blenderContext.getHelper(MaterialHelper.class);
                materials = new MaterialContext[materialStructures.size()];
                int i = 0;
                for (Structure s : materialStructures) {
View Full Code Here

        ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
        Node result = new Node(structure.getName());
        try {
            List<Structure> base = ((Structure) structure.getFieldValue("base")).evaluateListBase();
            for (Structure b : base) {
                Pointer pObject = (Pointer) b.getFieldValue("object");
                if (pObject.isNotNull()) {
                    Structure objectStructure = pObject.fetchData().get(0);

                    Object object = objectHelper.toObject(objectStructure, blenderContext);
                    if (object instanceof LightNode) {
                        result.addLight(((LightNode) object).getLight());
                        result.attachChild((LightNode) object);
View Full Code Here

        app.start();
    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
View Full Code Here

  private Material mat;
  private Geometry atmo;

  @Override
  public void simpleInitApp() {
    Sphere atmoSphere = new Sphere(48, 48, radius, false, true);
    mat = new Material(assetManager, "MatDefs/SimpleAtmoshere.j3md");
   
    mat.setFloat("radius", radius);
    atmo = new Geometry("atmo_Planet", atmoSphere);
   
    Vector3f pos = new Vector3f(5,0,0);
    atmo.setLocalTranslation(pos);
    mat.setVector3("v3Center", pos);
   
   
    atmo.setMaterial(mat);
      rootNode.attachChild(atmo);
     
      Sphere planetSphere = new Sphere(48, 48, radius * 0.8f);
      Material planteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      planteMat.setColor("Color", ColorRGBA.Green);
      Geometry planet = new Geometry("geo_Planet", planetSphere);
      planet.setLocalTranslation(pos);
      planet.setMaterial(planteMat);
View Full Code Here

        mat.setColor("m_Specular", ColorRGBA.Red);
       
        teapot.setMaterial(mat);
        rootNode.attachChild(teapot);

        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();
View Full Code Here

     * Starts the application. Creating a display and running the main loop.
     */
    public void start(){

        if (settings == null){
            settings = new AppSettings(true);
        }
       
        context = JmeSystem.newContext(settings, JmeContext.Type.OffscreenSurface);
        context.setSystemListener(this);
        context.create(false);
View Full Code Here

      new ModelInfo(activeModel, app.getAssetLogger().getKeys(activeModel.getRelPath(workspace)));
    } catch (Exception e) {}
  }

  public static void createCanvas(){
    AppSettings settings = new AppSettings(true);
    settings.setWidth( Math.max(640, frame.getContentPane().getWidth()) );
    settings.setHeight( Math.max(480, frame.getContentPane().getHeight()) );

    app = new EditorApp();

    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();

    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
  }
View Full Code Here

    */
    Geometry g = new Geometry("Bubble", b);
    g.rotate(FastMath.HALF_PI, 0, FastMath.HALF_PI);
    //g.scale(1, 1, -1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Texture tex = assetManager.loadTexture("Textures/test3.png");
    mat.setTexture("ColorMap", tex);
    //mat.setColor("Color", ColorRGBA.Blue);
    //mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
   
View Full Code Here

TOP

Related Classes of com.jme3.scene.plugins.blender.file.Pointer

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.