Aktualisierungen Dezember, 2011 Kommentarverlauf ein-/ausschalten | Tastaturkürzel

  • Andreas Höhmann 9:43 am Thursday, 15. December 2011 Permalink |
    Tags: ,   

    Use maven profile to recompile vaadin widgetset 

    Today I will show you my maven profile to configure Vaadin widgetset recompilation.

    The Vaadin wiki shows the basics … but I want widgetset update only if its necessary … so I moved the gwt/vaadin plugins in a profile and add a activation per file for this profile:

    <profile>
       <!--
         Updates Vaadin widgetset definitions based on project dependencies
         Remove widgetset directory to trigger recompile:
           rm -Rf src/main/webapp/VAADIN/widgetsets/
       -->
       <id>update-widgetset</id>
       <activation>
         <file>
           ${basedir}/src/main/webapp/VAADIN/widgetsets/
         </file>
       </activation>
       <build>
         <plugins>
           <plugin>
             <groupId>com.vaadin</groupId>
             <artifactId>vaadin-maven-plugin</artifactId>
             <version>1.0.2</version>
             <configuration>
               <!-- if you don't specify any modules, the plugin will find them -->
             </configuration>
             <executions>
               <execution>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>update-widgetset</goal>
                 </goals>
               </execution>
             </executions>
           </plugin>
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>gwt-maven-plugin</artifactId>
             <version>2.3.0-1</version>
             <configuration>
               <!-- if you don't specify any modules, the plugin will find them -->
               ${basedir}/src/main/webapp/VAADIN/widgetsets/
               -Xmx512M -Xss1024k
               ${project.build.directory}/gwt-tmp/
               <soyc>false</soyc>
               <force>true</force>
             </configuration>
             <executions>
               <execution>
                 <phase>generate-resources</phase>
                 <goals>
                   <goal>resources</goal>
                   <goal>compile</goal>
                 </goals>
               </execution>
             </executions>
           </plugin>
         </plugins>
       </build>
     </profile>

    🙂

     
  • Andreas Höhmann 12:15 am Thursday, 17. November 2011 Permalink |
    Tags: guava, hierarchical, iterator   

    Hierarchical Iterator 

    import static com.google.common.collect.ImmutableList.of;
    
    import java.util.Iterator;
    import java.util.LinkedList;
    
    import com.google.common.collect.AbstractIterator;
    import com.google.common.collect.Lists;
    
    /**
     * This Iterator could be used for hierarchical data structure (e.g. Trees).
     *
     * @author Andreas Höhmann
     * @param <T>
     */
    public abstract class AbstractHierarchialIterator<T> extends AbstractIterator<T> {
    
       private final LinkedList<Iterable<T>> stack = Lists.newLinkedList();
       private Iterator<T> current;
    
       public AbstractHierarchialIterator(final T start) {
          this(of(start));
       }
    
       private AbstractHierarchialIterator(final Iterable<T> start) {
          current = start.iterator();
       }
    
       /**
        * An concrete hierarchical iterator has to implement a method to 
        * visit the children of an element.
        *
        * @param currentElement
        * @return never <code>null</code>
        */
       protected abstract Iterable<T> childrenOf(T currentElement);
    
       @Override
       protected T computeNext() {
          while (true) {
             if (current.hasNext()) {
                final T next = current.next();
                stack.add(childrenOf(next));
                return next;
             }
             if (stack.isEmpty()) {
                break;
             }
             current = stack.removeFirst().iterator();
          }
          return endOfData();
       }
    }
    

    Examples

    AbstractHierarchialIterator<Foobar> i = 
        new AbstractHierarchialIterator<Foobar>(foobarStart) {
    
        @Override
        protected Iterable<Foobar> childrenOf(final Foobar currentElement) {
            // <--- here you have to implement something
            return currentElement.getFoobarChildren(); 
        }
    };
    
    // example 1 - show all foobars
    while (i.hasNext()) {
        System.out.println(i.next());
    }
    
    // example 2 - search the first "foo"
    Foobar foo = com.google.common.collect.Iterators.find(i, new Predicate<Foobar>() {
    
          @Override
          public boolean apply(final Foobar input) {
            return "foo".equals(input.getName());
          }
        }, null);
    

    🙂

     
    • bkiew 17:11 am Samstag, 19. November 2011 Permalink | Zum Antworten anmelden

      Some questions.
      a) The variable „stack“ is a LinkedList, why not a real „Stack“?
      b) In which order will the children be processed? In-, pre- or post-order? It is not configurable nor documented 😛

      Greetings, Ben

    • Andreas Höhmann 1:24 am Dienstag, 22. November 2011 Permalink | Zum Antworten anmelden

      Hi Ben,

      a) what class do you mean? Vector?
      b) this iterator will do it with http://en.wikipedia.org/wiki/Breadth-first_search, this simple code doesn’t need any documentation 😉 … you are right … a next step could be the usage of the strategy pattern, in combination with the builder pattern it would be quite easy to support all aspects of traversing a hierarchical data-structure.

      cya
      höhmi

      • xaerxess 20:23 am Montag, 20. August 2012 Permalink | Zum Antworten anmelden

        ad. a) ArrayDeque is superior to LinkedList (and Stack of course) if you use Java 6 and don’t need List interface goodies (positional get mainly). It even outperforms ArrayList; see this benchmark.

  • Andreas Höhmann 16:00 am Friday, 19. August 2011 Permalink |
    Tags: ffmpeg, gource, svn, visualization   

    Yet another gource svn video example 

    # makesvnvideo.sh
    svn log $1 --xml --verbose --quiet > svn-log.xml && \
    python $GOURCE_HOME/svn-gource.py --filter-dirs svn-log.xml > svn-gource-log.xml && \
    $GOURCE_HOME/gource.exe --log-format custom svn-gource-log.xml -c 2 -s 0.1 --max-files 500 --hide dirnames,filenames,files,mouse,progress --stop-at-end -i 60 --multi-sampling --user-image-dir ~/.avatars --camera-mode overview --font-size 18 --font-colour FFFFFF  --background 000000 --date-format "%d.%m.%Y" -r 25 -640x480 --highlight-users --user-friction .2 -o svn.ppm && \
    $FFMPEG_HOME/bin/ffmpeg.exe -y -b 10000K -r 25 -f image2pipe -vcodec ppm -i svn.ppm -vcodec libx264 -threads 4 -bf 0 svn.x264.mp4
    
    1. download/install gource, put a $GOURCE_HOME in your .bashrc
    2. download/install svn-gource.py into $GOURCE_HOME
    3. download/install ffmepg, put a $FFMPEG in your .bashrc
    4. put avatar images in your ~/.avatar directory
    5. put makesvnvideo.sh in your PATH

    makesvnvideo https://bloxel.googlecode.com/svn/trunk/

     
  • Andreas Höhmann 15:10 am Friday, 19. August 2011 Permalink |
    Tags: , label,   

    VAADIN Reverse Label with CSS 

    Here is a simple example how to use CSS to change the visual representation of Vaadin components.

    The com.vaadin.ui.Label component have a caption and a icon, i.e.  „[I] Caption“.

    But I need a label like this „Caption [I]“. This could be done with the following CSS:

    .v-caption-reverseLabel {
    float: left;
    }
    .v-caption-reverseLabel .v-icon {
    float: right;
    margin: 0px 2px 0px 2px;
    }
    .v-caption-reverseLabel .v-captiontext {
    float: right;
    }
    
    final Label label = new Label();
    label.setStyleName("reverseLabel");
    label.setCaption("Foobar");
    label.setIcon(new ThemeResource("img/info.gif"));
    
     
  • Andreas Höhmann 1:24 am Saturday, 13. August 2011 Permalink |
    Tags: , , perlin noise, tessellation   

    Bloxel Perlin Volume Renderer 

    We are making progress 😀

    I implemented a tessellation algorithm for volume -> mesh creation … here are some pictures from the bloxel labs …

     
  • Andreas Höhmann 10:04 am Saturday, 9. July 2011 Permalink |  

    Vaadin my first steps 

    A new customer project started this month. My team and I are creating a new web application. I’m the lead designer of the project and I think about new technologies for that application.

    After many projects with JSF and Richfaces I want to go new ways. First of all Richfaces is a great framework and you can do (almost) everything you want. But some requirements are very tricky to implement, i.e. confirmation dialog with user input, multiple windows …

    Currently I’m evaluating  Vaadin and I love it. It is so easy to use (at first sight). The java geek blog inspired me to try Vaadin.

    In the near future I will post more about my experiences. Stay tuned 🙂

     
  • Andreas Höhmann 10:41 am Friday, 8. April 2011 Permalink |
    Tags: Android, Megaminxer   

    Android Megaminxer 

     
  • Andreas Höhmann 2:41 am Wednesday, 2. March 2011 Permalink |  

    Next video from bloxel 0.2.0 

    Some facts:
    – heightmap based terrain generation 1024 x 1024
    – 3 different textures (grass, sand and water)
    – hardware :  Intel Core2 2.66 GHz, Nvidia GeForce Go 7950 GTX, 2GB RAM, Windows7 64bit

    http://code.google.com/p/bloxel/

    Video #1

    Video #2

     
  • Andreas Höhmann 0:38 am Wednesday, 2. March 2011 Permalink |
    Tags: , mesh, multitexture   

    MultiFaceBox mesh for bloxel 

    News from bloxel …

    Last days I spend a couple of hours creating a box mesh for our game bloxel which have different textures for each side … like this one …

    … without success … until now *g*

    First of all jmonkey rocks … but the multi texture support is not easy to use/understand for a rookie like me.

    Here the thinks I checked out:

    • http://jmonkeyengine.org/groups/general-2/forum/topic/box-with-multiple-textures/
      • the idea here was to create a box in a editor, and generate mapping coordinates for it, then  import it into JME with the ogre xml importer
      • paddy (bloxel team member) tried this approach with blender, the result was an .obj file with two geometries inside a) the grass geo on top and b) the dirt geos on the other sides
      • long story short end … this doesn’t work very well
    • then I tried the jme3 sky material
      • this material use a TextureCubeMap (multiple images for cube sides)
      • not working for me … sky material is only for sky-boxes I guess
    • then I want use shaders (glsl) to get the different textures on the box
      • but my knowledge about glsl is near zero *gg* … so I tried to find shader-code with google … no success
    • then I found the jme2 class MultiFaceBox
      • ported to jme3 was quite simple
      • play a little bit with the right texture
      • and voilà … here we are
    
    public class MultiFaceBox extends Box {
    
      public MultiFaceBox() {
        super();
        remap();
      }
    
      public MultiFaceBox(final Vector3f center, final float xExtent, final float yExtent, final float zExtent) {
        super(center, xExtent, yExtent, zExtent);
        remap();
      }
    
      public MultiFaceBox(final Vector3f min, final Vector3f max) {
        super(min, max);
        remap();
      }
    
      private void remap() {
        final FloatBuffer fb = getFloatBuffer(Type.TexCoord);
        fb.rewind();
        for (int i = 0; i < 6; i++) {
          final float top = i / 8f;
          final float bottom = (i + 1) / 8f;
          final float[] tex = new float[] { 1, bottom, 0, bottom, 0, top, 1, top };
          fb.put(tex);
        }
      }
    }
    
    

    This works for me … now I can remove the unused two empty areas in the texture …

     
  • Andreas Höhmann 22:05 am Saturday, 19. February 2011 Permalink |
    Tags: , heightmap,   

    Heightmap based terrain loading for bloxel 

    Last night I finished the first prototype of a heightmap based TerrainLoader.

    • I’m using a com.jme3.terrain.heightmap.HillHeightMap to create a 512×512 2D heightmap
    • our 3D TerrainChunkLoader (our manager for infinite worlds) map a TerrainChunk (x,y,z) to a region of this 2D map
    • here I had some problems to transform the 512×512 heightmap (2D) to the 4×4 terrain-chunks (3D) … but now it works 🙂

     

     

     

    Update 20.02.2011 – better textures for grass and dirt

     
c
Neuen Beitrag erstellen
j
nächster Beitrag/nächster Kommentar
k
vorheriger Beitrag/vorheriger Kommentar
r
Antworten
e
Bearbeiten
o
zeige/verstecke Kommentare
t
Zum Anfang gehen
l
zum Login
h
Zeige/Verberge Hilfe
Shift + ESC
Abbrechen