初始化及engine

来源:互联网 发布:餐饮业进销存软件 编辑:程序博客网 时间:2024/04/29 02:26

西昌.何雨锋 初始化及engine

1、跟62相同,65也必须联结库。即将link一栏中加入tv3d65.lib.
2、在62中,要包括tv3dcpp.h,因为里面有D3DVECTOR的定义,而65里面最好也包括,因为也用得上这个点的定义。
3、不同的是,65必须明确写出要包含的每个类,用哪个就得包含哪个。
#include "../cppdll/CTVEngine.h"
#include "../cppdll/CTVScene.h"
#include "../cppdll/CTVInputEngine.h"
#include "../cppdll/CTVLandscape.h"
#include "../cppdll/CTVTextureFactory.h"
#include "../cppdll/CTVAtmosphere.h"
#include "../cppdll/CTVGlobals.h"
#include "../cppdll/tv_types.h"
最后一行是对所有常量的包含,最重要的是,里面还包括了对CTv_Vector类的定义,就不用再包含那个tv3dcpp.h了.
4、在62中建立一个对象
      engine1 = CreateTVEngine();
    而在65中建立得用new:
     engine1=new CTVEngine();
   注意那个C,是65特有的标志。
5、在65中不再使用tvtrue与tvfalse,而使用true.
6、62中类本身实例化了就是指针对象了,而在65中实例化了不是指针对象:
    62:     ITVEngine engine1; 
                 engine1->SetDebugFile("debug.txt");
   65:     CTVEngine* engine1;
                 engine1->SetDebugFile("debug.txt");
   很明显,62中没有声明其是指针,但用法就是指针;而65中声明了是指针。
7、在62中必须要初始化com。
      CoInitialize(NULL);
      而65中没必要这样了。
7、关于65中engine的成员函数:
      engine1->Init3DWindowed(WindowHandle, true);     //几乎同于62
     engine1->GetViewport()->SetAutoResize(true);          //自动改变大小。
     engine1->DisplayFPS(true);                                            //FPS
     engine1->SetAngleSystem(cTV_ANGLE_DEGREE);     //同62的角度设置
其他:
    bool Init3DWindowed(HWND hWnd, bool bEnableTL = true);  
//初始化到hwnd窗口中。
 bool Init3DFullscreen(int iWidth, int iHeight, int iBPP = 32, bool bEnableTNL = true, bool bEnableVSync
= false, cCONST_TV_DEPTHBUFFERFORMAT eDepthBufferFormat = cTV_DEPTHBUFFER_BESTBUFFER, float fGamma = 1.0f, HWND iOptionalFormHandle = NULL);
//初始化全屏(宽,高,?,是否允许TNL,是否垂直同步,深度格式,标准的亮度,?)
 
 int RenderToScreen(void);
//渲染至屏幕,在render部分的最后一句的必须。
 int Clear(bool bOnlyZBuffer = false);
//清除屏幕,render部分的第一句的必须。
 int GetFPS(void);
//得到当前FPS值
 void AddToLog(const char* text);
//?
 // viewport management
 void SetViewport(CTVViewport* newViewport);
//设置视点?
 CTVViewport* GetViewport();
//得到视点?
 CTVViewport* CreateViewport(HWND newHwnd, const char* sViewportName);
//建立视点(窗口,视点名) 
 CTVCamera* GetCamera();
//得到摄象机
 void SetCamera(CTVCamera* newCamera);
//设置某摄象机为当前视图
 float TimeElapsed();
//时间流逝
 float AccurateTimeElapsed();
//?
 void SetSearchDirectory(const char* sSearchDirectory);
//搜索路径 
 // new
 int TickCount();
//时间
 void GetVideoMode(int* retWidth, int* retHeight, int* retBitDepth);
//?
 void SetAngleSystem(cCONST_TV_ANGLE eAngleSystem);
//角、幅度
 void DisplayFPS(bool bEnable, int iColor = 0);
//显示FPS
 void Screenshot(const char* sFilename, cCONST_TV_IMAGEFORMAT eImageFormat);
//快照(文件名,格式)
 bool SwitchFullscreen(int iWidth, int iHeight, int iBPP = -1, cCONST_TV_DEPTHBUFFERFORMAT eDepthBufferFormat = cTV_DEPTHBUFFER_BESTBUFFER, HWND hOptionalNewHandle = (HWND)-1);
//全屏开关(宽,高,深度格式,....)
 bool SwitchWindowed(HWND hOptionalNewHandle = NULL);
//窗口开关
 bool ResizeDevice();
 void SetDebugFile( const char* sDebugFile);
//设置调试文件
 void SetDebugMode(bool bEnable, bool bWriteToDebugConsole = false, bool bWriteToStdOut = false, bool bEnableMiniDump = false);
//设置调试模式(允许否,写到控制中,写到标准输出,训育bump)

 void SetFPUPrecision(bool bKeepDoublePrecision);
//设置物理卡?
 void ShowWinCursor(bool bShow);
//是否显示鼠标
 void SetVSync(bool bEnable);

 void SetAntialiasing(bool bEnable, cCONST_TV_MULTISAMPLE_TYPE eNumSamples);

 void SetWatermarkParameters(cCONST_TV_WATERMARKPLACE ePlace, float fAlpha = 0.8f);

 void ReleaseAll();
//清除所有?
 void AllowMultithreading(bool bAllow);

 void SetInitAdapter(int iAdapter);

 int RenderToOtherHWND(HWND hWnd);
//渲染到别的窗体上
 void EnableProfiler(bool bEnable, bool bSilentProfiler = false);

 void EnableSmoothTime(bool bEnable, int iFramesAverage = 10);

 void SetInternalShaderVersion(cCONST_TV_SHADERMODEL eShaderModel);

 void SetWindowTitle(const char* sWindowName);
//设置窗口标题
 cCONST_TV_SHADERMODEL GetInternalShaderVersion();

 bool Init3DNoRender(HWND hWnd);

 cCONST_TV_ANGLE GetAngleSystem();
//得到当前使用的是角度或幅度
 void SetEffectCompileMode(bool bForcePS20Compile);

 void ClearSearchDirectories();
//清除搜索路径
 void RemoveSearchDirectory(const char* sRemoveSearchDirectory);
//修改搜索路径
 void AddSearchDirectory(const char* sNewSearchDirectory);
//增加搜索路径
 void SetREFMode(bool bEnable);

 void SetLicenseFile(const char* sLicenseFile);

 void ClearDepthBuffer();
 char* GetShaderProfile();