第二章 Cameras, Lights, and Shadows

本文介绍了使用Ogre游戏引擎创建场景的过程,并详细探讨了三种不同的阴影效果:ModulativeTextureShadows、ModulativeStencilShadows 和 AdditiveStencilShadows 的实现方式及特性。

由于第二章写出的时候还没有把wizzard搞出来,所以这个项目是手动生成,估计后面我都会用WIZZARD来生成

#include "BaseTutorial2.h"
BasicTutorial2::BasicTutorial2(void)
{

}
BasicTutorial2::~BasicTutorial2(void)
{
	
}
void BasicTutorial2::createCamera(void)
{
	mCamera=mSceneMgr->createCamera("PlayerCam");//you can use getCamera retrieves a pointer to the named camera.
	mCamera->setPosition(Ogre::Vector3(0,10,500));
	mCamera->lookAt(Ogre::Vector3(0,0,0));
	mCamera->setNearClipDistance(5);
	//though you should not use a far clip distance with Stencil Shadows
	mCameraMan=new OgreBites::SdkCameraMan(mCamera);
	//The Ogre Wiki Tutorial Framework uses OgreBites for GUI widgets and camera handling. 
	//It uses it because OgreBites - the Ogre sample framework - is included in every Ogre SDK, and because it simplifies things a lot.
	
}
void BasicTutorial2::createViewports(void)
{
	Ogre::Viewport* vp=mWindow->addViewport(mCamera);
	vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
	mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth())/Ogre::Real(vp->getActualHeight()));

}
void BasicTutorial2::createScene(void)
{
	mSceneMgr->setAmbientLight(Ogre::ColourValue(0,0,0));
	mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
	//Ogre currently supports three types of Shadows:
	//1.Modulative Texture Shadows (Ogre::SHADOWTYPE_TEXTURE_MODULATIVE) - The least computationally expensive of 
	//the three. This creates a black and white render-to-texture of shadow casters, which is then applied to the scene.
	//2.Modulative Stencil Shadows (Ogre::SHADOWTYPE_STENCIL_MODULATIVE) - This technique renders all shadow volumes as
	//a modulation after all non-transparent objects have been rendered to the scene. This is not as intensive as 
	//Additive Stencil Shadows, but it is also not as accurate.
	//3.Additive Stencil Shadows (Ogre::SHADOWTYPE_STENCIL_ADDITIVE) - This technique renders each light as a separate 
	//additive pass on the scene. This is very hard on the graphics card because each additional light requires an 
	//additional pass at rendering the scene.
	//Ogre does not support soft shadows as part of the engine. If you want soft shadows you will need to write your own vertex and fragment programs. 
	Ogre::Entity* entNinja=mSceneMgr->createEntity("Ninja","ninja.mesh");
	entNinja->setCastShadows(true);
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y,0);
	Ogre::MeshManager::getSingleton().createPlane("ground",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,plane,\
		1500,1500,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
	Ogre::Entity* entGround = mSceneMgr->createEntity("GroundEntity","ground");
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
	entGround->setMaterialName("Examples/Rockwall");
	entGround->setCastShadows(false);

	//Now that we have a Ninja and ground in the scene, let's compile and run the program. 
	//We see... nothing! What's going on? In the previous tutorial we added entities and they displayed fine. 
	//The reason the Ninja doesn't show up is that the scene's ambient light has been set to total darkness. 
	//So let's add a light to see what is going on.
	Ogre::Light* pointLight = mSceneMgr->createLight("pointLight");
	pointLight->setType(Ogre::Light::LT_POINT);
	pointLight->setPosition(Ogre::Vector3(0,150,250));
	pointLight->setDiffuseColour(1.0f,0.0f,0.0f);
	pointLight->setSpecularColour(1.0f,0.0f,0.0f);
	Ogre::Light* directionalLight=mSceneMgr->createLight("directionalLight");
	directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
	directionalLight->setDiffuseColour(Ogre::ColourValue(.25f,.25f,0));
	directionalLight->setSpecularColour(Ogre::ColourValue(.25f,.25f,0));
	directionalLight->setDirection(Ogre::Vector3( 0,-1,1));
	Ogre::Light* spotLight=mSceneMgr->createLight("spotLight");
	spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
	spotLight->setDiffuseColour(0,0,1.0f);
	spotLight->setSpecularColour(0,0,1.0f);
	spotLight->setDirection(-1,-1,0);
	spotLight->setPosition(Ogre::Vector3(300,300,0));
	spotLight->setSpotlightRange(Ogre::Degree(35),Ogre::Degree(35));
}

//2 end



#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
    int main(int argc, char *argv[])
#endif
    {
        // Create application object
        BasicTutorial2 app;

        try {
            app.go();
        } catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
            std::cerr << "An exception has occured: " <<
                e.getFullDescription().c_str() << std::endl;
#endif
        }

        return 0;
    }

#ifdef __cplusplus
}
#endif


三种不同的阴影效果:



随着人类对生命健康需求的不断增长,新药研发面临着前所未有的挑战。传统的药物研发流程通常耗时长达十年以上,耗资数十亿美元,且最终成功率极低,这在制药界被称为“反摩尔定律”困境。近年来,人工智能技术的飞速发展,特别是深度学习和大数据分析的广泛应用,为新药发现带来了革命性的契机。人工智能能够从海量的化学和生物数据中挖掘潜在规律,显著加速药物靶点发现、先导化合物优化等关键环节。在此背景下,本研究旨在设计并实现一个基于人工智能的新药发现辅助系统,以期为传统药物研发流程提供高效的智能化辅助工具,从而有效缩短研发周期并大幅降低研发成本。本研究以Python作为主要开发语言,深度结合PyTorch和TensorFlow两大主流深度学习框架,并集成RDKit化学信息学工具包,构建了一个功能完善的新药发现辅助系统。系统的核心目标是利用先进的人工智能技术辅助新药分子的设计与活性评估。在研究方法上,本文创新性地提出了一种融合多模态数据的新药发现算法。该算法综合处理分子的多种表示形式,包括一维的SMILES序列、二维的分子图结构以及三维的空间构象数据。通过构建多通道神经网络,系统能够有效提取并融合不同模态的特征,从而全面捕捉分子的理化性质与生物学活性之间的复杂非线性关系。 【课程报告内容】 摘要 第1章 绪论 第2章 相关技术与理论 第3章 系统需求分析 第4章 系统总体设计 第5章 系统详细设计与实现 第6章 系统测试与分析 第7章 总结与展望 参考文献 附件-实现指南
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值