*/}}

modelling_main.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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, "la.detached_view_switch", "detached");
  22. la_MakeDetachedProp(p, "tns.world.root_objects", "root_object");
  23. }
  24. void ScenePanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
  25. laColumn* c=laFirstColumn(uil);
  26. laShow3DCanvasCombo(uil,c,DetachedProps,"root_object",-1,DetachedProps);
  27. }
  28. void DataPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
  29. laColumn* c=laFirstColumn(uil);
  30. laShowItem(uil,c,0,"la.differences");
  31. laShowItem(uil,c,0,"tns.world");
  32. laShowItem(uil,c,0,"la");
  33. }
  34. int RegisterEverything(){
  35. laRegisterUiTemplate("panel_scene", "Scene", ScenePanel, la_DetachedScenePanel, 0,0, 0,25,25);
  36. laRegisterUiTemplate("panel_data", "Data", DataPanel, 0, 0,0, 0,0,20);
  37. tnsObject* s=tnsCreateRootObject("My Root");
  38. tnsObject* o=tnsCreateLight(s,"Sun",100,100,100,1,1);
  39. tnsVector3d target={0,0,0}, up={0,0,1};
  40. tnsLookAt(o,target,up);
  41. tnsObject* mo=tnsCreateMeshPlane(s,"Plane", 0,0,0, 10);
  42. //tnsMeshEnterEditMode(mo);
  43. //tnsMeshLeaveEditMode(mo);
  44. //tnsCreateMeshPlane(s,"Plane", 0,0,10, 10);
  45. s=tnsCreateRootObject("My Root 0");
  46. mo=tnsCreateMeshPlane(s,"Plane", 0,0,0, 10);
  47. }
  48. int main(int argc, char *argv[]){
  49. laInitArguments ia={0};
  50. laSetCompleteInitArguments(&ia);
  51. laProcessInitArguments(argc,argv,&ia);
  52. laGetReadyWith(&ia);
  53. RegisterEverything();
  54. laRefreshUDFRegistries();
  55. // Use this to save and load preference when exit and during start up
  56. // laEnsureUserPreferences();
  57. laSaveProp("tns.world");
  58. laAddRootDBInst("tns");
  59. laWindow* w = laDesignWindow(-1,-1,800,600);
  60. laLayout* l = laDesignLayout(w, "Scene");
  61. laBlock* b = l->FirstBlock;
  62. laSplitBlockHorizon(b,0.7);
  63. laCreatePanel(b->B2, "panel_data");
  64. laCreatePanel(b->B2, "LAUI_animation_actions");
  65. laSplitBlockVertical(b->B1,0.6);
  66. laCreatePanel(b->B1->B1, "panel_scene");
  67. laCreatePanel(b->B1->B2, "LAUI_animation_action_channels");
  68. laStartWindow(w);
  69. laMainLoop();
  70. return 0;
  71. }