<< 7/7

Sitex Air Renderer and Python cgkit

11年前の記事Happy Buddha!
http://rman.sakura.ne.jp/sb/log/eid62.html

python2.7でcgkitを扱う。sitex airでレンダリング。Happy Buddha
Happy Buddha

cgkitの良いところは、RIBで出力した設定を挿入して、レンダラーに合わせて設定できるところ。Airspace(windows only)を使って、shaderやlightの設定を、レンダリングして、スクリプトを参考にcgkitに挿入した。

以下、スクリプトbuddha_air.py
ありがとうございます。

######################################################################
# Main file for rendering the landscape image
######################################################################
# sitex air renderer and python2.7 cgkit

g=Globals(rib="""Option "occlusion" "prepass" [1]

# the prepass uses indirect attributes for the occlusion call

Attribute "indirect" "maxerror" [0.1]
Attribute "indirect" "integer nsamples" 64
Attribute "indirect" "maxhitdist" 6
Attribute "indirect" "maxpixeldist" 10
Imager "background" "color background" [0.2 0.4 0.6]

Option "searchpath" "shader" "C:/Program Files (x86)/AIR//shaders:C:/Program Files (x86)/AIR//usershaders:&"
Imager "VBgEnvironment"
"float Intensity" [1]
"string EnvironmentName" ["C:/Program Files (x86)/AIR/texture/DebevecGroveProbe.tx"]
"string EnvironmentSpace" ["world"]
"float EnvironmentBlur" [0]
#UseFrames 0
Environment "envMap"
"string MapName" ["C:/Program Files (x86)/AIR/texture/DebevecGroveProbe.tx"]
"float MapIntensity" [1]
"float MapBlur" [0.01]
"float MapSamples" [4]
"string MapSpace" ["world"]
"float RotateX" [90]
"float RotateY" [0]
"float RotateZ" [0]
"float ReflectionVisibility" [1]
"float ReflectionIntensity" [1]
"float ReflectionAddBlur" [0]
"float IndirectVisibility" [1]
"float IndirectIntensity" [1]
"float IndirectAddBlur" [0]
"float CameraVisibility" [0]
"float CameraIntensity" [1]
"float CameraAddBlur" [0]
""",
resolution = (320, 240),
#pixelsamples=(4,4),
#shadingrate=0.25,
#pixelfilter=("gaussian",(2,2)),
up = (0,1,0),
background = (0.2,0.2,0.2)
)

######################################################################
# Camera
######################################################################

# Load the external camera (if it exists), otherwise use the camera for
# the final image
if os.path.exists("camera.py"):
load("camera.py")
else:
TargetCamera(
name = "Camera",
pos = (0.0729126, 0.641438, -2.2),
target = (0, 0, 0),
fov = 30
)

GLPointLight(
intensity = 0.1,
pos = (-50,30, -20),
diffuse = (1, 1, 1)
)

# ...and a distant light

dis=RMLightSource(name = "distant_0",shader=RMShader("distantlight",intensity=0.4))
dis.shader.declare('string shadowname="raytrace"')
dis.shader.declare('uniform point from=(-15,30,-30)')

# ...and a env light

env=RMLightSource(name = "env01",shader= RMShader("envlight"))
env.shader.declare('uniform color lightcolor=(.9,.9,1)')
env.shader.declare('uniform color shadowcolor=(.05,.05,0)')

# ...no indirect

# models and darktree shader

r=RIBArchive(
name ="butu_center",
filename = './butu.rib',
pos = (0,0,0)
)

r.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "int transmission" [1]\nSurface "DarkTreeSurface"\n "string DarkTreeShader" ["C:/Users/yokamak/Documents/cgkit/DTRep_thumb/tx_stone/pvStone_Tan_Brown.dsts"]\n "float Diffuse" [1]\n "float Specular" [1]\n "float Reflection" [1]\n "float ReflectionSamples" [1]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float Incandescence" [1]\n "float Use2DCoordinates" [0]\n "float[2] Texture2dSize" [1 1]\n "float[2] Texture2dOrigin" [0 0]\n "float Texture2dAngle" [0]\n "float Pattern3dSize" [1]\n "float[3] Pattern3dOrigin" [0 0 0]\n "string Pattern3dSpace" ["shader"]\n "float BumpScale" [1]\n "float TimeScale" [1]\n "string ColorTweak1Name" ["Color 1"]\n "color ColorTweak1" [0.682 0.556 0.513]\n "string ColorTweak2Name" ["Coor 2"]\n "color ColorTweak2" [0.545 0.466 0.439]\n "string ColorTweak3Name" ["Color 3"]\n "color ColorTweak3" [0.533 0.435 0.419]\n "string ColorTweak4Name" ["Color 4"]\n "color ColorTweak4" [0.654 0.65 0.545]\n "string ColorTweak5Name" ["Color 5"]\n "color ColorTweak5" [0.494 0.411 0.352]\n "string ColorTweak6Name" ["Water"]\n "color ColorTweak6" [0 0.192 0.388]\n "string FloatTweak1Name" ["Diffuse"]\n "float FloatTweak1" [1]\n "string FloatTweak2Name" ["Specular"]\n "float FloatTweak2" [0.75]\n "string FloatTweak3Name" ["Glossiness"]\n "float FloatTweak3" [0.35]\n "string FloatTweak4Name" ["Seed"]\n "float FloatTweak4" [1]\n "string FloatTweak5Name" ["Dark Specular"]\n "float FloatTweak5" [1]\n "string FloatTweak6Name" ["Light Specular"]\n "float FloatTweak6" [0]\n "string FloatTweak7Name" ["Dark Gloss"]\n "float FloatTweak7"\n'


t=RIBArchive(
name ="butu_left",
filename = './butu.rib',
pos = (0.5,0,0)
)

t.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "int transmission" [1]\nSurface "DarkTreeSurface"\n "string DarkTreeShader" ["C:/Program Files (x86)/AIR/viztools/darktree/metalGoldTarnish.dsts"]\n "float Diffuse" [1]\n "float Specular" [1]\n "float Reflection" [1]\n "float ReflectionSamples" [1]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float Incandescence" [1]\n "float Use2DCoordinates" [0]\n "float[2] Texture2dSize" [1 1]\n "float[2] Texture2dOrigin" [0 0]\n "float Texture2dAngle" [0]\n "float Pattern3dSize" [1]\n "float[3] Pattern3dOrigin" [0 0 0]\n "string Pattern3dSpace" ["shader"]\n "float BumpScale" [1]\n "float TimeScale" [1]\n "string ColorTweak1Name" ["Gold 1"]\n "color ColorTweak1" [0.913 0.85 0.615]\n "string ColorTweak2Name" ["Gold 2"]\n "color ColorTweak2" [0.878 0.701 0.349]\n "string ColorTweak3Name" ["Rust 1"]\n "color ColorTweak3" [0.294 0.211 0.172]\n "string FloatTweak1Name" ["Tarnish"]\n "float FloatTweak1" [0]\n "string FloatTweak2Name" ["Reflectivity"]\n "float FloatTweak2" [0.2]\n "string FloatTweak3Name" ["Input Seed"]\n "float FloatTweak3" [133]\n "string FloatTweak4Name" ["Glossiness"]\n "float FloatTweak4" [0.05]\n "string FloatTweak5Name" ["Metal Hightlight"]\n "float FloatTweak5" [0.75]\n "string FloatTweak6Name" [""]\n "float FloatTweak6" [0.5]\n "string FloatTweak7Name" [""]\n "float FloatTweak7" [0.5]\n'



s=RIBArchive(
name ="butu_right",
filename = './butu.rib',
pos = (-0.5,0,0)
)

s.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "int transmission" [1]\n Surface "DarkTreeSurface"\n "string DarkTreeShader" ["C:/Users/yokamak/Documents/cgkit/DTRep_thumb/ba_shader/MetallicPaintShader.dsts"]\n "float Diffuse" [1]\n "float Specular" [1]\n "float Reflection" [1]\n "float ReflectionSamples" [1]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float Incandescence" [1]\n "float Use2DCoordinates" [0]\n "float[2] Texture2dSize" [1 1]\n "float[2] Texture2dOrigin" [0 0]\n "float Texture2dAngle" [0]\n "float Pattern3dSize" [1]\n "float[3] Pattern3dOrigin" [0 0 0]\n "string Pattern3dSpace" ["shader"]\n "float BumpScale" [1]\n "float TimeScale" [1]\n "string ColorTweak1Name" ["Paint Color"]\n "color ColorTweak1" [0.247 0.572 0.929]\n "string ColorTweak2Name" ["Paint Color 2"]\n "color ColorTweak2" [0 0.289 1]\n "string ColorTweak3Name" ["Rust 1"]\n "color ColorTweak3" [0.294 0.211 0.172]\n "string ColorTweak4Name" ["Rust 2"]\n "color ColorTweak4" [0.439 0.239 0.203]\n "string ColorTweak5Name" ["Rust 3"]\n "color ColorTweak5" [0.313 0.266 0.239]\n "string ColorTweak6Name" ["Rust 4"]\n "color ColorTweak6" [0.556 0.301 0.066]\n "string FloatTweak1Name" ["Reflectivity"]\n "float FloatTweak1" [0.35]\n "string FloatTweak2Name" ["Metallic Specular"]\n "float FloatTweak2" [0.55]\n "string FloatTweak3Name" ["CC Specular"]\n "float FloatTweak3" [0.5]\n "string FloatTweak4Name" ["CC Gloss"]\n "float FloatTweak4" [0.9]\n "string FloatTweak5Name" ["Random Seed"]\n "float FloatTweak5" [95]\n "string FloatTweak6Name" ["Glossiness"]\n "float FloatTweak6" [0.15]\n "string FloatTweak7Name" ["Seed"]\n "float FloatTweak7" [6]\n'

pl = RMMaterial(
surface = RMShader("VWood"),
color = (1, 1, 1))

pl2 = RMMaterial(
surface = RMShader("VPhysicalMetal"),
color = (1, 1, 1))

glm=GLMaterial(diffuse=(0.8, 0.7, 0.7))

p01=Plane(
lx = 50,
ly = 50,
pos = (0,0,0.6),
rot= mat3().fromEulerXYZ(0, radians(180), 0)
)
p01.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "shadow" [1]\n Surface "VShinyTile2D"\n "float Diffuse" [0.9]\n "float DiffuseRoughness" [0.3]\n "float Specular" [0.5]\n "float SpecularRoughness" [0.01]\n "float SpecularSharpness" [0.8]\n "float Reflection" [4.0]\n "float ReflectionSamples" [2]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float[2] TileSize" [0.01 0.01]\n "float TileStagger" [0]\n "float TileColorVary" [0.1]\n "float GrooveWidth" [0.001]\n "float GrooveDepth" [0.008]\n "color GrooveColor" [0.98 0.98 0.98]\n "float BumpHeight" [0]\n "float BumpWidth" [0.0005]\n "float[2] TextureSizeXY" [0.25 0.25]\n "float[2] TextureOriginXY" [0 0]\n "float TextureAngle" [0]\n "string Projection" ["st"]\n "string ProjectionSpace" ["shader"]\n "float[16] ProjectionTransform" [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]'

#p01.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "shadow" [1]\nSurface "VMetal"\n'

p02=Plane(
lx = 50,
ly = 50,
pos = (0,-0.44,0),
rot= mat3().fromEulerXYZ(radians(-90), 0, 0),
material = pl2
)
p02.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "shadow" [1]\n'

  • -
  • -

Fedora Linux 37でpython cgkit pyODE install

Fedora30以降、pyODEはパッケージでないので、以下インストールしてみました。
■Download PyODE-snapshot-2010-03-22.tar.gz

■PyODE-snapshot-2010-03-22]$ python setup.py build
INFO: found in /usr/include
INFO: Creating ode_trimesh.c
pyrexc -o ode_trimesh.c -I. -Isrc src/ode.pyx
sh: 行 1: pyrexc: コマンドが見つかりません
ERROR: An error occured while generating the C source file.

■Download Pyrex-0.9.9.tar.gz
$ sudo python setup.py install
copying build/scripts-2.7/pyrexc -> /usr/bin
changing mode of /usr/bin/pyrexc to 755
running install_data
copying Pyrex/Compiler/Lexicon.pickle -> /usr/lib/python2.7/site-packages/Pyrex/Compiler
running install_egg_info
Writing /usr/lib/python2.7/site-packages/Pyrex-0.9.9-py2.7.egg-info

■pyODEのbuild
PyODE-snapshot-2010-03-22]$ python setup.py build
INFO: found in /usr/include
INFO: Creating ode_trimesh.c
pyrexc -o ode_trimesh.c -I. -Isrc src/ode.pyx
/home/mac/Downloads/PyODE-snapshot-2010-03-22/src/mass.pyx:263:18: Warning: 'not None' will become the default in a future version of Pyrex. Use 'or None' to allow passing None.
INFO: Creating ode_notrimesh.c
pyrexc -o ode_notrimesh.c -I. -Isrc src/ode.pyx
/home/mac/Downloads/PyODE-snapshot-2010-03-22/src/mass.pyx:263:18: Warning: 'not None' will become the default in a future version of Pyrex. Use 'or None' to allow passing None.
INFO: Installing with trimesh support.
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/xode
copying xode/errors.py -> build/lib.linux-x86_64-2.7/xode
copying xode/body.py -> build/lib.linux-x86_64-2.7/xode
copying xode/parser.py -> build/lib.linux-x86_64-2.7/xode
copying xode/transform.py -> build/lib.linux-x86_64-2.7/xode
copying xode/geom.py -> build/lib.linux-x86_64-2.7/xode
copying xode/node.py -> build/lib.linux-x86_64-2.7/xode
copying xode/__init__.py -> build/lib.linux-x86_64-2.7/xode
copying xode/joint.py -> build/lib.linux-x86_64-2.7/xode
running build_ext
building 'ode' extension
creating build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include -I/usr/local/include -I/opt/local/include -I/usr/include/python2.7 -c ode_trimesh.c -o build/temp.linux-x86_64-2.7/ode_trimesh.o
ode_trimesh.c: 関数 ‘__pyx_f_3ode_4Mass_setCappedCylinder’ 内:
ode_trimesh.c:907:3: 警告: ‘dMassSetCappedCylinder’ is deprecated [-Wdeprecated-declarations]
907 | dMassSetCappedCylinder((&((struct __pyx_obj_3ode_Mass *)__pyx_v_self)->_mass),__pyx_1,__pyx_2,__pyx_3,__pyx_4);
| ^~~~~~~~~~~~~~~~~~~~~~
次のファイルから読み込み: /usr/include/ode/ode.h:40,
次から読み込み: ode_trimesh.c:32:
/usr/include/ode/mass.h:84:33: 備考: ここで宣言されています
84 | ODE_API_DEPRECATED ODE_API void dMassSetCappedCylinder(dMass *a, dReal b, int c, dReal d, dReal e);
| ^~~~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_4Mass_setCappedCylinderTotal’ 内:
ode_trimesh.c:946:3: 警告: ‘dMassSetCappedCylinderTotal’ is deprecated [-Wdeprecated-declarations]
946 | dMassSetCappedCylinderTotal((&((struct __pyx_obj_3ode_Mass *)__pyx_v_self)->_mass),__pyx_1,__pyx_2,__pyx_3,__pyx_4);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ode/mass.h:85:33: 備考: ここで宣言されています
85 | ODE_API_DEPRECATED ODE_API void dMassSetCappedCylinderTotal(dMass *a, dReal b, int c, dReal d, dReal e);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_11Hinge2Joint_setAxis1’ 内:
ode_trimesh.c:8143:3: 警告: ‘dJointSetHinge2Axis1’ is deprecated [-Wdeprecated-declarations]
8143 | dJointSetHinge2Axis1(((struct __pyx_obj_3ode_Hinge2Joint *)__pyx_v_self)->__pyx_base.jid,__pyx_3,__pyx_4,__pyx_5);
| ^~~~~~~~~~~~~~~~~~~~
次のファイルから読み込み: /usr/include/ode/ode.h:42:
/usr/include/ode/objects.h:1986:33: 備考: ここで宣言されています
1986 | ODE_API_DEPRECATED ODE_API void dJointSetHinge2Axis1 (dJointID j, dReal x, dReal y, dReal z);
| ^~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_11Hinge2Joint_setAxis2’ 内:
ode_trimesh.c:8232:3: 警告: ‘dJointSetHinge2Axis2’ is deprecated [-Wdeprecated-declarations]
8232 | dJointSetHinge2Axis2(((struct __pyx_obj_3ode_Hinge2Joint *)__pyx_v_self)->__pyx_base.jid,__pyx_3,__pyx_4,__pyx_5);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/ode/objects.h:1996:33: 備考: ここで宣言されています
1996 | ODE_API_DEPRECATED ODE_API void dJointSetHinge2Axis2 (dJointID j, dReal x, dReal y, dReal z);
| ^~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_13GeomTransform___cinit__’ 内:
ode_trimesh.c:13433:12: 警告: ‘dCreateGeomTransform’ is deprecated [-Wdeprecated-declarations]
13433 | ((struct __pyx_obj_3ode_GeomTransform *)__pyx_v_self)->__pyx_base.gid = dCreateGeomTransform(__pyx_v_sid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
次のファイルから読み込み: /usr/include/ode/ode.h:44:
/usr/include/ode/collision.h:1089:36: 備考: ここで宣言されています
1089 | ODE_API_DEPRECATED ODE_API dGeomID dCreateGeomTransform (dSpaceID space);
| ^~~~~~~~~~~~~~~~~~~~
ode_trimesh.c:13436:3: 警告: ‘dGeomTransformSetCleanup’ is deprecated [-Wdeprecated-declarations]
13436 | dGeomTransformSetCleanup(((struct __pyx_obj_3ode_GeomTransform *)__pyx_v_self)->__pyx_base.gid,0);
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ode/collision.h:1092:33: 備考: ここで宣言されています
1092 | ODE_API_DEPRECATED ODE_API void dGeomTransformSetCleanup (dGeomID g, int mode);
| ^~~~~~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_13GeomTransform_setGeom’ 内:
ode_trimesh.c:13606:3: 警告: ‘dGeomTransformSetGeom’ is deprecated [-Wdeprecated-declarations]
13606 | dGeomTransformSetGeom(((struct __pyx_obj_3ode_GeomTransform *)__pyx_v_self)->__pyx_base.gid,((dGeomID)__pyx_v_id));
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/ode/collision.h:1090:33: 備考: ここで宣言されています
1090 | ODE_API_DEPRECATED ODE_API void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
| ^~~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_13GeomTransform_setInfo’ 内:
ode_trimesh.c:13672:3: 警告: ‘dGeomTransformSetInfo’ is deprecated [-Wdeprecated-declarations]
13672 | dGeomTransformSetInfo(((struct __pyx_obj_3ode_GeomTransform *)__pyx_v_self)->__pyx_base.gid,__pyx_v_mode);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/ode/collision.h:1094:33: 備考: ここで宣言されています
1094 | ODE_API_DEPRECATED ODE_API void dGeomTransformSetInfo (dGeomID g, int mode);
| ^~~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_13GeomTransform_getInfo’ 内:
ode_trimesh.c:13694:3: 警告: ‘dGeomTransformGetInfo’ is deprecated [-Wdeprecated-declarations]
13694 | __pyx_1 = PyInt_FromLong(dGeomTransformGetInfo(((struct __pyx_obj_3ode_GeomTransform *)__pyx_v_self)->__pyx_base.gid)); if (!__pyx_1) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 521; goto __pyx_L1;}
| ^~~~~~~
/usr/include/ode/collision.h:1095:32: 備考: ここで宣言されています
1095 | ODE_API_DEPRECATED ODE_API int dGeomTransformGetInfo (dGeomID g);
| ^~~~~~~~~~~~~~~~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_11TriMeshData_build’ 内:
ode_trimesh.c:13931:225: 警告: 4 番目の ‘dGeomTriMeshDataBuildSimple’ の引数を渡すときのポインタの先の符号が異なります [-Wpointer-sign]
13931 | dGeomTriMeshDataBuildSimple(((struct __pyx_obj_3ode_TriMeshData *)__pyx_v_self)->tmdid,((struct __pyx_obj_3ode_TriMeshData *)__pyx_v_self)->vertex_buffer,__pyx_v_numverts,((struct __pyx_obj_3ode_TriMeshData *)__pyx_v_self)->face_buffer,(__pyx_v_numfaces * 3));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
| |
| int *
次のファイルから読み込み: /usr/include/ode/collision.h:1087:
/usr/include/ode/collision_trimesh.h:145:51: 備考: expected ‘const dTriIndex *’ {aka ‘const unsigned int *’} but argument is of type ‘int *’
145 | const dTriIndex* Indices, int IndexCount);
| ~~~~~~~~~~~~~~~~~^~~~~~~
ode_trimesh.c: 関数 ‘__pyx_f_3ode_15GeomHeightfield___cinit__’ 内:
ode_trimesh.c:14456:129: 警告: ポインタから異なるサイズの整数へのキャストです [-Wpointer-to-int-cast]
14456 | ((struct __pyx_obj_3ode_GeomHeightfield *)__pyx_v_self)->__pyx_base.gid = dCreateHeightfield(__pyx_v_sid,__pyx_v_data->hfdid,((int)__pyx_v_placeable));
| ^
gcc -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 build/temp.linux-x86_64-2.7/ode_trimesh.o -L/usr/lib -L/usr/local/lib -L/opt/local/lib -L/usr/lib64 -lode -lstdc++ -lpython2.7 -o build/lib.linux-x86_64-2.7/ode.so -lode
/usr/bin/ld: 互換性のないを /usr/lib/libc.so スキップしました (-lc を探索している時)

■できたような、buildフォルダにできてます。
■pyODEのインストール
PyODE-snapshot-2010-03-22]$ sudo python setup.py install --record files.txt

INFO: found in /usr/include
INFO: ode_trimesh.c is up to date
INFO: ode_notrimesh.c is up to date
INFO: Installing with trimesh support.
running install
running build
running build_py
running build_ext
running install_lib
copying build/lib.linux-x86_64-2.7/ode.so -> /usr/lib64/python2.7/site-packages
running install_egg_info
Writing /usr/lib64/python2.7/site-packages/PyODE-1.2.0-py2.7.egg-info
writing list of installed files to 'files.txt'
[mac@mac-local PyODE-snapshot-2010-03-22]$

■cgkitでの確認
cgkit-2.0.0]$ cd utilities/
$ python checkenv.py
----------------------------------------------------------------------
Python 2.7.18 (default, Aug 22 2022, 00:00:00)
[GCC 12.2.1 20220819 (Red Hat 12.2.1-1)]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. 2.0.0 (May 04 2020)
cgkit (C++ lib)............... OK
cgkit (all)................... OK
PyODEが入ってます。

■python cgkitで動作確認しました。
$ viewer.py newton-ball.py
Screenshot from 2022-12-31 13-12-10.png
ありがとうございます。
  • -
  • -

Linux Lite4.2 update and python cgkit error

■cgkit_sample $ viewer.py demo1.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/usr/local/bin/viewer.py", line 63, in
from cgkit.all import *
File "/usr/local/lib/python2.7/dist-packages/cgkit/all/__init__.py", line 46, in
from cgkit import _core
ImportError: libboost_python-py27.so.1.65.1: cannot open shared object file: No such file or directory

■cgkit_sample $ sudo ldconfig -p | grep libboost_python
libboost_python38.so.1.67.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.67.0
libboost_python38.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python38.so
libboost_python27.so.1.67.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python27.so.1.67.0
libboost_python27.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libboost_python27.so
■ cgkit_sample $ cd /usr/lib/x86_64-linux-gnu/
■ /usr/lib/x86_64-linux-gnu $ ls libboost*.*
libboost_date_time.so.1.71.0 libboost_python27.so.1.67.0
libboost_filesystem.so.1.71.0 libboost_python3-py38.a
libboost_iostreams.so.1.71.0 libboost_python3-py38.so
libboost_locale.so.1.71.0 libboost_python3.a
libboost_python.a libboost_python3.so
libboost_python.so libboost_python38.a
libboost_python2.so libboost_python38.so
libboost_python27.a libboost_python38.so.1.67.0
libboost_python27.so libboost_thread.so.1.71.0
■ /usr/lib/x86_64-linux-gnu $ sudo ln -s libboost_python27.so.1.67.0 libboost_python-py27.so.1.65.1
■ /usr/lib/x86_64-linux-gnu $ ls libboost*.*
libboost_date_time.so.1.71.0 libboost_python27.so.1.67.0
libboost_filesystem.so.1.71.0 libboost_python3-py38.a
libboost_iostreams.so.1.71.0 libboost_python3-py38.so
libboost_locale.so.1.71.0 libboost_python3.a
libboost_python-py27.so.1.65.1 libboost_python3.so
libboost_python.a libboost_python38.a
libboost_python.so libboost_python38.so
libboost_python2.so libboost_python38.so.1.67.0
libboost_python27.a libboost_thread.so.1.71.0
libboost_python27.so
■ /usr/lib/x86_64-linux-gnu $ sudo ldconfig

■cgkit_sample $ viewer.py demo3.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html

■cgkit-2.0.0/utilities $ python checkenv.py
----------------------------------------------------------------------
Python 2.7.18 (default, Jul 1 2022, 12:27:04)
[GCC 9.4.0]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. 2.0.0 (Nov 26 2018)
cgkit (C++ lib)............... OK
cgkit (all)................... OK

It works.
Thank you.
  • -
  • -

Installed python cgkit on Mx Linux21.3 using python2.7

LANG=C xdg-user-dirs-gtk-update
sudo apt update
sudo apt upgrade
sudo apt install build-essential

sudo apt install python-is-python2
sudo apt install python2-dev
sudo apt install libode-dev
sudo apt install lib3ds-dev
sudo apt install freeglut3-dev
sudo apt install libboost-all-dev

■Download cgkit.
https://sourceforge.net/p/cgkit/code/ci/master/tree/


glmaterial.py, line 141, in _passPILImage
self.texData(w, h, format, GL_UNSIGNED_BYTE, img.tostring())

replaced tostring() with tobytes().

self.texData(w, h, format, GL_UNSIGNED_BYTE, img.tobytes())

■Download PyProtocol.
http://peak.telecommunity.com/dist/

■Download get-pip.py for 2.7.
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
# python get-pip.py


mak@mx:~/.local/bin
$ ./pip install pygame
$ ./pip install pyopengl
$ ./pip install serial
$ ./pip install pyode
$ ./pip install pillow
$ ./pip install scons

$ unzip PyProtocols-0.9.3.zip
$ sudo python setup.py --without-speedups install

$ ./pip list
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Package Version
----------- -------
future 0.18.3
iso8601 0.1.16
Pillow 6.2.2
pip 20.3.4
pygame 2.0.3
PyODE 1.2.1
PyOpenGL 3.1.7
PyProtocols 0.9.3
PyYAML 5.4.1
scons 3.1.2
serial 0.0.97
setuptools 44.1.1
wheel 0.37.1




$ cd ~/Downloads/cgkit-code/utilities/
mak@mx:~/Downloads/cgkit-code/utilities
$ python checkenv.py
----------------------------------------------------------------------
Python 2.7.18 (default, Jul 14 2021, 08:11:37)
[GCC 10.2.1 20210110]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 2.0.3 (SDL 2.0.16, Python 2.7.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. missing
cgkit (C++ lib)............... failed

The cgkit supportlib could not be imported. One possible reason for that
is that shared libraries (such as the boost_python runtime or OpenGL)
could not be found.

cgkit (all)................... failed


$ ls /usr/lib/x86_64-linux-gnu/libboost_python*.*
/usr/lib/x86_64-linux-gnu/libboost_python39.a
/usr/lib/x86_64-linux-gnu/libboost_python39.so
/usr/lib/x86_64-linux-gnu/libboost_python39.so.1.74.0

■Download following:
libboost-python1.67.0_1.67.0-17ubuntu8_amd64.deb
libboost-python1.67-dev_1.67.0-17ubuntu8_amd64.deb

$ dpkg -x libboost-python1.67.0_1.67.0-17ubuntu8_amd64.deb usr
$ dpkg -x libboost-python1.67-dev_1.67.0-17ubuntu8_amd64.deb usr

■Copy following:
libboost_python27.so
libboost_python27.so.1.67.0
libboost_python27.a


$ sudo cp libboost_python27*.* /usr/lib/x86_64-linux-gnu/

$ ls /usr/lib/x86_64-linux-gnu/libboost_python*.*
/usr/lib/x86_64-linux-gnu/libboost_python27.a
/usr/lib/x86_64-linux-gnu/libboost_python27.so
/usr/lib/x86_64-linux-gnu/libboost_python27.so.1.67.0
/usr/lib/x86_64-linux-gnu/libboost_python39.a
/usr/lib/x86_64-linux-gnu/libboost_python39.so
/usr/lib/x86_64-linux-gnu/libboost_python39.so.1.74.0

$ ls /usr/lib/x86_64-linux-gnu/lib3ds*.*
/usr/lib/x86_64-linux-gnu/lib3ds-1.so
/usr/lib/x86_64-linux-gnu/lib3ds-1.so.3.0.0
/usr/lib/x86_64-linux-gnu/lib3ds-1.so.3
/usr/lib/x86_64-linux-gnu/lib3ds.so

■scons
$ /home/mak/.local/bin/scons

■changed config.cfg
######################################################################
# Boost.Python settings
######################################################################

# Name of the Boost.Python library to link with
BOOST_LIB = "boost_python27"


####### Libd3DS #######

LIB3DS_AVAILABLE = True
LIB3DS_PATH = r"/usr/lib/x86_64-linux-gnu/"

#LIB3DS_LIBNAME = "lib3ds-120s"


■Build cgkit.
$ python setup.py build


1.Build error;

wrappers/py_arrayslots1.cpp: In function ‘void class_ArraySlots()’:
wrappers/py_slot.h:43:75: error: unable to find string literal operator ‘operator""sname’ with ‘const char [11]’, ‘long unsigned int’ arguments
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
| ^~~~~~~~~~~
wrappers/py_slot.h:43:75: note: in definition of macro ‘ARRAYSLOT’
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
| ^~~~~~~~~~~
wrappers/py_slot.h:43:75: error: unable to find string literal operator ‘operator""sname’ with ‘const char [11]’, ‘long unsigned int’ arguments
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
| ^~~~~~~~~~~
wrappers/py_slot.h:43:75: note: in definition of macro ‘ARRAYSLOT’
43 | #define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
|


1.Build error;

[solved]
py_slot.h,line:43, Put blank spaces on both sides of sname.

>("_" sname "_Iterator",



2.Build error;

wrappers/py_geoms1.cpp: In member function ‘boost::python::api::object _VariableIterator::next()’:
wrappers/py_geoms1.cpp:145:24: error: could not convert ‘std::make_tuple(_Elements&& ...) [with _Elements = {std::__cxx11::basic_string, std::allocator >&, const support3d::VarStorage&, const support3d::VarType&, const int&}](info.support3d::PrimVarInfo::storage, info.support3d::PrimVarInfo::type, info.support3d::PrimVarInfo::multiplicity)’ from ‘std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>’ to ‘boost::python::api::object’
145 | return make_tuple(name, info.storage, info.type, info.multiplicity);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>
wrappers/py_geoms1.cpp: In function ‘boost::python::api::object findVariable(support3d::GeomObject*, std::string)’:
wrappers/py_geoms1.cpp:166:22: error: could not convert ‘std::make_tuple(_Elements&& ...) [with _Elements = {std::__cxx11::basic_string, std::allocator >&, support3d::VarStorage&, support3d::VarType&, int&}](info->support3d::PrimVarInfo::storage, info->support3d::PrimVarInfo::type, info->support3d::PrimVarInfo::multiplicity)’ from ‘std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>’ to ‘boost::python::api::object’
166 | return make_tuple(name, info->storage, info->type, info->multiplicity);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| std::tuple, std::allocator >, support3d::VarStorage, support3d::VarType, int>
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

2.Build error;
[solved]
py_geoms1.cpp,line:145 and line:166 boost::python::make_tuple

replaced make_tuple with boost::python::make_tuple.

---------------------------------------------------------------------------

■Install cgkit.
sudo python setup.py install --record files.txt

if you uninstall cgkit...
cat files.txt | sudo xargs rm -rf

mak@mx:~/Downloads/cgkit-code/utilities
$ python checkenv.py
-------------------------------------------------do ---------------------
Python 2.7.18 (default, Jul 14 2021, 08:11:37)
[GCC 10.2.1 20210110]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 2.0.3 (SDL 2.0.16, Python 2.7.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. 2.0.0 (Aug 12 2023)
cgkit (C++ lib)............... OK
cgkit (all)................... OK


$ viewer.py -N softimage demo1.py

$ viewer.py -N softimage demo4.py
pygame 2.0.3 (SDL 2.0.16, Python 2.7.18)
Hello from the pygame community. https://www.pygame.org/contribute.html
Texname: 1
Loading "maps/uvmap.png"...

texturing is ok.
It is light and fun.

but pyode1.2.1 is old?
$ viewer.py -N softimage piddemo1.py
The ball moves freely.

Thank you for your support.
  • -
  • -

<< 7/7