*/}}

modelling_main.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Part of LaGUI demonstration programs
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "la_5.h"
  19. extern LA MAIN;
  20. void la_DetachedScenePanel(laPanel* p){
  21. la_MakeDetachedProp(p, "tns.world.root_objects", "root");
  22. }
  23. void ScenePanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
  24. laColumn* c=laFirstColumn(uil);
  25. laShow3DCanvasCombo(uil,c,DetachedProps,"root",-1);
  26. }
  27. void DataPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
  28. laColumn* c=laFirstColumn(uil);
  29. laShowItem(uil,c,0,"la.differences");
  30. laShowItem(uil,c,0,"tns.world");
  31. laShowItem(uil,c,0,"la");
  32. }
  33. int RegisterEverything(){
  34. laRegisterUiTemplate("panel_scene", "Scene", ScenePanel, la_DetachedScenePanel, 0,0, 0,25,25);
  35. laRegisterUiTemplate("panel_data", "Data", DataPanel, 0, 0,0, 0,0,20);
  36. tnsObject* s=tnsCreateRootObject("My Root");
  37. tnsObject* o=tnsCreateLight(s,"Sun",100,100,100,1,1);
  38. tnsVector3d target={0,0,0}, up={0,0,1};
  39. tnsLookAt(o,target,up);
  40. tnsObject* mo=tnsCreateMeshPlane(s,"Plane", 0,0,0, 10);
  41. //tnsMeshEnterEditMode(mo);
  42. //tnsMeshLeaveEditMode(mo);
  43. //tnsCreateMeshPlane(s,"Plane", 0,0,10, 10);
  44. s=tnsCreateRootObject("My Root 0");
  45. mo=tnsCreateMeshPlane(s,"Plane", 0,0,0, 10);
  46. }
  47. int main(int argc, char *argv[]){
  48. laGetReady();
  49. RegisterEverything();
  50. laRefreshUDFRegistries();
  51. // Use this to save and load preference when exit and during start up
  52. // laEnsureUserPreferences();
  53. laSaveProp("tns.world");
  54. laAddRootDBInst("tns");
  55. laWindow* w = laDesignWindow(-1,-1,800,600);
  56. laLayout* l = laDesignLayout(w, "Scene");
  57. laBlock* b = l->FirstBlock;
  58. laSplitBlockHorizon(b,0.7);
  59. laCreatePanel(b->B2, "panel_data");
  60. laCreatePanel(b->B2, "LAUI_animation_actions");
  61. laSplitBlockVertical(b->B1,0.6);
  62. laCreatePanel(b->B1->B1, "panel_scene");
  63. laCreatePanel(b->B1->B2, "LAUI_animation_action_channels");
  64. laStartWindow(w);
  65. laMainLoop();
  66. }