package com.jukusoft.renderer2d.prototyp.engine.mesh;

/**
 * Created by Justin on 24.08.2016.
 */
public class GPUMesh<T extends Mesh> {

    /**
    * instance of mesh
    */
    protected final T mesh;

    public GPUMesh(T mesh) {
        this.mesh = mesh;
    }

    public long getID () {
        return this.mesh.getID();
    }

    public T getMesh () {
        return this.mesh;
    }

    public void cleanUp () {
        //
    }

    @Override
    public void finalize () {
        this.cleanUp();
    }

}

@@ -99,16 +99,25 @@
 %0Apublic 
+abstract 
 class GP
@@ -137,16 +137,41 @@
 ds Mesh%3E
+ implements AutoCloseable
  %7B%0A%0A    
@@ -233,16 +233,118 @@
  mesh;%0A%0A
+    /**%0A    * flag if mesh was cleaned up%0A    */%0A    protected volatile boolean isCleanedUp = false;%0A%0A
     publ
@@ -539,84 +539,354 @@
 lic 
-void cleanUp () %7B%0A        //%0A    %7D%0A%0A    @Override%0A    public void finalize (
+abstract void init ();%0A%0A    public abstract void render ();%0A%0A    public abstract void cleanUp ();%0A%0A    @Override%0A    public void finalize () %7B%0A        if (!this.isCleanedUp) %7B%0A            this.cleanUp();%0A%0A            this.isCleanedUp = true;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void close () throws Exception %7B%0A        if (!this.isCleanedUp
 ) %7B%0A
@@ -885,32 +885,36 @@
 edUp) %7B%0A        
+    
 this.cleanUp();%0A
@@ -912,16 +912,64 @@
 eanUp();
+%0A%0A            this.isCleanedUp = true;%0A        %7D
 %0A    %7D%0A%0A

change class GPUMesh, added support for AutoClosable.