📄 calculator.cpp.in
字号:
/**************************************************************************\ * * This file is part of a set of example programs for the Coin library. * Copyright (C) 2000-2003 by Systems in Motion. All rights reserved. * * <URL:http://www.coin3d.org> * * This sourcecode can be redistributed and/or modified under the * terms of the GNU General Public License version 2 as published by * the Free Software Foundation. See the file COPYING at the root * directory of the distribution for more details. * * As a special exception, all sourcecode of the demo examples can be * used for any purpose for licensees of the Coin Professional * Edition License, without the restrictions of the GNU GPL. See our * web pages for information about how to acquire a Professional Edition * License. * * Systems in Motion, <URL:http://www.sim.no>, <mailto:support@sim.no> *\**************************************************************************//* ********************************************************************** * * calculator * * Demo application for showcasing Coin. * * Written by Lars J. Aas <larsa@coin3d.org>. * Additional copyright (C) 2001, Systems in Motion. * ********************************************************************** */ #include <Inventor/@Gui@/So@Gui@.h>#include <Inventor/@Gui@/viewers/So@Gui@ExaminerViewer.h>#include <Inventor/SbLinear.h>#include <Inventor/actions/SoGLRenderAction.h>#include <Inventor/actions/SoSearchAction.h>#include <Inventor/actions/SoHandleEventAction.h>#include <Inventor/actions/SoRayPickAction.h>#include <Inventor/nodes/SoCoordinate3.h>#include <Inventor/nodes/SoTranslation.h>#include <Inventor/nodes/SoScale.h>#include <Inventor/nodes/SoCallback.h>#include <Inventor/nodes/SoSphere.h>#include <Inventor/events/SoMouseButtonEvent.h>#include <Inventor/events/SoLocation2Event.h>#include <Inventor/SoPickedPoint.h>#include <Inventor/errors/SoDebugError.h>#include <assert.h>#include <stdio.h>#include <string.h>#include <stdlib.h> // exit()/* ********************************************************************** */const char * scenegraph[] = { "#Inventor V2.1 ascii", "", "Separator {", " Separator {", " DEF hook Callback {}", " ShapeHints {", " vertexOrdering COUNTERCLOCKWISE", " shapeType SOLID", " }", " DirectionalLight {", " color 0.4 0 0.8", " intensity 0.5", " direction 0.1 0 1", " }", " BaseColor {", " rgb 1 0 0", " }", " DEF camera PerspectiveCamera {}", " Separator {", " Translation { translation 0 0 0 }", " Scale { scaleFactor 36 1 4 }", " DEF UnitCube Separator {", " Coordinate3 {", " point [", " 0 0 0,", " 1 0 0,", " 1 1 0,", " 0 1 0,", " 0 0 1,", " 1 0 1,", " 1 1 1,", " 0 1 1", " ]", " }", " SoIndexedFaceSet {", " coordIndex [", " 0, 1, 5, 4, -1,", " 0, 3, 2, 1, -1,", " 0, 4, 7, 3, -1,", " 1, 2, 6, 5, -1,", " 2, 3, 7, 6, -1,", " 4, 5, 6, 7, -1", " ]", " }", " }", " }", " Separator {", " Translation { translation 1 1 1 }", " Scale { scaleFactor 1 16 2 }", " USE UnitCube", " }", " Separator {", " Translation { translation 34 1 1 }", " Scale { scaleFactor 1 16 2 }", " USE UnitCube", " }", " Separator {", " BaseColor { rgb 1 1 0 }", " Translation { translation 18 15.5 2 }", " RotationXYZ {", " axis Z", " angle 1.5707", " }", " Scale { scaleFactor 0.2 17.1 0.2 }", " Cylinder {}", " Translation { translation -12 0 0 }", " Cylinder {}", " Translation { translation -12 0 0 }", " Cylinder {}", " Translation { translation -12 0 0 }", " Cylinder {}", " Translation { translation -12 0 0 }", " Cylinder {}", " Translation { translation -12 0 0 }", " Cylinder {}", " }", " Separator {", " DEF raysnoop Callback {}", " Translation { translation 3 15.5 2 }", " Separator {" " BaseColor { rgb 1 0 0 }", " Scale { scaleFactor 1.03 1.03 1.03 }", " DEF r0t0 Translation { translation 0 0 0 }", " DEF r0s0 Sphere {}", " DEF r0t1 Translation { translation 1.93 0 0 }", " DEF r0s1 Sphere {}", " DEF r0t2 Translation { translation 1.93 0 0 }", " DEF r0s2 Sphere {}", " DEF r0t3 Translation { translation 1.93 0 0 }", " DEF r0s3 Sphere {}", " DEF r0t4 Translation { translation 1.93 0 0 }", " DEF r0s4 Sphere {}", " DEF r0t5 Translation { translation 1.93 0 0 }", " DEF r0s5 Sphere {}", " DEF r0t6 Translation { translation 1.93 0 0 }", " DEF r0s6 Sphere {}", " DEF r0t7 Translation { translation 1.93 0 0 }", " DEF r0s7 Sphere {}", " DEF r0t8 Translation { translation 1.93 0 0 }", " DEF r0s8 Sphere {}", " DEF r0t9 Translation { translation 1.93 0 0 }", " DEF r0s9 Sphere {}", " }", " Translation { translation 0 -2.4 0 }", " Separator {" " BaseColor { rgb 0 0 1 }", " Scale { scaleFactor 1.03 1.03 1.03 }", " DEF r1t0 Translation { translation 0 0 0 }", " DEF r1s0 Sphere {}", " DEF r1t1 Translation { translation 1.93 0 0 }", " DEF r1s1 Sphere {}", " DEF r1t2 Translation { translation 1.93 0 0 }", " DEF r1s2 Sphere {}", " DEF r1t3 Translation { translation 1.93 0 0 }", " DEF r1s3 Sphere {}", " DEF r1t4 Translation { translation 1.93 0 0 }", " DEF r1s4 Sphere {}", " DEF r1t5 Translation { translation 1.93 0 0 }", " DEF r1s5 Sphere {}", " DEF r1t6 Translation { translation 1.93 0 0 }", " DEF r1s6 Sphere {}", " DEF r1t7 Translation { translation 1.93 0 0 }", " DEF r1s7 Sphere {}", " DEF r1t8 Translation { translation 1.93 0 0 }", " DEF r1s8 Sphere {}", " DEF r1t9 Translation { translation 1.93 0 0 }", " DEF r1s9 Sphere {}", " }", " Translation { translation 0 -2.4 0 }", " Separator {" " BaseColor { rgb 0 1 0 }", " Scale { scaleFactor 1.03 1.03 1.03 }", " DEF r2t0 Translation { translation 0 0 0 }", " DEF r2s0 Sphere {}", " DEF r2t1 Translation { translation 1.93 0 0 }", " DEF r2s1 Sphere {}", " DEF r2t2 Translation { translation 1.93 0 0 }", " DEF r2s2 Sphere {}", " DEF r2t3 Translation { translation 1.93 0 0 }", " DEF r2s3 Sphere {}", " DEF r2t4 Translation { translation 1.93 0 0 }", " DEF r2s4 Sphere {}", " DEF r2t5 Translation { translation 1.93 0 0 }", " DEF r2s5 Sphere {}", " DEF r2t6 Translation { translation 1.93 0 0 }", " DEF r2s6 Sphere {}", " DEF r2t7 Translation { translation 1.93 0 0 }", " DEF r2s7 Sphere {}", " DEF r2t8 Translation { translation 1.93 0 0 }", " DEF r2s8 Sphere {}", " DEF r2t9 Translation { translation 1.93 0 0 }", " DEF r2s9 Sphere {}", " }", " Translation { translation 0 -2.4 0 }", " Separator {" " BaseColor { rgb 0 1 1 }", " Scale { scaleFactor 1.03 1.03 1.03 }", " DEF r3t0 Translation { translation 0 0 0 }", " DEF r3s0 Sphere {}", " DEF r3t1 Translation { translation 1.93 0 0 }", " DEF r3s1 Sphere {}", " DEF r3t2 Translation { translation 1.93 0 0 }", " DEF r3s2 Sphere {}", " DEF r3t3 Translation { translation 1.93 0 0 }", " DEF r3s3 Sphere {}", " DEF r3t4 Translation { translation 1.93 0 0 }", " DEF r3s4 Sphere {}", " DEF r3t5 Translation { translation 1.93 0 0 }", " DEF r3s5 Sphere {}", " DEF r3t6 Translation { translation 1.93 0 0 }", " DEF r3s6 Sphere {}", " DEF r3t7 Translation { translation 1.93 0 0 }", " DEF r3s7 Sphere {}", " DEF r3t8 Translation { translation 1.93 0 0 }", " DEF r3s8 Sphere {}", " DEF r3t9 Translation { translation 1.93 0 0 }", " DEF r3s9 Sphere {}", " }", " Translation { translation 0 -2.4 0 }", " Separator {" " BaseColor { rgb 1 1 0 }", " Scale { scaleFactor 1.03 1.03 1.03 }", " DEF r4t0 Translation { translation 0 0 0 }", " DEF r4s0 Sphere {}", " DEF r4t1 Translation { translation 1.93 0 0 }", " DEF r4s1 Sphere {}", " DEF r4t2 Translation { translation 1.93 0 0 }", " DEF r4s2 Sphere {}", " DEF r4t3 Translation { translation 1.93 0 0 }", " DEF r4s3 Sphere {}", " DEF r4t4 Translation { translation 1.93 0 0 }", " DEF r4s4 Sphere {}", " DEF r4t5 Translation { translation 1.93 0 0 }", " DEF r4s5 Sphere {}", " DEF r4t6 Translation { translation 1.93 0 0 }", " DEF r4s6 Sphere {}", " DEF r4t7 Translation { translation 1.93 0 0 }", " DEF r4s7 Sphere {}", " DEF r4t8 Translation { translation 1.93 0 0 }", " DEF r4s8 Sphere {}", " DEF r4t9 Translation { translation 1.93 0 0 }", " DEF r4s9 Sphere {}", " }", " Translation { translation 0 -2.4 0 }", " Separator {" " BaseColor { rgb 0.8 0.8 0.8 }", " Scale { scaleFactor 1.03 1.03 1.03 }", " DEF r5t0 Translation { translation 0 0 0 }", " DEF r5s0 Sphere {}", " DEF r5t1 Translation { translation 3.107 0 0 }", " DEF r5s1 Sphere {}", " DEF r5t2 Translation { translation 3.107 0 0 }", " DEF r5s2 Sphere {}", " DEF r5t3 Translation { translation 3.107 0 0 }", " DEF r5s3 Sphere {}", " DEF r5t4 Translation { translation 3.107 0 0 }", " DEF r5s4 Sphere {}", " DEF r5t5 Translation { translation 3.107 0 0 }", " DEF r5s5 Sphere {}", " DEF r5t6 Translation { translation 3.107 0 0 }", " DEF r5s6 Sphere {}", " DEF r5t7 Translation { translation 3.107 0 0 }", " DEF r5s7 Sphere {}", " DEF r5t8 Translation { translation 3.107 0 0 }", " DEF r5s8 Sphere {}", " DEF r5t9 Translation { translation 3.107 0 0 }",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -