File: wrap_gfx.cc

package info (click to toggle)
openstructure 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 206,240 kB
  • sloc: cpp: 188,571; python: 36,686; ansic: 34,298; fortran: 3,275; sh: 312; xml: 146; makefile: 29
file content (142 lines) | stat: -rw-r--r-- 4,876 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2020 by the OpenStructure authors
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3.0 of the License, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//------------------------------------------------------------------------------
#include <boost/python.hpp>
using namespace boost::python;

#include <ost/gfx/module_config.hh>
#if OST_SHADER_SUPPORT_ENABLED
#include <ost/gfx/shader.hh>
#endif
#include <ost/info/info.hh>
#include <ost/gfx/prim_list.hh>
#include <ost/gfx/gfx_test_object.hh>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

extern void export_Scene();
extern void export_GfxNode();
extern void export_GfxObj();
extern void export_Entity();
extern void export_Surface();
extern void export_primlist();
extern void export_primitives();
extern void export_color();
extern void export_gradient();
extern void export_bitmap();
extern void export_Exporter();
extern void export_Map();
extern void export_SymmetryNode();
extern void export_SceneObserver();

extern void export_RenderOptions();

extern void export_ColorOps();

extern void export_GLWinBase();

using namespace ost;
using namespace ost::gfx;

BOOST_PYTHON_MODULE(_ost_gfx)
{
  export_Scene();
  export_GfxNode();
  export_GfxObj();
  export_Entity();
  export_Surface();
  export_RenderOptions();
  export_Map();
  export_SymmetryNode();
  export_SceneObserver();
  export_ColorOps();
  export_GLWinBase();
  export_primitives();
  export_primlist();
  export_color();
  export_gradient();
  export_bitmap();

  enum_<RenderMode::Type>("RenderMode")
    .value("SIMPLE",RenderMode::SIMPLE)
    .value("DEBUG",RenderMode::DEBUG)
    .value("DEBUG2",RenderMode::DEBUG2)
    .value("TEST",RenderMode::TEST)
    .value("TEST2",RenderMode::TEST2)
    .value("CUSTOM",RenderMode::CUSTOM)
    .value("CPK",RenderMode::CPK)
    .value("LINE_TRACE",RenderMode::LINE_TRACE)
    .value("TRACE",RenderMode::TRACE)    
    .value("SLINE",RenderMode::SLINE)
    .value("HSC",RenderMode::HSC)
    .value("TUBE",RenderMode::TUBE)
    .value("FILL",RenderMode::FILL)
    .value("OUTLINE",RenderMode::OUTLINE)
    .export_values()
    ;
  enum_<InputCommand>("InputCommand")
    .value("INPUT_COMMAND_NONE", INPUT_COMMAND_NONE)
    .value("INPUT_COMMAND_ROTX", INPUT_COMMAND_ROTX)
    .value("INPUT_COMMAND_ROTY", INPUT_COMMAND_ROTY)
    .value("INPUT_COMMAND_ROTZ", INPUT_COMMAND_ROTZ)
    .value("INPUT_COMMAND_TRANSX", INPUT_COMMAND_TRANSX)
    .value("INPUT_COMMAND_TRANSY", INPUT_COMMAND_TRANSY)
    .value("INPUT_COMMAND_TRANSZ", INPUT_COMMAND_TRANSZ)
    .value("INPUT_COMMAND_SLABN", INPUT_COMMAND_SLABN)
    .value("INPUT_COMMAND_SLABF", INPUT_COMMAND_SLABF)
    .value("INPUT_COMMAND_AUTOSLAB", INPUT_COMMAND_AUTOSLAB)
    .value("INPUT_COMMAND_TOGGLE_FOG", INPUT_COMMAND_TOGGLE_FOG)
    .value("INPUT_COMMAND_CUSTOM1", INPUT_COMMAND_CUSTOM1)
    .value("INPUT_COMMAND_CUSTOM2", INPUT_COMMAND_CUSTOM2)
    .value("INPUT_COMMAND_CUSTOM3", INPUT_COMMAND_CUSTOM3)
    .value("INPUT_COMMAND_REBUILD", INPUT_COMMAND_REBUILD)
    .export_values()
    ;
  enum_<InputDevice>("InputDevice")
    .value("INPUT_DEVICE_MOUSE", INPUT_DEVICE_MOUSE)
    .export_values()
  ;
  enum_<TransformTarget>("TransformTarget")
   .value("TRANSFORM_VIEW", TRANSFORM_VIEW)
   .value("TRANSFORM_RIGID", TRANSFORM_RIGID)
   .value("TRANSFORM_TORSION", TRANSFORM_TORSION)
   .value("TRANSFORM_ANGLE", TRANSFORM_ANGLE)
   .value("TRANSFORM_ROTAMER", TRANSFORM_ROTAMER)
   .export_values()
  ;
  class_<InputEvent>("InputEvent", init<InputDevice, InputCommand, float>())
   .def(init<InputDevice,InputCommand,int,int,float>())
  ;

  class_<GfxTestObj, bases<GfxObj>, boost::noncopyable>("GfxTestObj", init<>());
  
#if OST_SHADER_SUPPORT_ENABLED
  class_<Shader, boost::noncopyable>("Shader", no_init)
    .def("Instance",&Shader::Instance,
         return_value_policy<reference_existing_object>()).staticmethod("Instance")
    .def("PushProgram",&Shader::PushProgram)
    .def("PopProgram",&Shader::PopProgram)
    .def("Activate",&Shader::Activate)
    ;
#endif

  export_primitives();
  export_Exporter();
}