*/}}

modelling_main.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. laUiItem* ui=laShowCanvas(uil,c,DetachedProps,"root",0,-1);
  26. laDefault3DViewOverlay(ui);
  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. }
  46. int main(int argc, char *argv[]){
  47. laGetReady();
  48. RegisterEverything();
  49. laRefreshUDFRegistries();
  50. // Use this to save and load preference when exit and during start up
  51. // laEnsureUserPreferences();
  52. laSaveProp("tns.world");
  53. laAddRootDBInst("tns");
  54. laWindow* w = laDesignWindow(-1,-1,800,600);
  55. laLayout* l = laDesignLayout(w, "Scene");
  56. laBlock* b = l->FirstBlock;
  57. laSplitBlockHorizon(b,0.7);
  58. laCreatePanel(b->B1, "panel_scene");
  59. laCreatePanel(b->B2, "panel_data");
  60. laStartWindow(w);
  61. laMainLoop();
  62. }