hi,
first i installed ubuntu, i though it could be a good idea to use a linux distribution for some programming.
then i was able to compile urho3D through glew-utils was needed. (i say it because it wasn’t in the tutorial on the wiki)
then i was able to compile an empty project.
then i made a little textured model with blender and i exported it using the urho3D export plugin in hope i checked the right options.
i tryed to load it but i don’t think i used the right method. i’m not familiar with urho3D so if you could tell what i’m missing or the right way to do it, that would be cool.
here is my code :
[code]
#include <Urho3D/Engine/Application.h>
#include <Urho3D/Engine/Engine.h>
#include <Urho3D/Input/InputEvents.h>
#include
#include
#include <Urho3D/Core/CoreEvents.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Resource/ResourceCache.h>
#include <Urho3D/Resource/XMLFile.h>
#include <Urho3D/IO/Log.h>
#include <Urho3D/UI/UI.h>
#include <Urho3D/UI/Text.h>
#include <Urho3D/UI/Font.h>
#include <Urho3D/UI/Button.h>
#include <Urho3D/UI/UIEvents.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Scene/SceneEvents.h>
#include <Urho3D/Graphics/Graphics.h>
#include <Urho3D/Graphics/Camera.h>
#include <Urho3D/Graphics/Geometry.h>
#include <Urho3D/Graphics/Renderer.h>
#include <Urho3D/Graphics/DebugRenderer.h>
#include <Urho3D/Graphics/Octree.h>
#include <Urho3D/Graphics/Light.h>
#include <Urho3D/Graphics/Model.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Material.h>
#include <Urho3D/Graphics/Skybox.h>
using namespace Urho3D;
class projet : public Application
{
public:
//can put definitions here ex: "int machin;"
SharedPtr<Scene> scene_;
SharedPtr<Node> boxNode_;
Node* cameraNode_;
projet(Context* context) : Application(context)
{
}
virtual void Setup()
{
// See http://urho3d.github.io/documentation/1.32/_main_loop.html
engineParameters_["FullScreen"]=false;
engineParameters_["WindowWidth"]=1280;
engineParameters_["WindowHeight"]=720;
engineParameters_["WindowResizable"]=true;
}
virtual void Start()
{
// We will be needing to load resources.
// All the resources used in this example comes with Urho3D.
// If the engine can't find them, check the ResourcePrefixPath. <-- http://urho3d.github.io/documentation/1.5/_running.html
ResourceCache* cache=GetSubsystem<ResourceCache>();
// Let's setup a scene to render.
scene_=new Scene(context_);
// Let the scene have an Octree component!
scene_->CreateComponent<Octree>();
// Let's add an additional scene component for fun.
scene_->CreateComponent<DebugRenderer>();
// octree ? debugrender ?
// Let's put a box in there.
boxNode_=scene_->CreateChild("Box"); //can i change it ?
boxNode_->SetPosition(Vector3(0,0,0));
StaticModel* boxObject=boxNode_->CreateComponent<StaticModel>();
boxObject->SetModel(cache->GetResource<Model>("Models/cor5x20x1/cor5x20x1.mdl"));
boxObject->SetMaterial(cache->GetResource<Material>("Models/cor5x20x1/cor_5x20x1.xml"));
// We need a camera from which the viewport can render.
cameraNode_=scene_->CreateChild("Camera");
Camera* camera=cameraNode_->CreateComponent<Camera>();
camera->SetFarClip(2000);
// Create two lights
{
Node* lightNode=scene_->CreateChild("Light");
lightNode->SetPosition(Vector3(-5,0,10));
Light* light=lightNode->CreateComponent<Light>();
light->SetLightType(LIGHT_POINT);
light->SetRange(50);
light->SetBrightness(1.2);
light->SetColor(Color(1,.5,.8,1));
light->SetCastShadows(true);
}
{
Node* lightNode=scene_->CreateChild("Light");
lightNode->SetPosition(Vector3(5,0,10));
Light* light=lightNode->CreateComponent<Light>();
light->SetLightType(LIGHT_POINT);
light->SetRange(50);
light->SetBrightness(1.2);
light->SetColor(Color(.5,.8,1,1));
light->SetCastShadows(true);
}
// add one to the camera node as well
{
Light* light=cameraNode_->CreateComponent<Light>();
light->SetLightType(LIGHT_POINT);
light->SetRange(10);
light->SetBrightness(2.0);
light->SetColor(Color(.8,1,.8,1.0));
}
// Now we setup the viewport. Ofcourse, you can have more than one!
Renderer* renderer=GetSubsystem();
SharedPtr viewport(new Viewport(context_,scene_,cameraNode_->GetComponent()));
renderer->SetViewport(0,viewport);
// events
//SubscribeToEvent(E_BEGINFRAME,URHO3D_HANDLER(MyApp,HandleBeginFrame));
//SubscribeToEvent(E_KEYDOWN,URHO3D_HANDLER(MyApp,HandleKeyDown));
//SubscribeToEvent(E_UIMOUSECLICK,URHO3D_HANDLER(MyApp,HandleControlClicked));
//SubscribeToEvent(E_UPDATE,URHO3D_HANDLER(MyApp,HandleUpdate));
//SubscribeToEvent(E_POSTUPDATE,URHO3D_HANDLER(MyApp,HandlePostUpdate));
//SubscribeToEvent(E_RENDERUPDATE,URHO3D_HANDLER(MyApp,HandleRenderUpdate));
//SubscribeToEvent(E_POSTRENDERUPDATE,URHO3D_HANDLER(MyApp,HandlePostRenderUpdate));
//SubscribeToEvent(E_ENDFRAME,URHO3D_HANDLER(MyApp,HandleEndFrame));
SubscribeToEvent(E_KEYDOWN, URHO3D_HANDLER(projet, HandleKeyDown));
}
virtual void Stop()
{
}
void HandleKeyDown(StringHash eventType, VariantMap& eventData)
{
using namespace KeyDown;
// Check for pressing ESC. Note the engine_ member variable for convenience access to the Engine object
int key = eventData[P_KEY].GetInt();
if (key == KEY_ESC)
engine_->Exit();
}
};
URHO3D_DEFINE_APPLICATION_MAIN(projet)[/code]
it compile fine but my application just show a black screen.
here is the log :
[Thu Feb 25 09:26:39 2016] INFO: Opened log file Urho3D.log
[Thu Feb 25 09:26:39 2016] INFO: Created 3 worker threads
[Thu Feb 25 09:26:39 2016] INFO: Added resource path /home/noname/Bureau/projet_build/bin/Data/
[Thu Feb 25 09:26:39 2016] INFO: Added resource path /home/noname/Bureau/projet_build/bin/CoreData/
[Thu Feb 25 09:26:39 2016] DEBUG: Skipped autoload path 'Autoload' as it does not exist, check the documentation on how to set the 'resource prefix path'
[Thu Feb 25 09:26:39 2016] INFO: Set screen mode 1280x720 windowed resizable
[Thu Feb 25 09:26:40 2016] INFO: Initialized input
[Thu Feb 25 09:26:40 2016] INFO: Initialized user interface
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Textures/Ramp.png
[Thu Feb 25 09:26:40 2016] DEBUG: Loading temporary resource Textures/Ramp.xml
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Textures/Spot.png
[Thu Feb 25 09:26:40 2016] DEBUG: Loading temporary resource Textures/Spot.xml
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Techniques/NoTexture.xml
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource RenderPaths/Forward.xml
[Thu Feb 25 09:26:40 2016] INFO: Initialized renderer
[Thu Feb 25 09:26:40 2016] INFO: Set audio mode 44100 Hz stereo interpolated
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource UI/MessageBox.xml
[Thu Feb 25 09:26:40 2016] DEBUG: Loading UI layout UI/MessageBox.xml
[Thu Feb 25 09:26:40 2016] INFO: Initialized engine
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Models/cor5x20x1/cor5x20x1.mdl
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Models/cor5x20x1/cor_5x20x1.xml
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Techniques/Diff.xml
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Models/cor5x20x1/cor5x20x1_texture.png
[Thu Feb 25 09:26:40 2016] DEBUG: Reloading shaders
[Thu Feb 25 09:26:40 2016] DEBUG: Loading resource Shaders/GLSL/LitSolid.glsl
[Thu Feb 25 09:26:40 2016] DEBUG: Compiled vertex shader LitSolid(PERPIXEL POINTLIGHT)
[Thu Feb 25 09:26:40 2016] DEBUG: Compiled pixel shader LitSolid(AMBIENT DIFFMAP PERPIXEL POINTLIGHT SPECULAR)
[Thu Feb 25 09:26:40 2016] DEBUG: Linked vertex shader LitSolid(PERPIXEL POINTLIGHT) and pixel shader LitSolid(AMBIENT DIFFMAP PERPIXEL POINTLIGHT SPECULAR)
[Thu Feb 25 09:26:40 2016] DEBUG: Compiled pixel shader LitSolid(DIFFMAP PERPIXEL POINTLIGHT SPECULAR)
[Thu Feb 25 09:26:40 2016] DEBUG: Linked vertex shader LitSolid(PERPIXEL POINTLIGHT) and pixel shader LitSolid(DIFFMAP PERPIXEL POINTLIGHT SPECULAR)
am i loading my model correctly in the main.cpp ?
maybe the camera don’t look in the right direction or the lights aren’t set properly or did i forgot something ? i can’t tell.
thx