Code Snippets List

I have started a new list for Code Snippets specifically for JME2 on the wiki:

http://jmonkeyengine.com/wiki/doku.php?id=code_snippets_-_jme_2



I am going to try to include every code snippet posted in the forum on the wiki with an organized format so they are easier to find and use. If you want, you can make a thread while at the same time putting your code on the wiki, that way people can leave comments and such on your code and suggest new features.

I will try to help and fill that up a bit. Should we put more complete solutions (Strategic handler, Secene monitor etc) also there or on a separate list?

Yes, all libraries and code that can be used with jME. By putting it on the wiki we can organize it better than we can using the forum.



I don't think we should categorize by size, a "complete solution" can be a single class, or a whole library. The important question is "how does it help you?".

Sounds good to me… I have filled the list with the first things that came to mind… The details of each snipped are still to be fills up and all the help with that would be welcome.



Also, if you have ideas what else should be included, please add them to the WiKi page or just post here and hopefully it will also find its way to the WiKi.

Thanks for the start!  This reminded me of all the threads I've seen on the forums where I think "I need to remember that" but I never do anything to help remember…



I've gone through the forums again to pull out items that I think may be useful for what I'm looking to do with JME.  Before I go ahead and just add them to the Wiki, I wanted to be sure that these links match the original intent of the page.  If someone could check out what I've got and let me know, I'd appreciate it.





Using the TransitionGameState/LoadingGameState:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8637.msg67121#msg67121

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8894.msg68855#msg68855

http://www.jmonkeyengine.com/jmeforum/index.php?topic=9447.msg72956#msg72956



Markers/Highlights under player units:

jmetest.effects.TestProjectedTexture  is the demo for projected textures

http://www.jmonkeyengine.com/jmeforum/index.php?topic=4084.msg36324#msg36324

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8590.msg66721#msg66721



Minimap:

see TestSpatialLookAt

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8986.msg69598#msg69598



Cel-shading/Cartoon Rendering:

see TestVertexProgramState



Fog-of-War:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=4451.msg67253#msg67253



Terrain Splatting:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8493.msg66290#msg66290

http://www.jmonkeyengine.com/jmeforum/index.php?topic=5598.0

http://www.jmonkeyengine.com/jmeforum/index.php?topic=6870.0



Label above unit:

http://jmonkeyengine.com/wiki/doku.php?id=billboard_awt_label

http://www.jmonkeyengine.com/jmeforum/index.php?topic=6485.0



Night Vision:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=3324.0



Rain:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=2727.msg20667#msg20667



X-Ray Shader:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=9184.msg70934#msg70934



Procedural/Dynamic Texture:

? http://www.jmonkeyengine.com/jmeforum/index.php?topic=6946.msg55140#msg55140



Mouse Picking:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=6775.0



Shadow Mapping:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8926.0

I was under the impression that the page was intended for bits of code that do stuff which extends the functionality of jME in some way. An example code of how to use a transition gamestate might be useful in the wiki, or jmetest package, but it is actually core jme functionality… so i would not really put it in THIS list…



Anyways my thoughts:

  • Transition gamestate example OUT
  • Marker/highlight IN
  • MiniMap - seems like a good idea - some stuff about it in StrategicHandler also.
  • Fog-ofwar IN
  • Terrain splatting IN
  • Label above unit - both links reference same code… and are actually already in that list. OUT
  • Night Vision - IN
  • Rain IN
  • X-Ray / shaders - I think there was some more generic idea for how we should handle shaders… Dont remember what though…
  • Text on texture example - OUT untill there is also some code :slight_smile:
  • MousePicking like transition gamestate i would leave OUT, into a tutorial - article…
  • Shadow mapping OUT - i think it is in jMe 2 core now.



    Let's see what others think though

I was thinking the snippets would be a collection of answers to the question "If I want to do this, where can I find an example?", but that's why I wanted to check that my understanding of the intent for the page was the same as Momoko_fan's.  I'll wait for more feedback to be sure I'm not answering the wrong question.  :smiley:

I'd add this nice axis / grid generator:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=7983.msg62762#msg62762



If you want me to do it myself just let me know.

I was originally planning on doing it, but looks like it’s a bit late…

It’s great that people take initiative  :). Everyone, if you have found or wrote any useful code then by all means put it up on the page. Just make sure to specify the author and license (if available). It’s preferable if the code can be compiled by itself, so e.g it should be in a class and have some sort of API. Example code is much better being re-written as a tutorial as it’ll be more helpful in the long run.

So yes jjmontes you can put it up.



EDIT: I was doing some editing on the MW3D, SceneMonitor, MD5Importer & Mesh.XML importer pages. I also changed the template a bit now that I see what kind of things we need. See the MonkeyWorld3D page for an example.

I like the new template… makes information more easily accessible. I have updated the MouseManager and StrategicHandler pages + added JGN and Darkstar pages.



I think mjsimpson, you can go nuts and start adding new articles, noone seemed to really object to your ideas  :smiley:

Momoko_Fan said:

So yes jjmontes you can put it up.


I was busy with other stuff and life, but finally done: http://jmonkeyengine.com/wiki/doku.php?id=axis_and_grids.

Awesome job!  Thanks for this list.  :smiley: