Search Unity

Custom Scene Window

Discussion in 'Immediate Mode GUI (IMGUI)' started by Abu-Faisal, Feb 18, 2016.

  1. Abu-Faisal

    Abu-Faisal

    Joined:
    Sep 11, 2013
    Posts:
    15

    DLL is part of future Asset Store Package


    Here is a custom scene window created while constructing Assets Store package. It is not perfect yet -can call it ancient Beta-, but it is usable.

    For now, it has one source light [Directional] and a few properties to control Light and Camera. There is no interaction with objects or rays.

    It is not checked for memory leak. It will be optimized and many features will be added in near future.

    Package includes Test EditorWindow and Scene to test it in player and editor environments. Also, XML file included that explain functions inside DLL.


    How to use
    1. Include HoV.GraphicsLibrary
    2. Create a class that Inherits from HoVGraphics abstract class
    3. Implement abstract method OnDispose() [used to clear your class objects in case of Dispose()]
    4. Set camera properties up for this class or later in instance.
    5. Create HoVLight objects. Set them up and add them to class or later in instance.
    6. Override the following function as needed,
      • Meshes() : to render meshes. You must use HoVGraphics.DrawMesh functions inside this method to draw meshes
      • GLs() : to render GL commands. Don't use GL.PushMatrix(), GL.PopMatrix() and GL.LoadProjectionMatrix() as they were taking care of. GL.modelview is loaded, but if you want to reload it for none identity model matrix, left multiply your matrix by GL.modelview.
      • GUIs() : to render GUI objects. Alas, it is using GUI.Matrix which squeeze GUI object in non full screen mode.
    7. Create instance of above class
    8. For rendering this instance use the following,
      • DrawOnViewport(Rect) : render meshes and GL commands to Rect in current screen view.
      • DrawOnTexture(Texture2D) : render meshes and GL commands to Texture2D.
      • DrawGUI(bool) : render GUI objects. if true, it will render without transformation, otherwise, it will draw using transformation of last used Rect in DrawOnViewport(Rect).
    9. When done with above instance call Dispose() for proper memory garbage collection

    Updates
    Update 1.0
    • Add AmbientColor color property to control scene ambient light.
    • Add Lights control functions to Add, Remove and control each light properties in the scene. Scene no longer comes with default directional light.
    • Add EnableGLInDeferredMode bool property to allow rendering GL commands in deferred rendering path. It is a workaround [by adding forward rendering cycle] until Unity team fixes deferred depth buffer or gives a better workaround.
    • Some memory leaks and bugs where fixed.
    • Updated test scripts in editor and play modes to reflect new changes.

    I hope you enjoy it
     

    Attached Files:

    Last edited: Feb 22, 2016
    RavenMikal likes this.
  2. RavenMikal

    RavenMikal

    Joined:
    Oct 18, 2014
    Posts:
    144
    screenshots?
    =)

    Give us an idea of what we're working with here O_O
    seems like alot of trouble for a custom window, however, there isn't likely many developers that don't look for ways for there games to stand out with a little extra polish, and I've proven to myself I will deal with a stupid amount for the sake of a little polish ;)
     
  3. Abu-Faisal

    Abu-Faisal

    Joined:
    Sep 11, 2013
    Posts:
    15
    I think language didn't serve there. :oops:

    Anyway, It is nothing more than simple abstract class to derive from. It is just a view port to a scene that show only your meshes and GL commands away from Unity Scene Root. Target is to let it work as Unity Scene View but with additional stuff such as manipulating meshes, blending shapes, creating shapes away from Unity Scene Root ...etc.

    For now, it is just a scene viewer to setup lights, render meshes and 3D navigation. Yes, it is a lot of trouble for simple thing but it will help me for future tools such as Shape Extruding Tool [WIP].

    The important in the package is the DLL file. Others just test stuff. I'll upload simple example on next update.;)

    I hope Unity give us some Layer that is not related to main scene