Announcement

Collapse
No announcement yet.

GTK GUI draws wireframe graphics

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • GTK GUI draws wireframe graphics

    Hello,

    i am working for Busch&Jaeger (house installation products) and i am creating an internal tool to display all the rooms of a house including their devices (wall switches, ...) and their connection link quality. This is a monitoring tool for all connections and so it has not to draw nice 3D graphics instead it draws everything as "wireframe".
    "bad" connections are red

  • #2
    Hello FMode,

    ​Thanks so much for sharing with us your app, it's amazing the integration you're achieving with the tree view at the right side (I guess the 3D view reacts on which nodes are selected). May it be possible you could share with us a little bit more on how Wave Engine is helping you? Maybe a key point/anecdote worth sharing as well. I've particularly liked the text being rendered in a plane/wall. How did you make that?

    Thanks again,

    Marcos

    Comment


    • #3
      Yes in the treeview all devices (white objects in 3D view) are listed and so you can easily find all devices (defect ones, ...) .
      I isolated WaveEngine from the rest of the build up process (parseing a XML file and stuff) - so WaveEngine is a 3D Control (ActiveX or Widget).

      The letters are created with the following py-script in Blender:

      Code:
      import bpy
      import os
      import time
      
      def CreateLetter(chrnum,f):
          bpy.ops.object.text_add(location=(0, 0, 0), rotation=(0, 0, 0))
          txt = bpy.data.objects['Text']
          txt.data.body = chr(chrnum)
          fnt = bpy.data.fonts.load('C:\\temp\\ariblk.ttf')
          txt.data.font = fnt
          bpy.data.objects['Text'].scale.x=0.2
          bpy.data.objects['Text'].scale.y=0.2
          bpy.data.objects['Text'].scale.z=0.2
          bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1);
          f.write('sizetable['+str(chrnum)+'] = new Vector3('+str(bpy.data.objects['Text'].dimensions.x)+'f, '+str(bpy.data.objects['Text'].dimensions.y)+'f, 0f);\n')
      
      def DeleteAll():
          for item in bpy.data.objects:  
              print(item.name, item.type)
              if item.type=='FONT':
                  bpy.data.scenes[0].objects.unlink(item)
                  bpy.data.objects.remove(item)
      
      f = open('C:\\Dev\\sizetable.txt', 'w')
      for x in range(32, 127):
          CreateLetter(x,f)
          bpy.ops.export_scene.autodesk_3ds(filepath='C:\\Dev\\'+str(x)+'.3ds')
          DeleteAll()
      bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
      f.close()
      bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
      Strings are display in 3D space like that:

      Code:
             
      internal static void AddString(string text, ref Vector3 position, Quaternion orientation, Vector3 scale, Entity ParentEntity)
              {
                  int counter = 0;
                  foreach (char letter in text)
                  {
      
                      if ((letter != 32) && (letter<256))
                      {
      
                          Transform3D tr3D = new WaveEngine.Framework.Graphics.Transform3D()
                              {
                                  LocalOrientation = orientation,
                                  Scale = scale,
                                  Position = position
                              };
                          Model model = new Model("Content/ArialBlack/" + ((int)(letter)).ToString() + ".3ds");
                          
                          Entity letterent = new Entity()
                              .AddComponent(tr3D)
                              .AddComponent(new MaterialsMap(new WaveEngine.Materials.BasicMaterial(Color.Black, DefaultLayers.Alpha) { LayerType = DefaultLayers.Alpha, Alpha = 1f, VertexColorEnabled = false }))
                              .AddComponent(model)
                              .AddComponent(new ModelRenderer());
                          letterent.IsVisible = ParentEntity.IsVisible;
      
                          mScene.EntityManager.Add(letterent);
      
                          Vector3 vec = model.BoundingBox.Max;
                          vec.Z = 0;
                          position = Vector3.Transform(vec, tr3D.WorldTransform);
      
                          if (ParentEntity != null) ParentEntity.AddChild(letterent);
                      }
                      counter = counter + 1;
                  }
              }

      Comment


      • #4
        Well done, looks great!

        Hope we are beeing useful with the rest of your questions in the forum.

        Juanlao

        Comment

        Working...
        X