Panda3d编译

本文档详细介绍了如何编译Panda3D,包括从获取依赖到执行编译步骤。在编译过程中,可能会遇到如'Error in ffmpegVirtualFile.cxx'和'size_t'语法错误的问题,通过将'int64_t'替换为'__int64',以及在openCVTexture.h中添加缺失的类型定义,可以成功解决这些问题。对于不需要Python支持的用户,可以使用 '--no-python' 参数进行编译。

在官网上,先有这么一段


Note that in the past, it was very difficult to build Panda3D. Things have improved. It is now fairly straightforward to download and compile panda. In particular, this is a sensible thing to do if you wish to add some functionality to panda.

To avoid possible consistency problems, the documentation for building the source is included with the source, not in the manual. Download a source package from the panda website, then look in the directory "doc," where you will find two files: INSTALL-MK and INSTALL-PP. These contain the instructions on the two different build-systems, "makepanda" and "ppremake".


While building you'll get a list of not found dependencies. Further descriptions of those can be found here: Dependencies.


这里面提供的信息是:

在源代码的根目录的doc下,有两个文件,分别是INSTALL-MK 和 INSTALL-PP。这两个文件提供了具体编译Panda3D的步骤。


特别要注意的是,在编译前,下面的链接是Panda3d的依赖表:

https://www.panda3d.org/manual/index.php/Dependencies


另外,官网上有一篇教程,说到编译这件事情:

https://www.panda3d.org/manual/index.php/Tutorial:_Compiling_the_Panda3D_Source_on_Windows


实际上,我的编译步骤(Python、VS2008、DX都装好):

1、CMD下进入源代码根目录

2、makepanda\makepanda.bata --everything


就可以看到编译了(有相关的进入可以看到)。

@ 第一次失败,出错信息:  Error in ffmpegVirtualFile.cxx near line 41, column 36 

修正方式:定位到ffmpegVirtualFile.cxx,替换所有的int64_t到__int64就可以。


然后整个就可以编译过了。


如果不需要python,那么可以用 --no-python参数。

@ 会失败,出错信息:[ 35%] Building C++ object built/tmp/vision_composite1.obj vision_composite1.cxx d:\panda3d-1.7.2_no_python\panda\src\vision\openCVTexture.h(89) : error C2061: syntax error : identifier 'ssize_t' 

修正方式:定位到openCVTexture.h,在#ifdef HAVE_OPENCV下面,加入

#ifndef HAVE_SSIZE_T 
#ifdef MS_WIN64 
typedef __int64 ssize_t; 
#else 
typedef _W64 int ssize_t; 
#endif 
#define HAVE_SSIZE_T 1 
#endif 

然后整个没有python的就编译成功了。



05-11
### Panda3D 游戏引擎简介 Panda3D 是一款功能强大的开源游戏引擎,广泛应用于教育、研究以及商业项目中。它支持多种编程语言接口,其中最常用的是 Python 和 C++ 接口[^1]。该引擎提供了丰富的工具集,用于创建 3D 图形应用程序和游戏。 #### 下载与安装 用户可以从官方站点下载最新版本的 Panda3D 引擎。官方网站地址为 https://www.panda3d.org/ 。在网站上提供有不同平台(Windows, macOS, Linux)下的二进制包以及源码编译选项[^2]。对于初学者来说,推荐直接使用预构建好的二进制文件以便快速启动开发环境。 #### 基本使用指南 为了更好地理解和运用 Panda3D ,以下是几个关键概念及其操作方法: - **场景图管理** Panda3D 的核心之一就是其高效的场景图管理系统 NodePath。开发者可以通过这个类轻松地加载模型、设置变换矩阵并控制对象可见性等属性[^3]。 ```python from direct.showbase.ShowBase import ShowBase class MyApp(ShowBase): def __init__(self): super().__init__() # 加载一个简单的立方体模型 self.cube = loader.loadModel("models/cube") self.cube.reparentTo(render) self.cube.setScale(0.5, 0.5, 0.5) app = MyApp() app.run() ``` - **事件处理机制** 游戏交互离不开良好的输入响应设计。Panda3D 提供了一套灵活易用的事件框架允许绑定键盘鼠标动作到特定函数调用之上[^4]。 - **物理模拟插件集成** 如果需要实现更真实的碰撞检测或者刚体动力学效果,则可通过 Bullet Physics Library 来增强原有功能[^5]。 #### 关于 libtag 库的应用价值 虽然原生 panda3d 并未内置名为 `libtag` 的组件,但从先前描述推测可能是第三方扩展或者是自定义模块,在实际项目里确实能够借助类似的辅助手段提升性能表现比如优化资源分配策略降低潜在风险从而提高稳定性[^6]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值