当前位置: 首页 > news >正文

wap建站模板seo主要做哪些工作

wap建站模板,seo主要做哪些工作,安阳区号是多少号码,新兴网站建设之前试了一下Bullet3物理引擎,但在linux上编译失败,于是放弃了。令我不满的还有另外一个原因,下载的发行包竟然有500M。C的Bullet3代码根本用不了,大部分教程实际都是用的老版本。而且此项目还整了python版本,各种蹭人…

        之前试了一下Bullet3物理引擎,但在linux上编译失败,于是放弃了。令我不满的还有另外一个原因,下载的发行包竟然有500M。C++的Bullet3代码根本用不了,大部分教程实际都是用的老版本。而且此项目还整了python版本,各种蹭人工智能的热度,感觉后面的维护者越来越不靠谱了。

        于是我准备换用ode引擎,下面对bullet3的简单使用记录一下。

一、配置

# bullet3
# 3实际上没有教程,似乎已经弃坑(这里使用2的版本)
# https://github.com/bulletphysics/bullet3/issues/4002
include_directories(${CMAKE_SOURCE_DIR}/third/bullet3/src)
target_link_libraries(${PROJECT_NAME} PRIVATE LinearMath)
target_link_libraries(${PROJECT_NAME} PRIVATE BulletCollision)
target_link_libraries(${PROJECT_NAME} PRIVATE BulletDynamics)

        在CMakePresets.json里需要加入以下变量到cacheVariables,关闭其他东西的构建:

"BUILD_EXTRAS": false,
"BUILD_UNIT_TESTS": false 

二、使用

/**
* @file		dl_physics.h
* @brief	3d物理,基于Bullet3
*
*
* @version	1.0
* @author	lveyou
* @date		22-10-28
*
* @note
*/
#pragma once#include <vector>#include <btBulletDynamicsCommon.h>#include "dl_type.h"
#include "math/dl_transform.h"
#include "dl_time.h"
#include "dl_rigid_body.h"//Extras / BulletMultiThreaded 拥有多线程版本 碰撞调度和 解算器namespace dl
{inline btVector3 toBtVector3(const Position3& v)
{return btVector3(v[0], v[1], v[2]);
}class RigidBodyImp
{
public:btRigidBody* _rigidBody;btMotionState* _motion;//运动状态,可选 动态物体才有size_t _idShape;//形状id
};class Physics
{
public:btDefaultCollisionConfiguration* _collConfig;//碰撞配置btCollisionDispatcher* _collDispatcher;//碰撞调度btBroadphaseInterface* _broadphase;//broad-phasebtSequentialImpulseConstraintSolver* _solver;//解算器btDiscreteDynamicsWorld* _world;//世界std::vector<btCollisionShape*> _allShape;//所有形状Physics(){_collConfig = new btDefaultCollisionConfiguration;_collDispatcher = new btCollisionDispatcher(_collConfig);_broadphase = new btDbvtBroadphase;_solver = new btSequentialImpulseConstraintSolver;_world = new btDiscreteDynamicsWorld(_collDispatcher, _broadphase, _solver, _collConfig);_world->setGravity(btVector3(0, 0, -Numbers::GRAVITY));btCollisionShape* shape = new btBoxShape(btVector3(1, 1, 1));_allShape.push_back(shape);}/*** @brief 创建刚体* @param[in] shape_id 形状id* @param[in] trans 变换* @param[in] mass 质量* @retval 失败返回nullptr*/RigidBody* CreateRigidBody(size_t shape_id, Transform* trans, Float mass){if (shape_id >= _allShape.size()){log_err0("shape id越界!");return nullptr;}RigidBody* ret = new RigidBody;RigidBodyImp* body = ret->GetImp();//形状body->_idShape = shape_id;btCollisionShape* shape = _allShape[shape_id];//运动状态btTransform bt_trans;bt_trans.setIdentity();Position3 pos = trans->GetTranslation();bt_trans.setOrigin(toBtVector3(pos));body->_motion = new btDefaultMotionState(bt_trans);//质量和惯性btScalar bt_mass{ mass };btVector3 local_inertia(0, 0, 0);if (bt_mass)shape->calculateLocalInertia(bt_mass, local_inertia);//创建刚体body->_rigidBody = new btRigidBody(bt_mass, body->_motion, shape);//加入世界_world->addRigidBody(body->_rigidBody);return ret;}//! 创建默认刚体RigidBody* CreateRigidBodyDefault(Transform* trans){return CreateRigidBody(0, trans, 1);}//! 创建形状 boxsize_t CreateShapeBox(const Position3& box){size_t id = _allShape.size();btCollisionShape* shape = new btBoxShape(toBtVector3(box));_allShape.push_back(shape);return id;}void Update(){_world->stepSimulation(g_time->GetDelta());//更新位置/*for (int j = _world->getNumCollisionObjects() - 1; j >= 0; j--){btCollisionObject* obj = _world->getCollisionObjectArray()[j];btRigidBody* body = btRigidBody::upcast(obj);btTransform trans;if (body && body->getMotionState()){body->getMotionState()->getWorldTransform(trans);}else{trans = obj->getWorldTransform();}trans.getOpenGLMatrix()printf("world pos object %d = %f,%f,%f\n", j, float(trans.getOrigin().getX()), float(trans.getOrigin().getY()), float(trans.getOrigin().getZ()));}*/}void UpdateRigidBody(RigidBodyImp* body, Transform* trans){btTransform bt_trans;btRigidBody* bt_body = body->_rigidBody;if (bt_body->getMotionState()){bt_body->getMotionState()->getWorldTransform(bt_trans);}else{bt_trans = bt_body->getWorldTransform();}const btVector3& pos = bt_trans.getOrigin();trans->SetTranslation({pos.getX(), pos.getY(), pos.getZ()});}~Physics(){//反向删除for (int i = _world->getNumCollisionObjects() - 1; i >= 0; --i){btCollisionObject* obj = _world->getCollisionObjectArray()[i];btRigidBody* body = btRigidBody::upcast(obj);if (body && body->getMotionState()){delete body->getMotionState();}_world->removeCollisionObject(obj);delete obj;}for (auto& iter : _allShape){delete iter;}delete _world;delete _solver;delete _broadphase;delete _collDispatcher;delete _collConfig;}
};extern Physics* g_physics;}

http://www.tj-hxxt.cn/news/81729.html

相关文章:

  • 西安php网站建设最有创意的广告语30条
  • 柳江企业网站建设价格做seo需要用到什么软件
  • 东莞网站建设网站排名优化网络营销策划书1500字
  • 江苏镇江丹阳疫情最新消息今天seo优化方案
  • wordpress制作友情链接页面长沙网站seo优化公司
  • 做网站和做小程序有什么不同百度河南代理商
  • 建设一个网站的硬件要求吗公司网站制作教程
  • 做一的同志小说网站网店代运营骗局
  • 开发制作一个网站seo诊断书案例
  • 主机屋如何做网站万网注册域名查询
  • 有哪些好的印花图案设计网站线上营销策划方案
  • 爱站云网站建设heikw厦门seo优化
  • 手机网站 建设建站模板网站
  • 有没有网站找人帮忙做图游戏推广员是诈骗吗
  • 网站备案地区武汉seo关键词排名优化
  • 无锡网站排名优化公司哪家好百度快速收录提交工具
  • 专门做招商的网站网站查询ip地址
  • 苏州关键词排名系统正规网站优化哪个公司好
  • 新手如何学做网站百度首页百度一下
  • 设计型网站案例百度推广代理商与总公司的区别
  • 网站下方链接图标怎么做免费网站友情链接
  • 成都金牛网站建设公司百度首页登录官网
  • 鄱阳做网站新型实体企业100强
  • 简述网站开发平台抖音账号权重查询
  • 做网站为什么图片上传不了免费制作永久个人网站
  • 甘肃网站建设哪家便宜百度首页纯净版怎么设置
  • 网站添加icp备案号百度推广用户注册
  • 做网站给不给源代码台湾新闻最新消息今天
  • 常州做网站价格企业推广方式
  • 爱做片视频网站培训机构排名全国十大教育机构排名