kbale / osgocean

An ocean rendering nodekit for OpenSceneGraph
GNU Lesser General Public License v3.0
108 stars 56 forks source link

Static library failed #58

Closed Daoudou closed 2 years ago

Daoudou commented 2 years ago

Hello :) I have a little problem, I tried to make a static library in VS2015 with osgOcean but I have this little problem list. "; expected in PositionAttitudeTransform, OceanScene,TextHUD.h", "function ShaderManager is not a type name" in ShaderManager

and others like that (sorry my list of error is in french langage T-T°

I added a path to each include and lib of osgoCean but nothing changes. It works with OSG though, I probably forgot something, but I don’t know what. Thanks in advance.

(they are compiled in 64-bit version)

Here’s my code (if it helps) Scene_Builder is my project

DeepScene.cpp:

` #include "..\include\DeepScene.h"

CDeepScene::CDeepScene()
  {
    }

   int CDeepScene::createOceanScene()
{
         float windx = 1.1f, windy = 1.1f;
         osg::Vec2f windDirection(windx, windy);
         osg::Vec3 initialCameraPosition(0, -40, -200);

         string terrain_shader_basename = "terrain";

osg::ref_ptr<Scene> scene = new Scene(windDirection, 12.f, 1000.f, 0.35f, 1e-8, true, 2.5, 2.2f, false, terrain_shader_basename);
  osg::ref_ptr<osg::Group> root;

            scene->getOceanScene()->setOceanSurfaceHeight(-190.0f);
           root->addChild(scene->getScene());

         osg::ref_ptr<osg::Geode> rootGeode = new osg::Geode();
          osg::ref_ptr<osg::ShapeDrawable> cylinder = new osg::ShapeDrawable();
             osg::ref_ptr<osg::ShapeDrawable> Box = new osg::ShapeDrawable();

           cylinder->setShape(new osg::Cylinder(osg::Vec3(0.0f, 0.0f, -200.0f), 2.0f, 15.0f));
          cylinder->setColor(osg::Vec4(0.0f, 1.0f, 1.0f, 0.0f));

           Box->setShape(new osg::Box(osg::Vec3(10.0f, 0.0f, -200.0f), 5.0f));
             Box->setColor(osg::Vec4(1.0f, 0.0f, 0.0f, 0.0f));
           rootGeode->addChild(cylinder);
             rootGeode->addChild(Box);

             scene->getOceanScene()->addChild(rootGeode);

           //------------------------------------------------------------------------
         // The view now
         //------------------------------------------------------------------------

         osg::ref_ptr<osgViewer::ViewerBase> viewer;
         osgViewer::View* view = 0;

          osgViewer::Viewer* singleViewer = new osgViewer::Viewer;
           viewer = singleViewer;
           view = singleViewer;
             view->setSceneData(root.get());
          view->setUpViewInWindow(150, 150, 1024, 768, 0);

             view->addEventHandler(new SceneEventHandler(scene,NULL, view, initialCameraPosition));
          view->addEventHandler(new osgViewer::HelpHandler);
         view->getCamera()->setName("MainCamera");
             viewer->realize();

          while (!viewer->done())
         {
              viewer->frame();
           }

        return 0;
 }

     CDeepScene::~CDeepScene()
         {
         }`

DeepScene h:

` #pragma once

   #include <iostream>
     #include <osgViewer\Viewer>
     #include <osgViewer/CompositeViewer>
     #include <osg\ShapeDrawable>
    #include <osg\Geometry>
    #include <osgViewer/CompositeViewer>
   #include <osgViewer/ViewerEventHandlers>
   #include <osgGA/StateSetManipulator>
    #include <osg/Notify>
    #include <osgDB/ReadFile>
   #include <osgShadow/ShadowedScene>
 #include <osgShadow/ViewDependentShadowMap>

    //The path of osgOcean
    #include "C:\osgocean-master\include\osgOcean\OceanScene"
   #include "C:\osgocean-master\include\osgOcean\ShaderManager"

     #include "SceneEventHandler.h"
     #include "Scene.h"
     #include "TextHUD.h"
     using namespace std;

   class CDeepScene
 {
     public:
       CDeepScene();
    //int createScene();
       int createOceanScene();
       ~CDeepScene();

  };

` [Uploading Capture.PNG…]()

Daoudou commented 2 years ago

https://drive.google.com/file/d/1vkjD8Mz_-BeQQUDItpjdZJARYqtScStn/view?usp=drivesdk