-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilities.cpp
executable file
·91 lines (83 loc) · 2.66 KB
/
utilities.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
#include <Ogre.h>
#include <string>
void printMatrix(Ogre::Matrix3 mat)
{
for (int i=0;i<3;i++)
{
for (int j=0;j<3;j++)
{
printf("%f\t", mat[i][j]);
}
printf("\n");
}
printf("------------------------------\n");
}
//static Ogre::Log& ogre_log = *(Ogre::LogManager::getSingleton().getDefaultLog());
//std::stringstream ss;
//ss<<displacement;
//ogre_log.logMessage(ss.str());
//std::string autogenerated_name = NameGenerator::Next(); // Generates (from the above code) 'AutoGeneratedName_x', where x is a number
//std::string new_entity_name = NameGenerator::Next("Entity"); // Generates 'Entity_x', where x is a number
//void MyHapticsListener::constructHapticTriangle(const Ogre::MeshPtr & pm)
//{
// Ogre::SubMesh* submesh;
//
// for(Ogre::ushort subMeshIndex = 0 ; subMeshIndex < pm->getNumSubMeshes() ; ++subMeshIndex)
// {
// submesh = pm->getSubMesh(subMeshIndex);
// Ogre::ManualObject* m_pManObj = new Ogre::ManualObject("M");
// m_pManObj->begin("nomaterial", RenderOperation::OT_TRIANGLE_LIST);
//
// for(int i = 0; i<submesh->indexData->indexCount; i++)
// {
//
// m_pManObj->position(vertices[indices[i]]);
// m_pManObj->position(vertices[indices[i+1]]);
// m_pManObj->position(vertices[indices[i+2]]);
// m_pManObj->index(i);
// m_pManObj->index(i+1);
// m_pManObj->index(i+2);
// i+=3;
// }
// m_pManObj->end();
// //mApp->manualNode->attachObject(m_pManObj);
// }
//
//}
//int main()
//{
//clock_t start,end;
//double timeelapsed;
//time_t t1,t2;
//
//// clock();
//start= clock();
//t1 = time(NULL);
//printf("%ld %ld\n",start,t1);
//sleep(20);
//end = clock();
//t2=time(NULL);
//printf("%ld %ld\n",end,t2);
//timeelapsed = ((double)(end-start))/CLK_TCK;///CLOCKS_PER_SEC;
//
//printf("%f",timeelapsed);
//}
//void MyApplication::renderingToOverlay()
//{
// Ogre::TexturePtr rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex",
// Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
// mWindow->getWidth(), mWindow->getHeight(), 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);
//
// Ogre::RenderTexture *renderTexture = rtt_texture->getBuffer()->getRenderTarget();
//
// renderTexture->addViewport(mCamera);
// renderTexture->getViewport(0)->setClearEveryFrame(true);
// renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
// renderTexture->getViewport(0)->setOverlaysEnabled(false);
// renderTexture->update();
// //renderTexture->writeContentsToFile("start.png");
//
// renderMaterial->getTechnique(0)->getPass(0)->createTextureUnitState("RttTex");
//
//}