OSG加载地形

2023-12-14 05:22:20

这是网上下的一个代码;

先看一下代码;

KeyboardHandler.h;

#ifndef KEYBOARD_HANDLER_H
#define KEYBOARD_HANDLER_H
#include <iostream>
#include <osgGA/GUIEventHandler>

class keyboardEventHandler : public osgGA::GUIEventHandler
{
public:

	typedef void (*functionType) ();

   enum keyStatusType
   {
      KEY_UP, KEY_DOWN 
   };

   struct functionStatusType
   {
      functionStatusType() {keyState = KEY_UP; keyFunction = NULL;}
      functionType keyFunction;
      keyStatusType keyState;
   };

   bool addFunction(int whatKey, functionType newFunction);

   bool addFunction(int whatKey, keyStatusType keyPressStatus, functionType newFunction);

   virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);

   //virtual void accept(osgGA::GUIEventHandlerVisitor& v)   { v.visit(*this); };

protected:

	typedef std::map<int, functionStatusType > keyFunctionMap;
   keyFunctio

文章来源:https://blog.csdn.net/bcbobo21cn/article/details/134985110
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。