Remove hopelessly outdated nifogre tests
parent
d0500e8124
commit
264736c139
@ -1,5 +0,0 @@
|
||||
*.png
|
||||
meshlist.txt
|
||||
ogre.cfg
|
||||
*_test
|
||||
chris*
|
@ -1,19 +0,0 @@
|
||||
GCC=g++
|
||||
|
||||
all: ogre_manualresource_test ogre_nif_test ogre_skeleton_test
|
||||
|
||||
I_OGRE=$(shell pkg-config --cflags OGRE)
|
||||
L_OGRE=$(shell pkg-config --libs OGRE)
|
||||
|
||||
ogre_manualresource_test: ogre_manualresource_test.cpp
|
||||
$(GCC) $^ -o $@ $(I_OGRE) $(L_OGRE)
|
||||
|
||||
ogre_skeleton_test: ogre_skeleton_test.cpp
|
||||
$(GCC) $^ -o $@ $(I_OGRE) $(L_OGRE)
|
||||
|
||||
ogre_nif_test: ogre_nif_test.cpp ../../nif/nif_file.cpp ../../bsa/bsa_file.cpp ../../bsa/bsa_archive.cpp ../../tools/stringops.cpp ../../mangle/vfs/servers/ogre_vfs.cpp ../ogre_nif_loader.cpp
|
||||
$(GCC) $^ -o $@ $(I_OGRE) $(L_OGRE)
|
||||
|
||||
clean:
|
||||
rm *_test
|
||||
|
@ -1,97 +0,0 @@
|
||||
#include <Ogre.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace Ogre;
|
||||
|
||||
Root *root;
|
||||
RenderWindow *window;
|
||||
SceneManager *mgr;
|
||||
|
||||
int shot = 0;
|
||||
|
||||
// Lets you quit by closing the window
|
||||
struct QuitListener : FrameListener
|
||||
{
|
||||
bool frameStarted(const FrameEvent& evt)
|
||||
{
|
||||
#ifdef SCREENSHOT
|
||||
if(shot == 1) window->writeContentsToFile("nif.png");
|
||||
if(shot < 2) shot++;
|
||||
#endif
|
||||
|
||||
if(window->isClosed())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
} qlistener;
|
||||
|
||||
// This has to be packaged in a struct because C++ sucks
|
||||
struct C
|
||||
{
|
||||
static void doTest();
|
||||
};
|
||||
|
||||
int main(int argc, char**args)
|
||||
{
|
||||
// Disable Ogre logging
|
||||
new LogManager;
|
||||
Log *log = LogManager::getSingleton().createLog("");
|
||||
log->setDebugOutputEnabled(false);
|
||||
|
||||
// Set up Root.
|
||||
root = new Root("plugins.cfg","ogre.cfg","");
|
||||
|
||||
if(!root->restoreConfig())
|
||||
{
|
||||
cout << "WARNING: we do NOT recommend fullscreen mode!\n";
|
||||
if(!root->showConfigDialog())
|
||||
return 1;
|
||||
}
|
||||
|
||||
mgr = root->createSceneManager(ST_GENERIC);
|
||||
|
||||
// Only render if there are arguments on the command line (we don't
|
||||
// care what they are.)
|
||||
bool render = (argc>=2);
|
||||
|
||||
// Create a window
|
||||
window = root->initialise(true, "Test");
|
||||
if(render)
|
||||
{
|
||||
// More initialization
|
||||
Camera *cam = mgr->createCamera("cam");
|
||||
Viewport *vp = window->addViewport(cam);
|
||||
cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
|
||||
cam->setFOVy(Degree(55));
|
||||
cam->setPosition(0,0,0);
|
||||
cam->lookAt(0,0,10);
|
||||
cam->setNearClipDistance(1);
|
||||
|
||||
root->addFrameListener(&qlistener);
|
||||
|
||||
// Background color
|
||||
vp->setBackgroundColour(ColourValue(0.5,0.5,0.5));
|
||||
|
||||
mgr->setAmbientLight(ColourValue(1,1,1));
|
||||
}
|
||||
|
||||
// Run the actual test
|
||||
C::doTest();
|
||||
|
||||
// Render loop
|
||||
if(render)
|
||||
{
|
||||
cout << "Rendering. Close the window to exit.\n";
|
||||
root->startRendering();
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
delete root;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void doTest()
|
||||
{
|
||||
cout << "hello\n";
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
This is a test of the manual resource loader interface to Ogre,
|
||||
applied to manually created meshes. It defines a simple mesh
|
||||
consisting of two triangles, and creates three instances of it as
|
||||
different meshes using the same loader. It is a precursor to the NIF
|
||||
loading code. If the Ogre interface changes and you have to change
|
||||
this test, then you will also have to change parts of the NIF
|
||||
loader.
|
||||
*/
|
||||
|
||||
#include "ogre_mesh_common.cpp"
|
||||
|
||||
void C::doTest()
|
||||
{
|
||||
// Create a couple of manual meshes
|
||||
makeMesh("mesh1.mm");
|
||||
makeMesh("mesh2.mm");
|
||||
makeMesh("mesh3.mm");
|
||||
|
||||
// Display the meshes
|
||||
{
|
||||
SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node");
|
||||
Entity *ent = mgr->createEntity("Mesh1", "mesh1.mm");
|
||||
node->attachObject(ent);
|
||||
node->setPosition(3,1,8);
|
||||
}
|
||||
|
||||
{
|
||||
SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node2");
|
||||
Entity *ent = mgr->createEntity("Mesh2", "mesh2.mm");
|
||||
node->attachObject(ent);
|
||||
node->setPosition(-3,1,8);
|
||||
}
|
||||
{
|
||||
SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node3");
|
||||
Entity *ent = mgr->createEntity("Mesh3", "mesh3.mm");
|
||||
node->attachObject(ent);
|
||||
node->setPosition(0,-2,8);
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
#include "ogre_common.cpp"
|
||||
|
||||
struct MyMeshLoader : ManualResourceLoader
|
||||
{
|
||||
void loadResource(Resource *resource)
|
||||
{
|
||||
Mesh *mesh = dynamic_cast<Mesh*>(resource);
|
||||
assert(mesh);
|
||||
|
||||
const String& name = mesh->getName();
|
||||
cout << "Manually loading mesh " << name << endl;
|
||||
|
||||
// Create the mesh here
|
||||
int numVerts = 4;
|
||||
int numFaces = 2*3;
|
||||
const float vertices[] =
|
||||
{ -1,-1,0, 1,-1,0,
|
||||
1,1,0, -1,1,0 };
|
||||
|
||||
const short faces[] =
|
||||
{ 0,2,1, 0,3,2 };
|
||||
|
||||
mesh->sharedVertexData = new VertexData();
|
||||
mesh->sharedVertexData->vertexCount = numVerts;
|
||||
|
||||
VertexDeclaration* decl = mesh->sharedVertexData->vertexDeclaration;
|
||||
|
||||
decl->addElement(0, 0, VET_FLOAT3, VES_POSITION);
|
||||
|
||||
HardwareVertexBufferSharedPtr vbuf =
|
||||
HardwareBufferManager::getSingleton().createVertexBuffer(
|
||||
VertexElement::getTypeSize(VET_FLOAT3),
|
||||
numVerts, HardwareBuffer::HBU_STATIC_WRITE_ONLY);
|
||||
|
||||
// Upload the vertex data to the card
|
||||
vbuf->writeData(0, vbuf->getSizeInBytes(), vertices, true);
|
||||
|
||||
// Set vertex buffer binding so buffer 0 is bound to our vertex buffer
|
||||
VertexBufferBinding* bind = mesh->sharedVertexData->vertexBufferBinding;
|
||||
bind->setBinding(0, vbuf);
|
||||
|
||||
/// Allocate index buffer of the requested number of faces
|
||||
HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton().
|
||||
createIndexBuffer(HardwareIndexBuffer::IT_16BIT,
|
||||
numFaces,
|
||||
HardwareBuffer::HBU_STATIC_WRITE_ONLY);
|
||||
|
||||
/// Upload the index data to the card
|
||||
ibuf->writeData(0, ibuf->getSizeInBytes(), faces, true);
|
||||
|
||||
SubMesh* sub = mesh->createSubMesh(name+"tris");
|
||||
sub->useSharedVertices = true;
|
||||
|
||||
/// Set parameters of the submesh
|
||||
sub->indexData->indexBuffer = ibuf;
|
||||
sub->indexData->indexCount = numFaces;
|
||||
sub->indexData->indexStart = 0;
|
||||
|
||||
mesh->_setBounds(AxisAlignedBox(-1.1,-1.1,-1.1,1.1,1.1,1.1));
|
||||
mesh->_setBoundingSphereRadius(2);
|
||||
}
|
||||
};
|
||||
|
||||
MyMeshLoader mml;
|
||||
|
||||
MeshPtr makeMesh(const string &name)
|
||||
{
|
||||
return MeshManager::getSingleton().createManual(name, "General", &mml);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#include "../ogre_nif_loader.hpp"
|
||||
#include "../../bsa/bsa_archive.hpp"
|
||||
|
||||
//#define SCREENSHOT
|
||||
|
||||
#include "ogre_common.cpp"
|
||||
|
||||
//const char* mesh = "meshes\\a\\towershield_steel.nif";
|
||||
//const char* mesh = "meshes\\r\\bonelord.nif";
|
||||
//const char* mesh = "meshes\\m\\text_scroll_open_01.nif";
|
||||
const char* mesh = "meshes\\f\\ex_ashl_a_banner_r.nif";
|
||||
|
||||
void C::doTest()
|
||||
{
|
||||
// Add Morrowind.bsa resource location
|
||||
Bsa::addBSA("../../data/Morrowind.bsa");
|
||||
|
||||
// Insert the mesh
|
||||
NifOgre::NIFLoader::load(mesh);
|
||||
NifOgre::NIFLoader::load(mesh);
|
||||
|
||||
/*
|
||||
SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node");
|
||||
Entity *ent = mgr->createEntity("Mesh1", mesh);
|
||||
node->attachObject(ent);
|
||||
|
||||
// Works great for the scroll
|
||||
node->setPosition(0,4,50);
|
||||
node->pitch(Degree(20));
|
||||
node->roll(Degree(10));
|
||||
node->yaw(Degree(-10));
|
||||
|
||||
/* Bone lord
|
||||
node->setPosition(0,-70,170);
|
||||
node->pitch(Degree(-90));
|
||||
*/
|
||||
|
||||
// Display it from two different angles - shield and banner
|
||||
const int sep = 45;
|
||||
SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node");
|
||||
Entity *ent = mgr->createEntity("Mesh1", mesh);
|
||||
node->attachObject(ent);
|
||||
node->setPosition(sep,0,130);
|
||||
node = node->createChildSceneNode("node2");
|
||||
ent = mgr->createEntity("Mesh2", mesh);
|
||||
node->attachObject(ent);
|
||||
node->setPosition(-2*sep,0,0);
|
||||
node->yaw(Degree(180));
|
||||
//*/
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#include "ogre_common.cpp"
|
||||
|
||||
void C::doTest()
|
||||
{
|
||||
SkeletonManager &skm = SkeletonManager::getSingleton();
|
||||
|
||||
SkeletonPtr skp = skm.create("MySkel", "General");
|
||||
|
||||
cout << "hello\n";
|
||||
/*
|
||||
MeshPtr msh = makeMesh("mesh1");
|
||||
|
||||
// Display the mesh
|
||||
{
|
||||
SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node");
|
||||
Entity *ent = mgr->createEntity("Mesh1", "mesh1");
|
||||
node->attachObject(ent);
|
||||
node->setPosition(0,0,4);
|
||||
}
|
||||
*/
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
Manually loading mesh mesh1.mm
|
||||
Manually loading mesh mesh2.mm
|
||||
Manually loading mesh mesh3.mm
|
@ -1 +0,0 @@
|
||||
hello
|
@ -1,12 +0,0 @@
|
||||
# Defines plugins to load
|
||||
|
||||
# Define plugin folder
|
||||
PluginFolder=/usr/local/lib/OGRE
|
||||
|
||||
# Define plugins
|
||||
Plugin=RenderSystem_GL
|
||||
Plugin=Plugin_ParticleFX
|
||||
Plugin=Plugin_OctreeSceneManager
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
make || exit
|
||||
|
||||
mkdir -p output
|
||||
|
||||
PROGS=*_test
|
||||
|
||||
for a in $PROGS; do
|
||||
if [ -f "output/$a.out" ]; then
|
||||
echo "Running $a:"
|
||||
./$a | diff output/$a.out -
|
||||
else
|
||||
echo "Creating $a.out"
|
||||
./$a > "output/$a.out"
|
||||
git add "output/$a.out"
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue