Dude im trying to compile this
Code: Select all
#include <iostream>
// Irrlicht and Cg Headers
#include "irrlicht.h"
#include <Cg/cg.h>
// IrrCg
#include "IrrCg.h"
// Irrlicht namespaces
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
// Chernobyl Game Engine namespaces
using namespace IrrCg;
// Other namespaces
using namespace std;
IrrlichtDevice* Device = 0;
IVideoDriver* Driver = 0;
ISceneManager* SceneManager = 0;
stringw window = "";
class NormalMapCallBack : public ICgShaderConstantSetCallBack
{
public:
CGparameter WorldViewProjection;
CGparameter EyePosition;
CGparameter LightPosition;
CGparameter LightDiffuse;
CGparameter DecalMap;
CGparameter NormalMap;
CGparameter SpecularMap;
virtual void OnSetConstants(ICgServices* services,CGprogram Vertex,CGprogram Pixel,SMaterial Material)
{
// Vertex Shader
EyePosition = cgGetNamedParameter(Vertex, "eyePosition");
vector3df CameraPosition = Device->getSceneManager()->getActiveCamera()->getAbsolutePosition();
services->setParameter3f(EyePosition, CameraPosition.X, CameraPosition.Y, CameraPosition.Z);
WorldViewProjection = cgGetNamedParameter(Vertex, "WorldViewProj");
core::matrix4 worldViewProj;
worldViewProj = Driver->getTransform(video::ETS_PROJECTION);
worldViewProj *= Driver->getTransform(video::ETS_VIEW);
worldViewProj *= Driver->getTransform(video::ETS_WORLD);
services->setMatrix(WorldViewProjection,MATRIX_IDENTITY,worldViewProj);
LightPosition = cgGetNamedParameter(Vertex, "lightPosition");
services->setParameter3f(LightPosition, 0.0f, 0.0f, 120.0f);
// Pixel Shader
DecalMap = cgGetNamedParameter(Pixel, "DecalMap");
services->EnableTexture( DecalMap,Material.getTexture(0));
NormalMap = cgGetNamedParameter(Pixel, "NormalMap");
services->EnableTexture( NormalMap,Material.getTexture(1));
SpecularMap = cgGetNamedParameter(Pixel, "SpecularMap");
services->EnableTexture( SpecularMap,Material.getTexture(2) );
LightDiffuse = cgGetNamedParameter(Pixel, "LightDiffuse");
services->setParameter3f(LightDiffuse, 1.0f, 1.0f, 1.0f);
}
};
int main()
{
printf("\n *** IrrCg Normal Mapping Example by Patryk Nadrowski ***\n\n");
char i;
// Select Irrlicht Driver
video::E_DRIVER_TYPE DriverType;
printf("\n Please select the driver you want for this demo:\n\n"\
" (a) Direct3D 9.0c\n (b) OpenGL 1.5\n"\
" (otherKey) exit\n\n");
std::cin >> i;
switch(i)
{
case 'a':
DriverType = EDT_DIRECT3D9;
window = " Direct3D9 PS: [ps_2_0] ";
break;
case 'b':
DriverType = EDT_OPENGL;
window = " OpenGL PS: [arbfp1] ";
break;
default: return 1;
}
Device = createDevice(DriverType,dimension2d<s32>(800 , 600),32,false,false,false,0);
Driver = Device->getVideoDriver();
SceneManager = Device->getSceneManager();
// Create Cg Programming Service
ICgProgrammingServices* GPU = new ICgProgrammingServices(Device);
// Create Cg Shader Material
NormalMapCallBack* NMCB = new NormalMapCallBack();
s32 CgNormalMapMaterialType = GPU->addCgShaderMaterialFromFiles(CG_SOURCE,"../../cg/NormalMapping.cg","main_v","arbvp1","vs_2_0","../../cg/NormalMapping.cg","main_f","arbfp1","ps_2_0",NMCB,EMT_SOLID);
// Create Node
IAnimatedMesh* mesh = SceneManager->getMesh("../../media/DOOM3/imp.ms3d");
((ISkinnedMesh*)mesh)->convertMeshToTangents();
IAnimatedMeshSceneNode* node = SceneManager->addAnimatedMeshSceneNode(mesh);
node->setPosition(core::vector3df(0,0,0));
node->setRotation(core::vector3df(0,0,0));
node->setScale(core::vector3df(1,1,1));
node->setAutomaticCulling(EAC_FRUSTUM_BOX);
node->setMaterialFlag(video::EMF_LIGHTING, false);
// Apply Cg Shader Material to Node
node->setMaterialType((video::E_MATERIAL_TYPE)CgNormalMapMaterialType);
node->getMaterial(0).TextureLayer[0].Texture = Driver->getTexture("../../media/DOOM3/imp_d.tga");
node->getMaterial(0).TextureLayer[1].Texture = Driver->getTexture("../../media/DOOM3/imp_local.tga");
node->getMaterial(0).TextureLayer[2].Texture = Driver->getTexture("../../media/DOOM3/imp_s.tga");
// Create Camera
scene::ICameraSceneNode* cam = SceneManager->addCameraSceneNodeFPS(0,100.0f,100.0f);
cam->setPosition(core::vector3df(120,0,0));
cam->setTarget(core::vector3df(0,0,0));
// Hide Mouse Cursor
Device->getCursorControl()->setVisible(false);
// Last FPS
int lastFPS = -1;
while(Device->run())
if (Device->isWindowActive())
{
// Begin Scene
Driver->beginScene(true, true, video::SColor(255,0,0,0));
// Draw All
SceneManager->drawAll();
// End Scene
Driver->endScene();
int fps = Driver->getFPS();
int poly = Driver->getPrimitiveCountDrawn();
if (lastFPS != fps)
{
core::stringw str = "";
str = L"Irrlicht Cg - NormalMapping with Specular for";
str += window;
str += L" FPS: ";
str += fps;
str += L" Poly: ";
str += poly;
Device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
delete GPU;
Device->drop();
return 0;
}
and i get this:
1>------ Operación Generar iniciada: proyecto: 3textmaps, configuración: Release Win32 ------
1>Vinculando...
1>main.obj : error LNK2001: símbolo externo "public: int __thiscall IrrCg::ICgProgrammingServices::addCgShaderMaterialFromFiles(enum CGenum,char const *,char const *,char const *,char const *,char const *,char const *,char const *,char const *,class IrrCg::ICgShaderConstantSetCallBack *,enum irr::video::E_MATERIAL_TYPE,char const * *)" (?addCgShaderMaterialFromFiles@ICgProgrammingServices@IrrCg@@QAEHW4CGenum@@PBD1111111PAVICgShaderConstantSetCallBack@2@W4E_MATERIAL_TYPE@video@irr@@PAPBD@Z) sin resolver
1>main.obj : error LNK2001: símbolo externo "public: __thiscall IrrCg::ICgProgrammingServices::~ICgProgrammingServices(void)" (??1ICgProgrammingServices@IrrCg@@QAE@XZ) sin resolver
1>main.obj : error LNK2001: símbolo externo "public: __thiscall IrrCg::ICgProgrammingServices::ICgProgrammingServices(class irr::IrrlichtDevice *)" (??0ICgProgrammingServices@IrrCg@@QAE@PAVIrrlichtDevice@irr@@@Z) sin resolver
1>main.obj : error LNK2001: símbolo externo "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@@Z) sin resolver
1>main.obj : error LNK2001: símbolo externo _cgGetNamedParameter sin resolver
1>J:\home\vladimir\NetBeansProjects\3textmaps\Release\3textmaps.exe : fatal error LNK1120: 5 externos sin resolver
1>El registro de compilación se guardó en el "file://j:\home\vladimir\NetBeansProjects\3textmaps\3textmaps\Release\BuildLog.htm"
1>3textmaps - 6 errores, 0 advertencias
========== Generar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========
Any hint?, im on xp32, vsc++9xpress but i would like to compile it on ubuntu x64, netbeans....