35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <osg/ref_ptr>
|
|
#include <osg/Group>
|
|
#include <osg/Geode>
|
|
#include <osg/Geometry>
|
|
#include <osg/Light>
|
|
#include <osg/LightSource>
|
|
|
|
/**
|
|
* SceneBuilder
|
|
* ------------
|
|
* Factory helpers for common scene-graph elements:
|
|
* - reference floor grid
|
|
* - ambient + directional lights
|
|
* - axes gizmo (X/Y/Z)
|
|
*/
|
|
class SceneBuilder {
|
|
public:
|
|
/// Create a flat grid centred at the origin.
|
|
/// @param halfSize half-extent of the grid in world units
|
|
/// @param divisions number of cells per side
|
|
static osg::ref_ptr<osg::Geode> createGrid(float halfSize = 10.f,
|
|
int divisions = 20);
|
|
|
|
/// Create a simple 3-axis gizmo (red=X, green=Y, blue=Z).
|
|
static osg::ref_ptr<osg::Geode> createAxes(float length = 1.f);
|
|
|
|
/// Build a LightSource node suitable for a warm key light.
|
|
static osg::ref_ptr<osg::LightSource> createSunLight(int lightNum = 0);
|
|
|
|
/// Build an ambient fill light.
|
|
static osg::ref_ptr<osg::LightSource> createAmbientLight(int lightNum = 1);
|
|
};
|