osg模型部分节点旋转
osg::ref_ptr<osg::Geode> CreateBox()
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
osg::ref_ptr<osg::TessellationHints> hints = new osg::TessellationHints;
hints->setDetailRatio(0.5); osg::ref_ptr<osg::Material> material = new osg::Material;
material->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
material->setShininess(osg::Material::FRONT_AND_BACK, ); osg::ref_ptr<osg::Texture2D> texture2D = new osg::Texture2D;
//设置纹理
osg::ref_ptr<osg::Image> image = osgDB::readImageFile("D:\\image_1\\arm1.jpg");
if (image.valid())
{
texture2D->setImage(image.get());
} osg::ref_ptr<osg::ShapeDrawable> shape = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0, 0.0, 0.0), 1.0, 1.0, 1.0), hints.get());
shape->setColor(osg::Vec4(100.0f, 255.0f, 0.0f, 0.6)); geode->getOrCreateStateSet()->setAttributeAndModes(material.get(), osg::StateAttribute::ON);
geode->getOrCreateStateSet()->setTextureAttributeAndModes(, texture2D, osg::StateAttribute::ON);
geode->addDrawable(shape.get()); return geode;
}
osg::ref_ptr<osg::Geode> CreateSphere()
{
osg::ref_ptr<osg::Group> _root = new osg::Group; //创建一个叶结点对象
osg::ref_ptr<osg::Geode> geode = new osg::Geode; //设置半径和高度
float _radius = 0.6f;
float _height = 1.0f; //创建精细度对象,精细度越高,细分就越多
osg::ref_ptr<osg::TessellationHints> hints = new osg::TessellationHints;
hints->setDetailRatio(0.9f); //添加一个球体,第一个参数是预定义的几何体对象,第二个是精细度默认为1
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), _radius), hints)); //_root->addChild(geode); return geode.get();
}



osg模型部分节点旋转的更多相关文章
- osg中使用MatrixTransform来实现模型的平移/旋转/缩放
osg中使用MatrixTransform来实现模型的平移/旋转/缩放 转自:http://www.cnblogs.com/kekec/archive/2011/08/15/2139893.html# ...
- OSG模型简单控制
OSG模型简单控制 转自:http://milkcu.sintune.net/blog/archives/1392673560.html 结点基本操作 添加结点 OSG中使用osg::Node和osg ...
- OSG 实现跟随节点的相机(转)
本章教程将继续使用回调和节点路径(NodePath)来检索节点的世界坐标. 本章目标: 在一个典型的仿真过程中,用户可能需要从场景中的各种车辆和人物里选择一个进行跟随.本章将介绍一种将摄像机“依附 ...
- [原]osg模型动画|骨骼动画
参考源码:osg的官方例子:osganimationviewer 首先制作一个带骨骼动画的模型 demo.FBX 这里面我们做了两个骨骼动画:1.open 2.close 下面开始在osg中使用 ...
- [原][osg][osgEarth]osg::Matrix 父子节点的变化关系
//osg::Matrix offsetmatrix 计算出子节点在父节点下的绝对坐标 //osg::Matrix offposition 用来计算当前节点相对父节点的位置 osg::Matrix o ...
- MFC加载大型osg模型
MFC加载模型,发现打开 Navid 缓冲等选项后,加载大型模型的速度就快了很多. #include "stdafx.h" #include "OSGObject.h&q ...
- Unity3d物体模型(实现旋转缩放平移自动旋转)
基本功能实现:物体通过鼠标左键上下移动,中间键缩放.右键旋转,30秒没操作,物体自动旋转 实例代码: using UnityEngine; using System.Collections; publ ...
- MFC加载osg模型
创建MFC单文档项目, OSGObject.h #pragma once #include <osgViewer\Viewer> #include <osgDB\ReadFile&g ...
- OSG 遍历fbx节点
count:560 construction_worker 4294967295 osg::MatrixTransform1 Bip001 L Finger02 4294967295 osg::Mat ...
随机推荐
- golang 时间的比较,time.Time的初始值?
参考: https://golangcode.com/checking-if-date-has-been-set/ https://stackoverflow.com/questions/209243 ...
- require sqlite3时报The specified module could not be found.错误
http://dependencywalker.com/ 在这个站点下载对应平台的Dependency Walker,打开你自己编译好的.node文件(sqlite3\lib\binding\node ...
- 2019 杭电多校第八场 HDU - 6665 Calabash and Landlord 两矩形分平面
题意 给出两个矩形,问这两个矩形把平面分成了几部分. 分析 不需要什么高级技能,只需 “简单” 的分类讨论. (实在太难写了,对拍找出错误都不想改 推荐博客,其中有个很好的思路,即只讨论答案为2,3, ...
- Miniprofiler 监控ef执行详解
首先NuGet添加 相对应ef版本的Miniprofiler.ef引用 web.config文件中添加 <system.webServer> <handlers> <a ...
- 后端token认证模板
1.创建一个视图 from rest_framework import exceptions from app01 import models from rest_framework.authenti ...
- 题解 [51nod1358] 浮波那契
题解 [51nod1358] 浮波那契 题面 解析 首先根据经验应该能一眼矩阵快速幂加速.... 因为给了你递推式,并且\(O(n)\)求显然不可能. 所以考虑怎么构造矩阵. 首先要处理的是小数的问题 ...
- Codeforces Round #603 (Div. 2) A,B,C,D【E题待补】
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int _; cin&g ...
- 8.1.T1
string 题面什么的 抱歉,被我咕咕咕了 考场思路: sort大法好 n2log2n过 40% 令人着实兴奋 正解: 线段树+桶 利用只有26个字母的优势 好吧,26个字母,只怪我没想到 代码: ...
- 6、transformation和action1
一.transformation和action入门 1.介绍 Spark支持两种RDD操作:transformation和action.transformation操作会针对已有的RDD创建一个新的R ...
- bootstrap中tab切换的使用
文档地址:https://v3.bootcss.com/javascript/#tabs 简单实例: <!DOCTYPE html> <html lang="en" ...