惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
Scott Helme
Scott Helme
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 最新话题
S
Security @ Cisco Blogs
Webroot Blog
Webroot Blog
S
Security Affairs
H
Hacker News: Front Page
TaoSecurity Blog
TaoSecurity Blog
W
WeLiveSecurity
G
GRAHAM CLULEY
T
Tenable Blog
Schneier on Security
Schneier on Security
S
Securelist
Cyberwarzone
Cyberwarzone
P
Privacy International News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Schneier on Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
Recent Commits to openclaw:main
Recent Commits to openclaw:main
O
OpenAI News
N
News and Events Feed by Topic
AWS News Blog
AWS News Blog
C
Cisco Blogs
T
Threat Research - Cisco Blogs
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
D
DataBreaches.Net
博客园_首页
MyScale Blog
MyScale Blog
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
P
Proofpoint News Feed
J
Java Code Geeks
SecWiki News
SecWiki News
P
Palo Alto Networks Blog
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org

博客园 - 任程

运动捕捉数据的行为分割 主元分析(PCA)在计算机图形学中的应用 本博客代码公布(本文会不断更新) 机器人逆动力学(Robot Inverse Dynamics) 刚体动力学(Rigid Body Dynamics) Flock of Birds——总结使用过的虚拟现实设备之二(A Brief Summary of Several VR Devices) 多通道软件同步——代码设计 多通道的同步问题 《自己实现EarthSculptor的Splatting地形》的源代码 Interesting story about DI-Guy 利用billboard实现云的仿真 OST试验版 透视校正插值(Perspective-Correct Interpolation) Perlin噪声 虚拟现实现状——设备篇(译:State of VR-Devices) 多线程中Sleep函数的调用 用WiiRemote进行头部跟踪(Head Tracking for Desktop VR Displays using the WiiRemote) 分析碰撞检测库Opcode 用NVPerfHUD来分析3D程序
Ogre中在SceneNode节点旁显示二维字的代码
任程 · 2008-03-09 · via 博客园 - 任程

    注:本文发布日期为2008年(ogre1.4.x版本的时间),关于更新到2010年Ogre1.7.x版本与显示中文的方法,请参看本文评论中4、5、6楼给出的提示。

    在Ogre官方网站的wiki上有一个MovableText类:http://www.ogre3d.org/wiki/index.php/MovableText(新wiki的地址为:http://www.ogre3d.org/tikiwiki/MovableText

    它可以用来在SceneNode旁显示二维字,使用时只要构造一个MovableText对象,然后将其挂在SceneNode下就可以了。其实我们可以用它显示各种二维字,包括像Overlay一样的东西。在我们的工程中,我们用它来显示飞行模拟器各仪表上的二维文字。

   一、 这里给的是我对MovableText的一个改进版,主要增加两项功能:
    1.可以使文字反色(或者说是高亮)
                 
      通过给material增加一个pass,然后进行混合来实现:

   

    2.设置文字与SceneNode的相对位置。
       在写字时通过位置偏移计算三角形顶点坐标实现。

    二、这个类使用方法很简单:

1{
2m_Text = new MovableText("Title","OGRE" ,"BlueHighway"5, ColourValue::Green);
3m_Text->setRelativePos(-103);
4m_Text->setTextAlignment(MovableText::H_CENTER, MovableText::V_BELOW);
5m_MonsterSceneNode->attachObject(m_Text);
6}

    在需要高亮显示时调用:

m_Text->reverseColor();

 

    代码在 这里 下载