From e6acc4e7ed9b967a4dea02bcad72f38e2fb056c5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 26 Mar 2025 21:33:35 +0100 Subject: [PATCH] Delete TestCAO --- src/client/content_cao.cpp | 133 ------------------------------------- 1 file changed, 133 deletions(-) diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index df7404140..30429f80e 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -231,139 +231,6 @@ static scene::SMesh *generateNodeMesh(Client *client, MapNode n, return mesh.release(); } -/* - TestCAO -*/ - -class TestCAO : public ClientActiveObject -{ -public: - TestCAO(Client *client, ClientEnvironment *env); - virtual ~TestCAO() = default; - - ActiveObjectType getType() const - { - return ACTIVEOBJECT_TYPE_TEST; - } - - static std::unique_ptr create(Client *client, ClientEnvironment *env); - - void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr); - void removeFromScene(bool permanent); - void updateLight(u32 day_night_ratio); - void updateNodePos(); - - void step(float dtime, ClientEnvironment *env); - - void processMessage(const std::string &data); - - bool getCollisionBox(aabb3f *toset) const { return false; } -private: - scene::IMeshSceneNode *m_node; - v3f m_position; -}; - -// Prototype -static TestCAO proto_TestCAO(nullptr, nullptr); - -TestCAO::TestCAO(Client *client, ClientEnvironment *env): - ClientActiveObject(0, client, env), - m_node(NULL), - m_position(v3f(0,10*BS,0)) -{ - if (!client) - ClientActiveObject::registerType(getType(), create); -} - -std::unique_ptr TestCAO::create(Client *client, ClientEnvironment *env) -{ - return std::make_unique(client, env); -} - -void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) -{ - if(m_node != NULL) - return; - - //video::IVideoDriver* driver = smgr->getVideoDriver(); - - scene::SMesh *mesh = new scene::SMesh(); - scene::IMeshBuffer *buf = new scene::SMeshBuffer(); - video::SColor c(255,255,255,255); - video::S3DVertex vertices[4] = - { - video::S3DVertex(-BS/2,-BS/4,0, 0,0,0, c, 0,1), - video::S3DVertex(BS/2,-BS/4,0, 0,0,0, c, 1,1), - video::S3DVertex(BS/2,BS/4,0, 0,0,0, c, 1,0), - video::S3DVertex(-BS/2,BS/4,0, 0,0,0, c, 0,0), - }; - u16 indices[] = {0,1,2,2,3,0}; - buf->append(vertices, 4, indices, 6); - // Set material - buf->getMaterial().BackfaceCulling = false; - buf->getMaterial().TextureLayers[0].Texture = tsrc->getTextureForMesh("rat.png"); - buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST; - buf->getMaterial().TextureLayers[0].MagFilter = video::ETMAGF_NEAREST; - buf->getMaterial().FogEnable = true; - buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; - // Add to mesh - mesh->addMeshBuffer(buf); - buf->drop(); - m_node = smgr->addMeshSceneNode(mesh, NULL); - mesh->drop(); - updateNodePos(); -} - -void TestCAO::removeFromScene(bool permanent) -{ - if (!m_node) - return; - - m_node->remove(); - m_node = NULL; -} - -void TestCAO::updateLight(u32 day_night_ratio) -{ -} - -void TestCAO::updateNodePos() -{ - if (!m_node) - return; - - m_node->setPosition(m_position); - //m_node->setRotation(v3f(0, 45, 0)); -} - -void TestCAO::step(float dtime, ClientEnvironment *env) -{ - if(m_node) - { - v3f rot = m_node->getRotation(); - //infostream<<"dtime="<>cmd; - if(cmd == 0) - { - v3f newpos; - is>>newpos.X; - is>>newpos.Y; - is>>newpos.Z; - m_position = newpos; - updateNodePos(); - } -} - /* GenericCAO */