Showing
28 changed files
with
1223 additions
and
44 deletions
applications/coin/scene.iv
0 → 100644
1 | +#Inventor V2.0 ascii | ||
2 | + | ||
3 | + Separator | ||
4 | + { | ||
5 | + RotationXYZ | ||
6 | + { | ||
7 | + axis X | ||
8 | + angle 0.707 | ||
9 | + } | ||
10 | + RotationXYZ | ||
11 | + { | ||
12 | + axis Y | ||
13 | + angle 0 = DEF et ElapsedTime { speed 0.6 } . timeOut | ||
14 | + } | ||
15 | + Material | ||
16 | + { | ||
17 | + diffuseColor [1 0 0] | ||
18 | + } | ||
19 | + DEF cube0 Cube | ||
20 | + { | ||
21 | + width 2 | ||
22 | + height 1 | ||
23 | + } | ||
24 | + DEF tr Translation { translation 0 2 0 } | ||
25 | + Material | ||
26 | + { | ||
27 | + diffuseColor [0 1 0] | ||
28 | + } | ||
29 | + | ||
30 | + DEF cube1 Cube | ||
31 | + { | ||
32 | + width 2 | ||
33 | + height 1 | ||
34 | + } | ||
35 | + } |
applications/coin/scene.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../../lib/arcscoin"/> | ||
5 | + </libraries> | ||
6 | + <components> | ||
7 | + <component id="v" type="Viewer"></component> | ||
8 | + <component id="c" type="Separator"> | ||
9 | + Separator | ||
10 | + { | ||
11 | + RotationXYZ | ||
12 | + { | ||
13 | + axis X | ||
14 | + angle 0.707 | ||
15 | + } | ||
16 | + RotationXYZ | ||
17 | + { | ||
18 | + axis Y | ||
19 | + angle 0 = ElapsedTime { speed 0.6 } . timeOut | ||
20 | + } | ||
21 | + Material | ||
22 | + { | ||
23 | + diffuseColor 1.0 0.025 0 | ||
24 | + } | ||
25 | + Cube | ||
26 | + { | ||
27 | + width 2 | ||
28 | + height 1 | ||
29 | + } | ||
30 | + } | ||
31 | + </component> | ||
32 | + <component id="s" type="StateMachine"> | ||
33 | + <statemachine> | ||
34 | + <first name="start"/> | ||
35 | + <last name="end"/> | ||
36 | + <transitions> | ||
37 | + <transition source="start" token="end" destination="end"/> | ||
38 | + </transitions> | ||
39 | + </statemachine> | ||
40 | + </component> | ||
41 | + </components> | ||
42 | + <constants> | ||
43 | + </constants> | ||
44 | + </context> | ||
45 | + | ||
46 | + <processes> | ||
47 | + <process controller="s"> | ||
48 | + <sheet id="start"> | ||
49 | + <connections> | ||
50 | + </connections> | ||
51 | + <preconnections> | ||
52 | + <invoke destination="v" slot="setSize(QSize)" type="size">640x480</invoke> | ||
53 | + <invoke destination="v" slot="setSceneGraph(SoFieldContainer*)" type="component">c</invoke> | ||
54 | + <invoke destination="v" slot="show()" type="void"/> | ||
55 | + </preconnections> | ||
56 | + </sheet> | ||
57 | + <sheet id="end"/> | ||
58 | + </process> | ||
59 | +</processes> | ||
60 | + | ||
61 | +</application> |
applications/coin/scene2.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../../libs/arcscoin"/> | ||
5 | + </libraries> | ||
6 | + <components> | ||
7 | + <component id="v" type="Viewer"></component> | ||
8 | + <component id="c" type="Separator" file="scene.iv"/> | ||
9 | + <component id="s" type="StateMachine"> | ||
10 | + <statemachine> | ||
11 | + <first name="start"/> | ||
12 | + <last name="end"/> | ||
13 | + <transitions> | ||
14 | + <transition source="start" token="end" destination="end"/> | ||
15 | + </transitions> | ||
16 | + </statemachine> | ||
17 | + </component> | ||
18 | + </components> | ||
19 | + <constants> | ||
20 | + </constants> | ||
21 | + </context> | ||
22 | + | ||
23 | + <processes> | ||
24 | + <process controller="s"> | ||
25 | + <sheet id="start"> | ||
26 | + <connections> | ||
27 | + </connections> | ||
28 | + <preconnections> | ||
29 | + <invoke destination="v" slot="setSize(QSize)" type="size">640x480</invoke> | ||
30 | + <invoke destination="v" slot="setSceneGraph(SoFieldContainer*)" type="component">c</invoke> | ||
31 | + <invoke destination="c" slot="rouge.width(SFFloat)" type="SoSFFloat">4.0</invoke> | ||
32 | + <invoke destination="v" slot="show()" type="void"/> | ||
33 | + </preconnections> | ||
34 | + </sheet> | ||
35 | + <sheet id="end"/> | ||
36 | + </process> | ||
37 | +</processes> | ||
38 | + | ||
39 | +</application> |
applications/coin/spy.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../../libs/arcscoin"/> | ||
5 | + </libraries> | ||
6 | + <components> | ||
7 | + <component id="v" type="Viewer"></component> | ||
8 | + <component id="c" type="Cube"/> | ||
9 | + <component id="i" type="ElapsedTime"/> | ||
10 | + <component id="spy" type="ARCSSensorLogger"/> | ||
11 | + <component id="s" type="StateMachine"> | ||
12 | + <statemachine> | ||
13 | + <first name="start"/> | ||
14 | + <last name="end"/> | ||
15 | + <transitions> | ||
16 | + <transition source="start" token="end" destination="end"/> | ||
17 | + </transitions> | ||
18 | + </statemachine> | ||
19 | + </component> | ||
20 | + </components> | ||
21 | + <constants> | ||
22 | + <constant id="height" type="SoSFFloat">0.1</constant> | ||
23 | + </constants> | ||
24 | + </context> | ||
25 | + | ||
26 | + <processes> | ||
27 | + <process controller="s"> | ||
28 | + <sheet id="start"> | ||
29 | + <connections> | ||
30 | + <link source="i" signal="timeOut" destination="spy" | ||
31 | + slot="log()"/> | ||
32 | + </connections> | ||
33 | + <postconnections> | ||
34 | + <invoke destination="v" slot="setSize(QSize)" type="size">640x480</invoke> | ||
35 | + <invoke destination="v" slot="setSceneGraph(SoFieldContainer*)" type="component">c</invoke> | ||
36 | + <invoke destination="v" slot="appendToSceneGraph(SoFieldContainer*)" type="component">i</invoke> | ||
37 | + <invoke destination="v" slot="show()" type="void"/> | ||
38 | + <invoke destination="i" slot="set_fraction" type="SoSFFloat">1.0</invoke> | ||
39 | + </postconnections> | ||
40 | + </sheet> | ||
41 | + <sheet id="end"/> | ||
42 | + </process> | ||
43 | +</processes> | ||
44 | + | ||
45 | +</application> |
applications/coin/viewer.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../../libs/arcscoin"/> | ||
5 | + </libraries> | ||
6 | + <components> | ||
7 | + <component id="v" type="Viewer"></component> | ||
8 | + <component id="c" type="Cube"/> | ||
9 | + <component id="m" type="Material"/> | ||
10 | + <component id="s" type="StateMachine"> | ||
11 | + <statemachine> | ||
12 | + <first name="start"/> | ||
13 | + <last name="end"/> | ||
14 | + <transitions> | ||
15 | + <transition source="start" token="end" destination="end"/> | ||
16 | + </transitions> | ||
17 | + </statemachine> | ||
18 | + </component> | ||
19 | + </components> | ||
20 | + <constants> | ||
21 | + <constant id="height" type="SoSFFloat">0.1</constant> | ||
22 | + <constant id="color" type="SoMFColor*">0.0 0.85 0.15</constant> | ||
23 | + </constants> | ||
24 | + </context> | ||
25 | + | ||
26 | + <processes> | ||
27 | + <process controller="s"> | ||
28 | + <sheet id="start"> | ||
29 | + <connections> | ||
30 | + </connections> | ||
31 | + <postconnections> | ||
32 | + <invoke destination="v" slot="setSize(QSize)" type="size">640x480</invoke> | ||
33 | + <invoke destination="v" slot="setSceneGraph(SoFieldContainer*)" type="component">m</invoke> | ||
34 | + <invoke destination="v" slot="appendToSceneGraph(SoFieldContainer*)" type="component">c</invoke> | ||
35 | + <invoke destination="v" slot="show()" type="void"/> | ||
36 | + <!--invoke destination="c" slot="height" type="constant">height</invoke--> | ||
37 | + <invoke destination="m" slot="diffuseColor" type="constant">color</invoke> | ||
38 | + </postconnections> | ||
39 | + </sheet> | ||
40 | + <sheet id="end"/> | ||
41 | + </process> | ||
42 | +</processes> | ||
43 | + | ||
44 | +</application> |
applications/coin/viewer2.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../../libs/arcscoin"/> | ||
5 | + </libraries> | ||
6 | + <components> | ||
7 | + <component id="v" type="Viewer"></component> | ||
8 | + <component id="sep" type="Separator"/> | ||
9 | + <component id="c" type="Cube"/> | ||
10 | + <component id="sph" type="Sphere"/> | ||
11 | + <component id="tr" type="Transform"/> | ||
12 | + <component id="m1" type="Material"/> | ||
13 | + <component id="m2" type="Material"/> | ||
14 | + | ||
15 | + <component id="s" type="StateMachine"> | ||
16 | + <statemachine> | ||
17 | + <first name="start"/> | ||
18 | + <last name="end"/> | ||
19 | + <transitions> | ||
20 | + <transition source="start" token="end" destination="end"/> | ||
21 | + </transitions> | ||
22 | + </statemachine> | ||
23 | + </component> | ||
24 | + </components> | ||
25 | + <constants> | ||
26 | + <constant id="color" type="SoMFColor*">0.0 0.85 0.15</constant> | ||
27 | + <constant id="blue" type="SoMFColor*">0.0 0.0 1.0</constant> | ||
28 | + <constant id="translation" type="SoSFVec3f">4.0 0.0 0.0 </constant> | ||
29 | + </constants> | ||
30 | + </context> | ||
31 | + | ||
32 | + <processes> | ||
33 | + <process controller="s"> | ||
34 | + <sheet id="start"> | ||
35 | + <connections> | ||
36 | + </connections> | ||
37 | + <postconnections> | ||
38 | + <invoke destination="v" slot="setSize(QSize)" type="size">640x480</invoke> | ||
39 | + <invoke destination="v" slot="setSceneGraph(SoFieldContainer*)" type="component">sep</invoke> | ||
40 | + <invoke destination="sep" slot="addChild(SoFieldContainer*)" type="component">m1</invoke> | ||
41 | + <invoke destination="sep" slot="addChild(SoFieldContainer*)" type="component">c</invoke> | ||
42 | + <invoke destination="sep" slot="addChild(SoFieldContainer*)" type="component">tr</invoke> | ||
43 | + <invoke destination="sep" slot="addChild(SoFieldContainer*)" type="component">m2</invoke> | ||
44 | + <invoke destination="sep" slot="addChild(SoFieldContainer*)" type="component">sph</invoke> | ||
45 | + <!--invoke destination="c" slot="height" type="constant">height</invoke--> | ||
46 | + <invoke destination="m1" slot="diffuseColor" type="constant">color</invoke> | ||
47 | + <invoke destination="m2" slot="diffuseColor" type="constant">blue</invoke> | ||
48 | + <invoke destination="tr" slot="translation" type="constant">translation</invoke> | ||
49 | + | ||
50 | + | ||
51 | + <invoke destination="v" slot="show()" type="void"/> | ||
52 | + <invoke destination="v" slot="viewAll()" type="void"/> | ||
53 | + </postconnections> | ||
54 | + </sheet> | ||
55 | + <sheet id="end"/> | ||
56 | + </process> | ||
57 | +</processes> | ||
58 | + | ||
59 | +</application> |
applications/coin/viewer3.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../../libs/arcscoin"/> | ||
5 | + </libraries> | ||
6 | + <components> | ||
7 | + <component id="v" type="Viewer"></component> | ||
8 | + <component id="r1" type="RotationXYZ">RotationXYZ { axis X angle 0.707 }</component> | ||
9 | + <component id="r2" type="RotationXYZ">RotationXYZ { axis Y }</component> | ||
10 | + <component id="c" type="Cube"/> | ||
11 | + <component id="m" type="Material">Material { diffuseColor 1.0 0.0 0.0}</component> | ||
12 | + <component id="e" type="ElapsedTime"/> | ||
13 | + | ||
14 | + <component id="s" type="StateMachine"> | ||
15 | + <statemachine> | ||
16 | + <first name="start"/> | ||
17 | + <last name="end"/> | ||
18 | + <transitions> | ||
19 | + <transition source="start" token="end" destination="end"/> | ||
20 | + </transitions> | ||
21 | + </statemachine> | ||
22 | + </component> | ||
23 | + </components> | ||
24 | + <constants> | ||
25 | + </constants> | ||
26 | + </context> | ||
27 | + | ||
28 | + <processes> | ||
29 | + <process controller="s"> | ||
30 | + <sheet id="start"> | ||
31 | + <preconnections> | ||
32 | + <invoke destination="v" slot="setSize(QSize)" type="size">640x480</invoke> | ||
33 | + </preconnections> | ||
34 | + <connections> | ||
35 | + <link source="e" signal="timeOut" destination="r2" slot="angle"/> | ||
36 | + </connections> | ||
37 | + <postconnections> | ||
38 | + <invoke destination="v" slot="setSceneGraph(SoFieldContainer*)" type="component">r1</invoke> | ||
39 | + <invoke destination="v" slot="appendToSceneGraph(SoFieldContainer*)" type="component">r2</invoke> | ||
40 | + <invoke destination="v" slot="appendToSceneGraph(SoFieldContainer*)" type="component">m</invoke> | ||
41 | + <invoke destination="v" slot="appendToSceneGraph(SoFieldContainer*)" type="component">c</invoke> | ||
42 | + <invoke destination="v" slot="show()" type="void"/> | ||
43 | + <invoke destination="v" slot="viewAll()" type="void"/> | ||
44 | + </postconnections> | ||
45 | + </sheet> | ||
46 | + <sheet id="end"/> | ||
47 | + </process> | ||
48 | +</processes> | ||
49 | + | ||
50 | +</application> |
... | @@ -5,11 +5,11 @@ | ... | @@ -5,11 +5,11 @@ |
5 | <library path="../libs/arcsutils"/> | 5 | <library path="../libs/arcsutils"/> |
6 | </libraries> | 6 | </libraries> |
7 | <components> | 7 | <components> |
8 | - <!--component id="amm" type="ARCSMutexManager"></component--> | 8 | + <component id="amm" type="ARCSMutexManager"></component> |
9 | <component id="st1" type="SkunkLoop"></component> | 9 | <component id="st1" type="SkunkLoop"></component> |
10 | <component id="st2" type="SkunkLoop"></component> | 10 | <component id="st2" type="SkunkLoop"></component> |
11 | - <component id="sr" type="SkunkReciever"></component> | 11 | + <component id="sum" type="SkunkReciever"></component> |
12 | - <component id="finish" type="Script"> | 12 | + <component id="end" type="Script"> |
13 | count = 0; | 13 | count = 0; |
14 | function add() { | 14 | function add() { |
15 | count ++; | 15 | count ++; |
... | @@ -63,11 +63,11 @@ | ... | @@ -63,11 +63,11 @@ |
63 | <process controller="s"> | 63 | <process controller="s"> |
64 | <sheet id="start"> | 64 | <sheet id="start"> |
65 | <preconnections> | 65 | <preconnections> |
66 | - <invoke destination="sr" slot="resetCounter()" type="void"/> | 66 | + <invoke destination="sum" slot="resetCounter()" type="void"/> |
67 | </preconnections> | 67 | </preconnections> |
68 | <connections> | 68 | <connections> |
69 | - <link source="finish" signal="finished()" destination="sr" slot="sendCount()"/> | 69 | + <link source="end" signal="finished()" destination="sum" slot="sendCount()"/> |
70 | - <link source="sr" signal="obtainedCount(int)" destination="display" slot="display(int)"/> | 70 | + <link source="sum" signal="obtainedCount(int)" destination="display" slot="display(int)"/> |
71 | <link source="display" signal="end(QString)" destination="s2" slot="setToken(QString)"/> | 71 | <link source="display" signal="end(QString)" destination="s2" slot="setToken(QString)"/> |
72 | <link source="display" signal="end(QString)" destination="s1" slot="setToken(QString)"/> | 72 | <link source="display" signal="end(QString)" destination="s1" slot="setToken(QString)"/> |
73 | <link source="display" signal="end(QString)" destination="s" slot="setToken(QString)"/> | 73 | <link source="display" signal="end(QString)" destination="s" slot="setToken(QString)"/> |
... | @@ -87,8 +87,8 @@ | ... | @@ -87,8 +87,8 @@ |
87 | <invoke destination="st1" slot="setName(QString)" type="string">Thread1</invoke> | 87 | <invoke destination="st1" slot="setName(QString)" type="string">Thread1</invoke> |
88 | </preconnections> | 88 | </preconnections> |
89 | <connections> | 89 | <connections> |
90 | - <link source="st1" destination="sr" signal="sendIteration(int)" slot="recieve(int)"/> | 90 | + <link source="st1" destination="sum" signal="sendIteration(int)" slot="recieve(int)"/> |
91 | - <link source="st1" destination="finish" signal="finished()" slot="add()"/> | 91 | + <link source="st1" destination="end" signal="finished()" slot="add()"/> |
92 | </connections> | 92 | </connections> |
93 | <postconnections> | 93 | <postconnections> |
94 | <invoke destination="st1" slot="start()" type="void"/> | 94 | <invoke destination="st1" slot="start()" type="void"/> |
... | @@ -104,8 +104,8 @@ | ... | @@ -104,8 +104,8 @@ |
104 | <invoke destination="st2" slot="setName(QString)" type="string">Thread2</invoke> | 104 | <invoke destination="st2" slot="setName(QString)" type="string">Thread2</invoke> |
105 | </preconnections> | 105 | </preconnections> |
106 | <connections> | 106 | <connections> |
107 | - <link source="st2" destination="sr" signal="sendIteration(int)" slot="recieve(int)" /> | 107 | + <link source="st2" destination="sum" signal="sendIteration(int)" slot="recieve(int)" /> |
108 | - <link source="st2" destination="finish" signal="finished()" slot="add()"/> | 108 | + <link source="st2" destination="end" signal="finished()" slot="add()"/> |
109 | </connections> | 109 | </connections> |
110 | <postconnections> | 110 | <postconnections> |
111 | <invoke destination="st2" slot="start()" type="void"/> | 111 | <invoke destination="st2" slot="start()" type="void"/> | ... | ... |
... | @@ -18,6 +18,7 @@ HAS_ARCS=$$(ARCSDIR) | ... | @@ -18,6 +18,7 @@ HAS_ARCS=$$(ARCSDIR) |
18 | 18 | ||
19 | !isEmpty(HAS_COIN) { | 19 | !isEmpty(HAS_COIN) { |
20 | message (Coin was found) | 20 | message (Coin was found) |
21 | + SUBDIRS+= scene/coin | ||
21 | SUBDIRS+= scene/coinutils | 22 | SUBDIRS+= scene/coinutils |
22 | SUBDIRS+= scene/obj2so | 23 | SUBDIRS+= scene/obj2so |
23 | 24 | ... | ... |
... | @@ -82,7 +82,7 @@ void CameraOpenCVHighgui::initDevice() | ... | @@ -82,7 +82,7 @@ void CameraOpenCVHighgui::initDevice() |
82 | std::cout << "[Ccv] Setting framerate" << std::endl; | 82 | std::cout << "[Ccv] Setting framerate" << std::endl; |
83 | if (cvSetCaptureProperty(capture,CV_CAP_PROP_FPS, frameRate) ) | 83 | if (cvSetCaptureProperty(capture,CV_CAP_PROP_FPS, frameRate) ) |
84 | std::cout << "[Ccv] Framerate set successfully" << std::endl; | 84 | std::cout << "[Ccv] Framerate set successfully" << std::endl; |
85 | - cvSetCaptureProperty(capture,CV_CAP_PROP_CONVERT_RGB, 1); | 85 | + //cvSetCaptureProperty(capture,CV_CAP_PROP_CONVERT_RGB, 1); |
86 | //cvSetCaptureProperty(capture,CV_CAP_PROP_WHITE_BALANCE, 1); | 86 | //cvSetCaptureProperty(capture,CV_CAP_PROP_WHITE_BALANCE, 1); |
87 | cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS, brightness); | 87 | cvSetCaptureProperty(capture,CV_CAP_PROP_BRIGHTNESS, brightness); |
88 | float fr = (float)cvGetCaptureProperty(capture,CV_CAP_PROP_FPS); | 88 | float fr = (float)cvGetCaptureProperty(capture,CV_CAP_PROP_FPS); | ... | ... |
scene/coin/coin.pro
0 → 100644
1 | +unix:TEMPLATE = lib | ||
2 | +win32:TEMPLATE = vclib | ||
3 | +INCLUDEPATH += $$(ARCSDIR)/include | ||
4 | +LIBRARIES += -L$$(ARCSDIR)/lib \ | ||
5 | + -larcs | ||
6 | +CONFIG += dll debug | ||
7 | +Qt = core | ||
8 | +TARGET = arcscoin | ||
9 | +HEADERS += inventorfamily.h \ | ||
10 | + inventorcomponent.h \ | ||
11 | + inventortypes.h \ | ||
12 | + inventorslotwrapper.h \ | ||
13 | + inventorsignalwrapper.h | ||
14 | +# inventorspy.h | ||
15 | +HEADERS += viewer.h | ||
16 | +SOURCES += inventorfamily.cpp \ | ||
17 | + inventorcomponent.cpp \ | ||
18 | + inventorslotwrapper.cpp \ | ||
19 | + inventorsignalwrapper.cpp | ||
20 | +SOURCES += viewer.cpp | ||
21 | + | ||
22 | +DESTDIR=../../libs | ||
23 | +DLLDESTDIR=../../libs | ||
24 | + | ||
25 | +# SOURCES += libcoin.alx | ||
26 | +INCLUDE_COIN = $$system(pkg-config Quarter --cflags-only-I) | ||
27 | +INCLUDEPATH += $$replace(INCLUDE_COIN,"-I","") | ||
28 | +INCLUDEPATH += /usr/local/include | ||
29 | +LIBS += $$system(pkg-config Quarter --libs) | ||
30 | +ALXFILE = libcoin.alx | ||
31 | +arcslibrary.output = alm_${QMAKE_FILE_BASE}.cpp | ||
32 | +arcslibrary.input = ALXFILE \ | ||
33 | + inventortypes.h | ||
34 | +arcslibrary.commands = arcslibmaker \ | ||
35 | + ${QMAKE_FILE_NAME} | ||
36 | +arcslibrary.variable_out = SOURCES | ||
37 | +QMAKE_EXTRA_COMPILERS += arcslibrary | ||
38 | +OTHER_FILES += libcoin.alx | ||
39 | +QMAKE_CXXFLAGS+=-fpermissive | ||
40 | + | ||
41 | + |
scene/coin/coininit.cpp
0 → 100644
1 | +#include "coininit.h" | ||
2 | +#include <Inventor/Qt/SoQt.h> | ||
3 | +#include <QWidget> | ||
4 | +//#include "SoFrustumCamera.h" | ||
5 | +//#include "SoVectorizeFigAction.h" | ||
6 | + | ||
7 | +bool CoinInit::initOnce = false; | ||
8 | + | ||
9 | + | ||
10 | +int CoinInit::refCounter = 0; | ||
11 | + | ||
12 | +void CoinInit::init() | ||
13 | +{ | ||
14 | + int dargc = 1; | ||
15 | + const char* dargv[] = {"ARCS"}; | ||
16 | + SoQt::init("arcsengine"); | ||
17 | + if (! initOnce) | ||
18 | + { | ||
19 | + // Put here all nodes you want to initialize | ||
20 | + //SoFrustumCamera::initClass(); | ||
21 | + //SoVectorizeFigAction::initClass(); | ||
22 | + | ||
23 | + // end of nodes to initialize | ||
24 | + initOnce = true; | ||
25 | + } | ||
26 | +} | ||
27 | + | ||
28 | +void CoinInit::done() | ||
29 | +{ | ||
30 | + SoQt::done(); | ||
31 | +} |
scene/coin/coininit.h
0 → 100644
1 | +#ifndef __COININIT_H__ | ||
2 | +#define __COININIT_H__ | ||
3 | + | ||
4 | +#include <qobject.h> | ||
5 | +#include <Inventor/Qt/SoQt.h> | ||
6 | + | ||
7 | +/*! \defgroup inventor OpenInventor related classes | ||
8 | + * | ||
9 | + * This module is regouping components handling inventor like | ||
10 | + * scenegraphs. | ||
11 | + * \ingroup scene | ||
12 | + */ | ||
13 | + | ||
14 | +/*! \brief Component designed for inventor intialization. | ||
15 | + * | ||
16 | + * All components developped using OpenInventor like APIs should | ||
17 | + * inherit this one. | ||
18 | + * \author Jean-Yves Didier | ||
19 | + * \date April the 4th, 2007 | ||
20 | + * \ingroup inventor | ||
21 | + */ | ||
22 | +class CoinInit: public QObject | ||
23 | +{ | ||
24 | +Q_OBJECT | ||
25 | + | ||
26 | +public: | ||
27 | + /*! \brief ARCS Constructor | ||
28 | + */ | ||
29 | + CoinInit(QObject* parent=0, const char* name=0) { if (refCounter == 0) init(); refCounter++; } | ||
30 | + /*! \brief ARCS Destructor | ||
31 | + */ | ||
32 | + ~CoinInit() { refCounter--; if (refCounter == 0) done(); } | ||
33 | + | ||
34 | +private: | ||
35 | + static void init(); | ||
36 | + static void done(); | ||
37 | + static bool initOnce; | ||
38 | + static int refCounter; | ||
39 | + | ||
40 | +}; | ||
41 | + | ||
42 | + | ||
43 | +#endif //__COININIT_H__ |
scene/coin/inventorcomponent.cpp
0 → 100644
This diff is collapsed. Click to expand it.
scene/coin/inventorcomponent.h
0 → 100644
1 | +#ifndef __INVENTORCOMPONENT_H__ | ||
2 | +#define __INVENTORCOMPONENT_H__ | ||
3 | + | ||
4 | +#include <arcs/arcsabstractcomponent.h> | ||
5 | +#include "inventorslotwrapper.h" | ||
6 | +#include "inventorsignalwrapper.h" | ||
7 | + | ||
8 | +#include <Inventor/lists/SoEngineOutputList.h> | ||
9 | +#include <Inventor/actions/SoSearchAction.h> | ||
10 | +#include <QHash> | ||
11 | +#include <QList> | ||
12 | +#include <QPair> | ||
13 | +#include <cstdlib> | ||
14 | + | ||
15 | +class SoFieldContainer; | ||
16 | + | ||
17 | +//! Class implementing each SoFieldContainer derived classes in inventor as a suitable component for ARCS | ||
18 | +/*! See how getProxySlot() and getProxySignal() are implemented. | ||
19 | +* \author Jean-Yves Didier | ||
20 | + * \date April, the 23rd, 2009 | ||
21 | + * \ingroup coin | ||
22 | + */ | ||
23 | +class InventorComponent : public ARCSAbstractComponent | ||
24 | +{ | ||
25 | +public: | ||
26 | + InventorComponent(QString type=QString::null); | ||
27 | + virtual ~InventorComponent(); | ||
28 | + | ||
29 | + virtual QStringList getSlots(); | ||
30 | + virtual QStringList getSignals(); | ||
31 | + | ||
32 | + | ||
33 | + virtual QString toString(); | ||
34 | + | ||
35 | + virtual bool parseString(QString s); | ||
36 | + virtual bool loadFile(QString s); | ||
37 | + virtual bool saveFile(QString s); | ||
38 | + | ||
39 | + virtual QVariant getGenuineComponentInstance(); | ||
40 | + | ||
41 | +protected: | ||
42 | + virtual void getProxySlot(QString slot, ObjectList& obj, QStringList &proxySlots); | ||
43 | + virtual void getProxySignal(QString signal, ObjectList& obj, QStringList &proxySignals); | ||
44 | + | ||
45 | + virtual bool genuineConnect(QString sig, ARCSAbstractComponent* cmp, QString slt, bool queued=false); | ||
46 | + virtual bool genuineDisconnect(QString sig, ARCSAbstractComponent* cmp, QString slt); | ||
47 | + virtual bool genuineInstanciate(); | ||
48 | + virtual void genuineDestroy(); | ||
49 | + | ||
50 | + virtual ARCSAbstractComponent* genuineClone(); | ||
51 | + | ||
52 | + | ||
53 | +private: | ||
54 | + static void * buffer_realloc(void * bufptr, size_t size) | ||
55 | + { | ||
56 | + char* buffer = (char *)realloc(bufptr, size); | ||
57 | + //size_t buffer_size = size; // ?!? copy paste from coin code has some mysteries | ||
58 | + return buffer; | ||
59 | + } | ||
60 | + void appendEngineOutputs(QString prefix, SoEngineOutputList& outputs, bool trueEngine); | ||
61 | + void getChildrenList(); | ||
62 | + void prepare(); | ||
63 | + void processFieldContainer(SoFieldContainer* fc); | ||
64 | + | ||
65 | + SoFieldContainer* realObject; | ||
66 | + | ||
67 | + | ||
68 | + QString type; | ||
69 | + QHash<QString,QPair<SoFieldContainer*,QString> > signalList ; | ||
70 | + QHash<QString,QPair<SoFieldContainer*,QString> > slotList ; | ||
71 | + | ||
72 | + QHash<QString,InventorSlotWrapper*> slotWrappers; | ||
73 | + QHash<QString,InventorSignalWrapper*> signalWrappers; | ||
74 | + SoSearchAction* sa; | ||
75 | +}; | ||
76 | + | ||
77 | +#endif // __INVENTORCOMPONENT_H__ |
scene/coin/inventorfamily.cpp
0 → 100644
1 | +#include "inventorfamily.h" | ||
2 | +#include "inventorcomponent.h" | ||
3 | +#include <Quarter/Quarter.h> | ||
4 | + | ||
5 | +#include <iostream> | ||
6 | +#include <Inventor/SbName.h> | ||
7 | +#include <Inventor/SoType.h> | ||
8 | +#include <Inventor/lists/SoTypeList.h> | ||
9 | +#include <Inventor/fields/SoFieldContainer.h> | ||
10 | +#include "inventorsignalwrapper.h" | ||
11 | + | ||
12 | +InventorFamily::InventorFamily() : ARCSAbstractFamily() | ||
13 | +{ | ||
14 | + std::cout << "[IVFam] Initializing Quarter" << std::endl; | ||
15 | + //SoDB::init(); | ||
16 | + SIM::Coin3D::Quarter::Quarter::init(); | ||
17 | + InventorSignalWrapper::initHashTable(); | ||
18 | +} | ||
19 | + | ||
20 | +InventorFamily::~InventorFamily() | ||
21 | +{ | ||
22 | + SIM::Coin3D::Quarter::Quarter::clean(); | ||
23 | +} | ||
24 | + | ||
25 | +QStringList InventorFamily::factoryList() | ||
26 | +{ | ||
27 | + QStringList finalList; | ||
28 | + SoTypeList typeList; | ||
29 | + | ||
30 | + SoType::getAllDerivedFrom(SoFieldContainer::getClassTypeId(), typeList); | ||
31 | + | ||
32 | + for (int i = 0; i < typeList.getLength() ; i++) | ||
33 | + { | ||
34 | + if (typeList[i].canCreateInstance()) | ||
35 | + finalList << QString( typeList[i].getName().getString() ) ; | ||
36 | + } | ||
37 | + | ||
38 | + return finalList; | ||
39 | +} | ||
40 | + | ||
41 | +ARCSAbstractComponent* InventorFamily::instanciate(QString type) | ||
42 | +{ | ||
43 | + return new InventorComponent(type); | ||
44 | +} | ||
45 | + | ||
46 | +void InventorFamily::destroy(ARCSAbstractComponent* cmp) | ||
47 | +{ | ||
48 | + | ||
49 | +} |
scene/coin/inventorfamily.h
0 → 100644
1 | +#ifndef __INVENTORFAMILY_H__ | ||
2 | +#define __INVENTORFAMILY_H__ | ||
3 | + | ||
4 | +#include <arcs/arcsabstractfamily.h> | ||
5 | + | ||
6 | + | ||
7 | +/*! \defgroup coin Inventor integration. | ||
8 | +* Inventor nodes are here seen as components. | ||
9 | +* Therefore, we can integrate them in ARCS as an exogeneous family of components. | ||
10 | + */ | ||
11 | + | ||
12 | + | ||
13 | +//! This class implements an exogeneous family of components, which are inventor nodes | ||
14 | +/*! \sa InventorComponent | ||
15 | +*\author Jean-Yves Didier | ||
16 | + * \date April, the 23rd, 2009 | ||
17 | + * \ingroup coin | ||
18 | + */ | ||
19 | + | ||
20 | +class InventorFamily : public ARCSAbstractFamily | ||
21 | +{ | ||
22 | + public: | ||
23 | + //! constructor | ||
24 | + /*! It has also the peculiarity to initialize Inventor at loading of the family, which is suitable. | ||
25 | + */ | ||
26 | + InventorFamily(); | ||
27 | + virtual ~InventorFamily(); | ||
28 | + //! Returns a factory list. Here it is the list of available nodes and engines. | ||
29 | + virtual QStringList factoryList(); | ||
30 | + virtual bool addFactory(QString type, ARCSAbstractComponent* cmp ) { return false; } | ||
31 | + virtual void removeFactory(QString type) { } | ||
32 | + virtual ARCSAbstractComponent* instanciate(QString type); | ||
33 | + virtual void destroy(ARCSAbstractComponent* component); | ||
34 | + virtual QString name() const { return "InventorFamily" ; } | ||
35 | + virtual bool isInternal() const { return false; } | ||
36 | +}; | ||
37 | + | ||
38 | +#endif // __INVENTORFAMILY_H__ |
scene/coin/inventorsignalwrapper.cpp
0 → 100644
This diff is collapsed. Click to expand it.
scene/coin/inventorsignalwrapper.h
0 → 100644
This diff is collapsed. Click to expand it.
scene/coin/inventorslotwrapper.cpp
0 → 100644
1 | +#include "inventorslotwrapper.h" | ||
2 | +#include <Inventor/nodes/SoNode.h> | ||
3 | +#include <Inventor/nodes/SoGroup.h> | ||
4 | +#include <iostream> | ||
5 | + | ||
6 | +InventorSlotWrapper::InventorSlotWrapper(SoFieldContainer* cnt,QString s) : QObject() | ||
7 | +{ | ||
8 | + | ||
9 | + if (s.contains("(")) | ||
10 | + fieldName = s.section("(",0,0); | ||
11 | + else | ||
12 | + fieldName= s; | ||
13 | + container = cnt; | ||
14 | + if (s == "removeAllChildren()" || s == "addChild(SoFieldContainer*)") | ||
15 | + slotName = s; | ||
16 | + else | ||
17 | + { | ||
18 | + QString type; | ||
19 | + if (s.contains("(")) | ||
20 | + type = (s.section("(",1,1)).section(")",0,0); | ||
21 | + | ||
22 | + slotName = "call("+type+")"; | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | + | ||
27 | +void InventorSlotWrapper::callField(SoField* field) | ||
28 | +{ | ||
29 | + if (!container) | ||
30 | + return ; | ||
31 | + SoField* fld = container->getField(SbName(qPrintable(fieldName))); | ||
32 | + | ||
33 | + if (!fld) | ||
34 | + return ; | ||
35 | + | ||
36 | + SbString str; | ||
37 | + field->get(str); | ||
38 | + | ||
39 | + fld->copyFrom(*field); | ||
40 | + fld->fixCopy(false); | ||
41 | +} | ||
42 | + | ||
43 | +QString InventorSlotWrapper::getFieldType() | ||
44 | +{ | ||
45 | + if (!container) | ||
46 | + return QString::null; | ||
47 | + SoField* fld = container->getField(SbName(qPrintable(fieldName))); | ||
48 | + | ||
49 | + if (!fld) | ||
50 | + return QString::null; | ||
51 | + | ||
52 | + return QString(fld->getTypeId().getName().getString()); | ||
53 | +} | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | +void InventorSlotWrapper::removeAllChildren() | ||
58 | +{ | ||
59 | + if (container) | ||
60 | + if (container->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) | ||
61 | + ((SoGroup*)container)->removeAllChildren(); | ||
62 | +} | ||
63 | + | ||
64 | +void InventorSlotWrapper::addChild(SoFieldContainer* fc) | ||
65 | +{ | ||
66 | + if (fc->getTypeId().isDerivedFrom(SoNode::getClassTypeId())) | ||
67 | + if (container) | ||
68 | + if (container->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) | ||
69 | + ((SoGroup*)container)->addChild((SoNode*)fc); | ||
70 | +} |
scene/coin/inventorslotwrapper.h
0 → 100644
1 | +#ifndef __INVENTORSLOTWRAPPER_H__ | ||
2 | +#define __INVENTORSLOTWRAPPER_H__ | ||
3 | + | ||
4 | +#include <QObject> | ||
5 | +//#include "inventortypes.h" | ||
6 | +#include <Inventor/fields/SoFields.h> | ||
7 | +#include <Inventor/fields/SoFieldContainer.h> | ||
8 | +#include <iostream> | ||
9 | + | ||
10 | +//! Slot wrapper for inventor nodes | ||
11 | +/*! This class defines an object wrapper which is working as an adapter: | ||
12 | + * it receives a signal from an object and then transmits the value to our | ||
13 | + * node. | ||
14 | + * \author Jean-Yves Didier | ||
15 | + * \date April, the 23rd, 2009 | ||
16 | + * \ingroup coin | ||
17 | + */ | ||
18 | +class InventorSlotWrapper : public QObject | ||
19 | +{ | ||
20 | +Q_OBJECT | ||
21 | + | ||
22 | +public: | ||
23 | + InventorSlotWrapper(SoFieldContainer* cnt=0,QString s=QString::null); | ||
24 | + void setFieldContainer(SoFieldContainer* cnt) { container = cnt; } | ||
25 | + void setFieldName(QString s) { fieldName = s; } | ||
26 | + QString getFieldType() ; | ||
27 | + QString getSlotName() { return slotName; } | ||
28 | + | ||
29 | +public slots: | ||
30 | + void call(SoSFBool field) { callField(&field); } | ||
31 | + void call(SoSFBox2d field) { callField(&field); } | ||
32 | + void call(SoSFBox2f field) { callField(&field); } | ||
33 | + void call(SoSFBox2i32 field) { callField(&field); } | ||
34 | + void call(SoSFBox2s field) { callField(&field); } | ||
35 | + void call(SoSFBox3d field) { callField(&field); } | ||
36 | + void call(SoSFBox3f field) { callField(&field); } | ||
37 | + void call(SoSFBox3i32 field) { callField(&field); } | ||
38 | + void call(SoSFBox3s field) { callField(&field); } | ||
39 | + void call(SoSFColor field) { callField(&field); } | ||
40 | + void call(SoSFColorRGBA field) { callField(&field); } | ||
41 | + void call(SoSFDouble field) { callField(&field); } | ||
42 | + void call(SoSFEngine field) { callField(&field); } | ||
43 | + void call(SoSFEnum field) { callField(&field); } | ||
44 | + void call(SoSFBitMask field) { callField(&field); } | ||
45 | + void call(SoSFFloat field) { callField(&field); } | ||
46 | + /////////////////////////////////////////////////////////// | ||
47 | + void call(SoSFImage* field) { callField(field); } | ||
48 | + void call(SoSFImage3* field) { callField(field); } | ||
49 | + /////////////////////////////////////////////////////////// | ||
50 | + void call(SoSFInt32 field) { callField(&field); } | ||
51 | + void call(SoSFMatrix field) { callField(&field); } | ||
52 | + void call(SoSFName field) { callField(&field); } | ||
53 | + void call(SoSFNode field) { callField(&field); } | ||
54 | + void call(SoSFPath field) { callField(&field); } | ||
55 | + void call(SoSFPlane field) { callField(&field); } | ||
56 | + void call(SoSFRotation field) { callField(&field); } | ||
57 | + void call(SoSFShort field) { callField(&field); } | ||
58 | + void call(SoSFString field) { callField(&field); } | ||
59 | + void call(SoSFTime field) { callField(&field); } | ||
60 | + void call(SoSFTrigger field) { callField(&field); } | ||
61 | + void call(SoSFUInt32 field) { callField(&field); } | ||
62 | + void call(SoSFUShort field) { callField(&field); } | ||
63 | + void call(SoSFVec2b field) { callField(&field); } | ||
64 | + void call(SoSFVec2d field) { callField(&field); } | ||
65 | + void call(SoSFVec2f field) { callField(&field); } | ||
66 | + void call(SoSFVec2i32 field) { callField(&field); } | ||
67 | + void call(SoSFVec2s field) { callField(&field); } | ||
68 | + void call(SoSFVec3b field) { callField(&field); } | ||
69 | + void call(SoSFVec3d field) { callField(&field); } | ||
70 | + void call(SoSFVec3f field) { callField(&field); } | ||
71 | + void call(SoSFVec3i32 field) { callField(&field); } | ||
72 | + void call(SoSFVec3s field) { callField(&field); } | ||
73 | + void call(SoSFVec4b field) { callField(&field); } | ||
74 | + void call(SoSFVec4d field) { callField(&field); } | ||
75 | + void call(SoSFVec4f field) { callField(&field); } | ||
76 | + void call(SoSFVec4i32 field) { callField(&field); } | ||
77 | + void call(SoSFVec4s field) { callField(&field); } | ||
78 | + | ||
79 | + void call(SoMFBool* field) { callField(field); } | ||
80 | + void call(SoMFColor* field) { callField(field); } | ||
81 | + void call(SoMFColorRGBA* field) { callField(field); } | ||
82 | + void call(SoMFDouble* field) { callField(field); } | ||
83 | + void call(SoMFEngine* field) { callField(field); } | ||
84 | + void call(SoMFEnum* field) { callField(field); } | ||
85 | + void call(SoMFBitMask* field) { callField(field); } | ||
86 | + void call(SoMFFloat* field) { callField(field); } | ||
87 | + void call(SoMFInt32* field) { callField(field); } | ||
88 | + void call(SoMFMatrix* field) { callField(field); } | ||
89 | + void call(SoMFName* field) { callField(field); } | ||
90 | + void call(SoMFNode* field) { callField(field); } | ||
91 | + void call(SoMFPath* field) { callField(field); } | ||
92 | + void call(SoMFPlane* field) { callField(field); } | ||
93 | + void call(SoMFRotation* field) { callField(field); } | ||
94 | + void call(SoMFShort* field) { callField(field); } | ||
95 | + void call(SoMFString* field) { callField(field); } | ||
96 | + void call(SoMFTime* field) { callField(field); } | ||
97 | + void call(SoMFUInt32* field) { callField(field); } | ||
98 | + void call(SoMFUShort* field) { callField(field); } | ||
99 | + void call(SoMFVec2b* field) { callField(field); } | ||
100 | + void call(SoMFVec2d* field) { callField(field); } | ||
101 | + void call(SoMFVec2f* field) { callField(field); } | ||
102 | + void call(SoMFVec2i32* field) { callField(field); } | ||
103 | + void call(SoMFVec2s* field) { callField(field); } | ||
104 | + void call(SoMFVec3b* field) { callField(field); } | ||
105 | + void call(SoMFVec3d* field) { callField(field); } | ||
106 | + void call(SoMFVec3f* field) { callField(field); } | ||
107 | + void call(SoMFVec3i32* field) { callField(field); } | ||
108 | + void call(SoMFVec3s* field) { callField(field); } | ||
109 | + void call(SoMFVec4b* field) { callField(field); } | ||
110 | + void call(SoMFVec4d* field) { callField(field); } | ||
111 | + void call(SoMFVec4f* field) { callField(field); } | ||
112 | + void call(SoMFVec4i32* field) { callField(field); } | ||
113 | + void call(SoMFVec4s* field) { callField(field); } | ||
114 | + void removeAllChildren(); | ||
115 | + void addChild(SoFieldContainer* fc); | ||
116 | + | ||
117 | +private: | ||
118 | + void callField(SoField* field); | ||
119 | + SoFieldContainer* container; | ||
120 | + QString fieldName; | ||
121 | + QString slotName; | ||
122 | +}; | ||
123 | + | ||
124 | +#endif // __INVENTORSLOTWRAPPER_H__ |
scene/coin/inventorspy.h
0 → 100644
1 | +#ifndef __INVENTORSPY_H__ | ||
2 | +#define __INVENTORSPY_H__ | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | +#include <arcs/arcsqdynamicobject.h> | ||
7 | +//#include <QObject> | ||
8 | +#include <Inventor/fields/SoFields.h> | ||
9 | +#include <Inventor/fields/SoField.h> | ||
10 | +#include <Inventor/SoType.h> | ||
11 | +#include <iostream> | ||
12 | + | ||
13 | + | ||
14 | +//! Simple spy on inventor fields. | ||
15 | +/*! This component is developped for debugging purpose : once put | ||
16 | + * it can spy on values taken by a certain field of an inventor node. | ||
17 | + * \author Jean-Yves Didier | ||
18 | + * \date April, the 27th, 2009 | ||
19 | + * \ingroup coin | ||
20 | + */ | ||
21 | +class InventorSpy : public ARCSQDynamicObject | ||
22 | +{ | ||
23 | + | ||
24 | + public: | ||
25 | + InventorSpy(QObject* parent) : ARCSQDynamicObject(parent) {} | ||
26 | + virtual ~InventorSpy() {} | ||
27 | + | ||
28 | + virtual int indexOfSlot(QString s) | ||
29 | + { | ||
30 | + | ||
31 | + | ||
32 | + QByteArray ba = QMetaObject::normalizedSignature(qPrintable(s)); | ||
33 | + if ( ba == "spy(SoField)") | ||
34 | + return metaObject()->methodCount() + 1 ; | ||
35 | + return -1 ; | ||
36 | + } | ||
37 | + | ||
38 | + virtual int indexOfSignal(QString s) | ||
39 | + { | ||
40 | + return -1; | ||
41 | + } | ||
42 | + | ||
43 | + virtual bool compareArgs(QString s1, QString s2) | ||
44 | + { | ||
45 | + return true; | ||
46 | + } | ||
47 | + | ||
48 | + virtual int qt_metacall(QMetaObject::Call call, int id, void ** arguments) | ||
49 | + { | ||
50 | + id = QObject::qt_metacall(call, id, arguments); | ||
51 | + | ||
52 | + if (id == -1 || call != QMetaObject::InvokeMetaMethod) | ||
53 | + return id ; | ||
54 | + | ||
55 | + if (id == metaObject()->methodCount() + 1) | ||
56 | + spy(reinterpret_cast<SoField*>(arguments[1])); | ||
57 | + | ||
58 | + | ||
59 | + id -= metaObject()->methodCount() + 1; | ||
60 | + | ||
61 | + return id; | ||
62 | + } | ||
63 | + | ||
64 | + | ||
65 | + //public slots: | ||
66 | + //void spy(SoSField f) {dump(&f); } | ||
67 | + //void spy(SoSField* f) { dump(f); } | ||
68 | + //void spy(SoMField* f) { dump(f); } | ||
69 | + void spy(SoField* f) { dump(f); } | ||
70 | + | ||
71 | + | ||
72 | + /*void spy(SoSFBool f) { dump(&f); } | ||
73 | + void spy(SoSFBox2d f) { dump(&f); } | ||
74 | + void spy(SoSFBox2f f) { dump(&f); } | ||
75 | + void spy(SoSFBox2i32 f) { dump(&f); } | ||
76 | + void spy(SoSFBox2s f) { dump(&f); } | ||
77 | + void spy(SoSFBox3d f) { dump(&f); } | ||
78 | + void spy(SoSFBox3f f) { dump(&f); } | ||
79 | + void spy(SoSFBox3i32 f) { dump(&f); } | ||
80 | + void spy(SoSFBox3s f) { dump(&f); } | ||
81 | + void spy(SoSFColor f) { dump(&f); } | ||
82 | + void spy(SoSFColorRGBA f) { dump(&f); } | ||
83 | + void spy(SoSFDouble f) { dump(&f); } | ||
84 | + void spy(SoSFEngine f) { dump(&f); } | ||
85 | + void spy(SoSFEnum f) { dump(&f); } | ||
86 | + void spy(SoSFBitMask f) { dump(&f); } | ||
87 | + void spy(SoSFFloat f) { dump(&f); } | ||
88 | + ////////////////////////////////////////////////// | ||
89 | + void spy(SoSFImage* f) { dump(f); } | ||
90 | + void spy(SoSFImage3* f) { dump(f); } | ||
91 | + ////////////////////////////////////////////////// | ||
92 | + void spy(SoSFInt32 f) { dump(&f); } | ||
93 | + void spy(SoSFMatrix f) { dump(&f); } | ||
94 | + void spy(SoSFName f) { dump(&f); } | ||
95 | + void spy(SoSFNode f) { dump(&f); } | ||
96 | + void spy(SoSFPath f) { dump(&f); } | ||
97 | + void spy(SoSFPlane f) { dump(&f); } | ||
98 | + void spy(SoSFRotation f) { dump(&f); } | ||
99 | + void spy(SoSFShort f) { dump(&f); } | ||
100 | + void spy(SoSFString f) { dump(&f); } | ||
101 | + void spy(SoSFTime f) { dump(&f); } | ||
102 | + void spy(SoSFTrigger f) { dump(&f); } | ||
103 | + void spy(SoSFUInt32 f) { dump(&f); } | ||
104 | + void spy(SoSFUShort f) { dump(&f); } | ||
105 | + void spy(SoSFVec2b f) { dump(&f); } | ||
106 | + void spy(SoSFVec2d f) { dump(&f); } | ||
107 | + void spy(SoSFVec2f f) { dump(&f); } | ||
108 | + void spy(SoSFVec2i32 f) { dump(&f); } | ||
109 | + void spy(SoSFVec2s f) { dump(&f); } | ||
110 | + void spy(SoSFVec3b f) { dump(&f); } | ||
111 | + void spy(SoSFVec3d f) { dump(&f); } | ||
112 | + void spy(SoSFVec3f f) { dump(&f); } | ||
113 | + void spy(SoSFVec3i32 f) { dump(&f); } | ||
114 | + void spy(SoSFVec3s f) { dump(&f); } | ||
115 | + void spy(SoSFVec4b f) { dump(&f); } | ||
116 | + void spy(SoSFVec4d f) { dump(&f); } | ||
117 | + void spy(SoSFVec4f f) { dump(&f); } | ||
118 | + void spy(SoSFVec4i32 f) { dump(&f); } | ||
119 | + void spy(SoSFVec4s f) { dump(&f); } | ||
120 | + | ||
121 | + void spy(SoMFBool* f) { dump(f); } | ||
122 | + void spy(SoMFColor* f) { dump(f); } | ||
123 | + void spy(SoMFColorRGBA* f) { dump(f); } | ||
124 | + void spy(SoMFDouble* f) { dump(f); } | ||
125 | + void spy(SoMFEngine* f) { dump(f); } | ||
126 | + void spy(SoMFEnum* f) { dump(f); } | ||
127 | + void spy(SoMFBitMask* f) { dump(f); } | ||
128 | + void spy(SoMFFloat* f) { dump(f); } | ||
129 | + void spy(SoMFInt32* f) { dump(f); } | ||
130 | + void spy(SoMFMatrix* f) { dump(f); } | ||
131 | + void spy(SoMFName* f) { dump(f); } | ||
132 | + void spy(SoMFNode* f) { dump(f); } | ||
133 | + void spy(SoMFPath* f) { dump(f); } | ||
134 | + void spy(SoMFPlane* f) { dump(f); } | ||
135 | + void spy(SoMFRotation* f) { dump(f); } | ||
136 | + void spy(SoMFShort* f) { dump(f); } | ||
137 | + void spy(SoMFString* f) { dump(f); } | ||
138 | + void spy(SoMFTime* f) { dump(f); } | ||
139 | + void spy(SoMFUInt32* f) { dump(f); } | ||
140 | + void spy(SoMFUShort* f) { dump(f); } | ||
141 | + void spy(SoMFVec2b* f) { dump(f); } | ||
142 | + void spy(SoMFVec2d* f) { dump(f); } | ||
143 | + void spy(SoMFVec2f* f) { dump(f); } | ||
144 | + void spy(SoMFVec2i32* f) { dump(f); } | ||
145 | + void spy(SoMFVec2s* f) { dump(f); } | ||
146 | + void spy(SoMFVec3b* f) { dump(f); } | ||
147 | + void spy(SoMFVec3d* f) { dump(f); } | ||
148 | + void spy(SoMFVec3f* f) { dump(f); } | ||
149 | + void spy(SoMFVec3i32* f) { dump(f); } | ||
150 | + void spy(SoMFVec3s* f) { dump(f); } | ||
151 | + void spy(SoMFVec4b* f) { dump(f); } | ||
152 | + void spy(SoMFVec4d* f) { dump(f); } | ||
153 | + void spy(SoMFVec4f* f) { dump(f); } | ||
154 | + void spy(SoMFVec4i32* f) { dump(f); } | ||
155 | + void spy(SoMFVec4s* f) { dump(f); }*/ | ||
156 | + | ||
157 | + | ||
158 | + | ||
159 | + private: | ||
160 | + void dump(SoField* f) | ||
161 | + { | ||
162 | + SbString s; | ||
163 | + f->get(s); | ||
164 | + std::cout << "[IVSpy] Field: " << f->getTypeId().getName().getString() | ||
165 | + << ", value: \"" << s.getString() << "\"" << std::endl; | ||
166 | + } | ||
167 | + | ||
168 | +}; | ||
169 | + | ||
170 | + | ||
171 | + | ||
172 | +#endif // __INVENTORSPY_H__ |
scene/coin/inventortypes.h
0 → 100644
This diff is collapsed. Click to expand it.
scene/coin/libcoin.alx
0 → 100644
1 | +<library> | ||
2 | + <headers> | ||
3 | + <header name="inventorfamily.h"/> | ||
4 | + <header name="inventortypes.h"/> | ||
5 | + <header name="viewer.h"/> | ||
6 | + <!--header name="inventorspy.h"/--> | ||
7 | + </headers> | ||
8 | + <families> | ||
9 | + <family name="InventorFamily"/> | ||
10 | + </families> | ||
11 | + <components> | ||
12 | + <component name="Viewer"/> | ||
13 | + </components> | ||
14 | + <types> | ||
15 | + <type name="SoSFBool"/> | ||
16 | + <type name="SoSFBox2d"/> | ||
17 | + <type name="SoSFBox2f"/> | ||
18 | + <type name="SoSFBox2i32"/> | ||
19 | + <type name="SoSFBox2s"/> | ||
20 | + <type name="SoSFBox3d"/> | ||
21 | + <type name="SoSFBox3f"/> | ||
22 | + <type name="SoSFBox3i32"/> | ||
23 | + <type name="SoSFBox3s"/> | ||
24 | + <type name="SoSFColor"/> | ||
25 | + <type name="SoSFColorRGBA"/> | ||
26 | + <type name="SoSFDouble"/> | ||
27 | + <type name="SoSFEngine"/> | ||
28 | + <type name="SoSFEnum"/> | ||
29 | + <type name="SoSFBitMask"/> | ||
30 | + <type name="SoSFFloat"/> | ||
31 | + <!-- --> | ||
32 | + <type name="SoSFImage*"/> | ||
33 | + <type name="SoSFImage3*"/> | ||
34 | + <!-- --> | ||
35 | + <type name="SoSFInt32"/> | ||
36 | + <type name="SoSFMatrix"/> | ||
37 | + <type name="SoSFName"/> | ||
38 | + <type name="SoSFNode"/> | ||
39 | + <type name="SoSFPath"/> | ||
40 | + <type name="SoSFPlane"/> | ||
41 | + <type name="SoSFRotation"/> | ||
42 | + <type name="SoSFShort"/> | ||
43 | + <type name="SoSFString"/> | ||
44 | + <type name="SoSFTime"/> | ||
45 | + <type name="SoSFTrigger"/> | ||
46 | + <type name="SoSFUInt32"/> | ||
47 | + <type name="SoSFUShort"/> | ||
48 | + <type name="SoSFVec2b"/> | ||
49 | + <type name="SoSFVec2d"/> | ||
50 | + <type name="SoSFVec2f"/> | ||
51 | + <type name="SoSFVec2i32"/> | ||
52 | + <type name="SoSFVec2s"/> | ||
53 | + <type name="SoSFVec3b"/> | ||
54 | + <type name="SoSFVec3d"/> | ||
55 | + <type name="SoSFVec3f"/> | ||
56 | + <type name="SoSFVec3i32"/> | ||
57 | + <type name="SoSFVec3s"/> | ||
58 | + <type name="SoSFVec4b"/> | ||
59 | + <type name="SoSFVec4d"/> | ||
60 | + <type name="SoSFVec4f"/> | ||
61 | + <type name="SoSFVec4i32"/> | ||
62 | + <type name="SoSFVec4s"/> | ||
63 | + | ||
64 | + | ||
65 | + <type name="SoMFBool*"/> | ||
66 | + <type name="SoMFColor*"/> | ||
67 | + <type name="SoMFColorRGBA*"/> | ||
68 | + <type name="SoMFDouble*"/> | ||
69 | + <type name="SoMFEngine*"/> | ||
70 | + <type name="SoMFEnum*"/> | ||
71 | + <type name="SoMFBitMask*"/> | ||
72 | + <type name="SoMFFloat*"/> | ||
73 | + <type name="SoMFInt32*"/> | ||
74 | + <type name="SoMFMatrix*"/> | ||
75 | + <type name="SoMFName*"/> | ||
76 | + <type name="SoMFNode*"/> | ||
77 | + <type name="SoMFPath*"/> | ||
78 | + <type name="SoMFPlane*"/> | ||
79 | + <type name="SoMFRotation*"/> | ||
80 | + <type name="SoMFShort*"/> | ||
81 | + <type name="SoMFString*"/> | ||
82 | + <type name="SoMFTime*"/> | ||
83 | + <type name="SoMFUInt32*"/> | ||
84 | + <type name="SoMFUShort*"/> | ||
85 | + <type name="SoMFVec2b*"/> | ||
86 | + <type name="SoMFVec2d*"/> | ||
87 | + <type name="SoMFVec2f*"/> | ||
88 | + <type name="SoMFVec2i32*"/> | ||
89 | + <type name="SoMFVec2s*"/> | ||
90 | + <type name="SoMFVec3b*"/> | ||
91 | + <type name="SoMFVec3d*"/> | ||
92 | + <type name="SoMFVec3f*"/> | ||
93 | + <type name="SoMFVec3i32*"/> | ||
94 | + <type name="SoMFVec3s*"/> | ||
95 | + <type name="SoMFVec4b*"/> | ||
96 | + <type name="SoMFVec4d*"/> | ||
97 | + <type name="SoMFVec4f*"/> | ||
98 | + <type name="SoMFVec4i32*"/> | ||
99 | + <type name="SoMFVec4s*"/> | ||
100 | + | ||
101 | + </types> | ||
102 | +</library> |
scene/coin/viewer.cpp
0 → 100755
1 | +#include "viewer.h" | ||
2 | + | ||
3 | +#include <QWidget> | ||
4 | +#include <Inventor/nodes/SoSeparator.h> | ||
5 | +#include <Inventor/fields/SoFieldContainer.h> | ||
6 | +#include <Inventor/nodes/SoPerspectiveCamera.h> | ||
7 | +#include <Inventor/nodes/SoNode.h> | ||
8 | +#include <Inventor/nodes/SoDirectionalLight.h> | ||
9 | +#include <Inventor/SbLinear.h> | ||
10 | +#include <Inventor/SoDB.h> | ||
11 | +#include <Inventor/SbTime.h> | ||
12 | +#include <Inventor/SoRenderManager.h> | ||
13 | +#include <iostream> | ||
14 | + | ||
15 | +Viewer::Viewer(QObject* parent) : SIM::Coin3D::Quarter::QuarterWidget() | ||
16 | +{ | ||
17 | + realroot = new SoSeparator; | ||
18 | + realroot->ref(); | ||
19 | + | ||
20 | + realroot->addChild(camera = new SoPerspectiveCamera); | ||
21 | + realroot->addChild(new SoDirectionalLight); | ||
22 | + sceneRoot = new SoSeparator; | ||
23 | + realroot->addChild(sceneRoot); | ||
24 | + | ||
25 | + | ||
26 | + viewAll(); | ||
27 | + SoDB::setRealTimeInterval(SbTime(0,10000)); | ||
28 | + getSoRenderManager()->enableRealTimeUpdate(true); | ||
29 | + setMinimumSize(640,480); | ||
30 | + | ||
31 | + SIM::Coin3D::Quarter::QuarterWidget::setSceneGraph(realroot); | ||
32 | +} | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | +Viewer::~Viewer() | ||
37 | +{ | ||
38 | + //delete area; | ||
39 | +} | ||
40 | + | ||
41 | +/*void Viewer::reparent(QObject* obj) | ||
42 | +{ | ||
43 | + if (obj->inherits("QWidget")) | ||
44 | + { | ||
45 | + area->getWidget()->setParent((QWidget*)obj); //, QPoint(0,0), true); | ||
46 | + } | ||
47 | +}*/ | ||
48 | + | ||
49 | +void Viewer::setSize(QSize s) | ||
50 | +{ | ||
51 | + resize(s); | ||
52 | + setMinimumSize(s); | ||
53 | + //const SbVec2s vec(s.width(),s.height()); | ||
54 | + //area->setSize(vec); | ||
55 | +} | ||
56 | + | ||
57 | + | ||
58 | +void Viewer::viewAll() | ||
59 | +{ | ||
60 | + camera->viewAll(realroot, SbViewportRegion(width(), height()), 0.75f); | ||
61 | + SbVec3f pos = camera->position.getValue(); | ||
62 | + float x,y,z; | ||
63 | + pos.getValue(x,y,z); | ||
64 | + camera->position.setValue(0,0,z); | ||
65 | + | ||
66 | + camera->farDistance.setValue( camera->farDistance.getValue()*2.0f); | ||
67 | + camera->nearDistance.setValue( camera->nearDistance.getValue()/2.0f); | ||
68 | +} | ||
69 | + | ||
70 | +void Viewer::setSceneGraph(SoFieldContainer* fc) | ||
71 | +{ | ||
72 | + sceneRoot->removeAllChildren(); | ||
73 | + appendToSceneGraph(fc); | ||
74 | +} | ||
75 | + | ||
76 | + | ||
77 | +void Viewer::appendToSceneGraph(SoFieldContainer* fc) | ||
78 | +{ | ||
79 | + if (fc == 0) | ||
80 | + std::cerr << "Null node found ! " << std::endl; | ||
81 | + SoNode* node = dynamic_cast<SoNode*>(fc); | ||
82 | + | ||
83 | + if (node == 0) | ||
84 | + return ; | ||
85 | + | ||
86 | + sceneRoot->addChild(node); | ||
87 | + viewAll(); | ||
88 | +} |
scene/coin/viewer.h
0 → 100644
1 | +#ifndef __VIEWER_H__ | ||
2 | +#define __VIEWER_H__ | ||
3 | + | ||
4 | +#include <QSize> | ||
5 | +#include <QObject> | ||
6 | +#include <Quarter/QuarterWidget.h> | ||
7 | + | ||
8 | +class SoPerspectiveCamera; | ||
9 | +class SoSeparator; | ||
10 | +class SoFieldContainer; | ||
11 | + | ||
12 | +/*! \brief Simple inventor widget. | ||
13 | + * | ||
14 | + * This widget displays a coordinate frame in space. | ||
15 | + * One can set different orientations of this one. | ||
16 | + * \author Jean-Yves Didier | ||
17 | + * \date April the 10th, 2009 | ||
18 | + * \ingroup coin | ||
19 | + */ | ||
20 | +class Viewer : public SIM::Coin3D::Quarter::QuarterWidget //CoinInit | ||
21 | +{ | ||
22 | + Q_OBJECT | ||
23 | +public: | ||
24 | + Viewer(QObject* parent=0); //!< ARCS Constructor | ||
25 | + ~Viewer(); //!< ARCS Destructor | ||
26 | + | ||
27 | +public slots: | ||
28 | + void viewAll(); | ||
29 | + void setSize(QSize s); | ||
30 | + void setSceneGraph(SoFieldContainer* fc); | ||
31 | + void appendToSceneGraph(SoFieldContainer* fc); | ||
32 | + //void reparent(QObject* obj); | ||
33 | + | ||
34 | +private: | ||
35 | + SoPerspectiveCamera* camera; | ||
36 | + SoSeparator* realroot; | ||
37 | + SoSeparator* sceneRoot; | ||
38 | + | ||
39 | +}; | ||
40 | + | ||
41 | +#endif //__VIEWER_H__ |
... | @@ -59,13 +59,8 @@ void Obj2So::generate() | ... | @@ -59,13 +59,8 @@ void Obj2So::generate() |
59 | root->addChild(texCoords); | 59 | root->addChild(texCoords); |
60 | } | 60 | } |
61 | 61 | ||
62 | - | ||
63 | - | ||
64 | while (group) | 62 | while (group) |
65 | { | 63 | { |
66 | - //SoSeparator* sep = new SoSeparator; | ||
67 | - //root->addChild(sep); | ||
68 | - | ||
69 | if (model->materials) | 64 | if (model->materials) |
70 | { | 65 | { |
71 | SoMaterial* material = new SoMaterial; | 66 | SoMaterial* material = new SoMaterial; |
... | @@ -106,33 +101,7 @@ void Obj2So::generate() | ... | @@ -106,33 +101,7 @@ void Obj2So::generate() |
106 | faceSet->textureCoordIndex.setValues(i*4,3,(const int32_t*)model->triangles[group->triangles[i]].tindices); | 101 | faceSet->textureCoordIndex.setValues(i*4,3,(const int32_t*)model->triangles[group->triangles[i]].tindices); |
107 | faceSet->normalIndex.set1Value(i*4+3,-1); | 102 | faceSet->normalIndex.set1Value(i*4+3,-1); |
108 | } | 103 | } |
109 | - // ce bout de code est en ralit en train de remettre plat des indexed face set ! | 104 | + } |
110 | - // rcrire de manire plus lisible ! | ||
111 | - /*if (model->normals) | ||
112 | - { | ||
113 | - normals->vector.set1Value(i*3,&model->normals[3 * T(group->triangles[i]).nindices[0]]); | ||
114 | - normals->vector.set1Value(i*3+1,&model->normals[3 * T(group->triangles[i]).nindices[1]]); | ||
115 | - normals->vector.set1Value(i*3+2,&model->normals[3 * T(group->triangles[i]).nindices[2]]); | ||
116 | - } | ||
117 | - else | ||
118 | - { | ||
119 | - if (model->facetnorms) | ||
120 | - { | ||
121 | - normals->vector.set1Value(i,&model->facetnorms[3 * T(group->triangles[i]).findex]); | ||
122 | - } | ||
123 | - } | ||
124 | - if (model->texcoords) | ||
125 | - { | ||
126 | - texCoords->point.set1Value(i*3, &model->texcoords[2*T(group->triangles[i]).tindices[0]]); | ||
127 | - texCoords->point.set1Value(i*3+1, &model->texcoords[2*T(group->triangles[i]).tindices[1]]); | ||
128 | - texCoords->point.set1Value(i*3+2, &model->texcoords[2*T(group->triangles[i]).tindices[2]]); | ||
129 | - }*/ | ||
130 | - | ||
131 | - | ||
132 | - | ||
133 | - | ||
134 | - } | ||
135 | - //SoFaceSet | ||
136 | group= group->next; | 105 | group= group->next; |
137 | 106 | ||
138 | } | 107 | } | ... | ... |
... | @@ -3,7 +3,7 @@ win32: TEMPLATE = vclib | ... | @@ -3,7 +3,7 @@ win32: TEMPLATE = vclib |
3 | TARGET=arcsutils | 3 | TARGET=arcsutils |
4 | INCLUDEPATH += $$(ARCSDIR)/include | 4 | INCLUDEPATH += $$(ARCSDIR)/include |
5 | LIBS += -L$$(ARCSDIR)/lib -larcs | 5 | LIBS += -L$$(ARCSDIR)/lib -larcs |
6 | - CONFIG += dll | 6 | + CONFIG += dll debug |
7 | QT = core | 7 | QT = core |
8 | 8 | ||
9 | DESTDIR=../libs | 9 | DESTDIR=../libs | ... | ... |
-
Please register or login to post a comment