Skip to content

Commit 327bdc5

Browse files
committed
Add circular point effect
1 parent f48edd4 commit 327bdc5

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

render_pipeline/rpcore/render_pipeline.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ class RENDER_PIPELINE_DECL RenderPipeline: public RPObject
3838
template <class Type> Type get_setting(const std::string& setting_path, const Type& fallback) const;
3939

4040
public:
41-
static RenderPipeline* get_global_ptr(void);
41+
static RenderPipeline* get_global_ptr(void);
4242

43-
RenderPipeline(void);
44-
~RenderPipeline(void);
43+
RenderPipeline(void);
44+
~RenderPipeline(void);
4545

46-
/**
47-
* Loads the pipeline configuration from a given filename. Usually
48-
* this is the 'config/pipeline.ini' file. If you call this more than once,
49-
* only the settings of the last file will be used.
50-
*/
51-
void load_settings(const std::string& path);
46+
/**
47+
* Loads the pipeline configuration from a given filename. Usually
48+
* this is the 'config/pipeline.ini' file. If you call this more than once,
49+
* only the settings of the last file will be used.
50+
*/
51+
void load_settings(const std::string& path);
5252

5353
/**
5454
* Reloads all shaders. This will reload the shaders of all plugins,
@@ -95,7 +95,7 @@ class RENDER_PIPELINE_DECL RenderPipeline: public RPObject
9595

9696
/** See internal_set_effect. */
9797
void set_effect(NodePath& nodepath, const std::string& effect_src,
98-
const Effect::OptionType& options=Effect::OptionType(), int sort=30);
98+
const Effect::OptionType& options={}, int sort=30);
9999

100100
/**
101101
* Prepares a given scene, by converting panda lights to render pipeline
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Circular Point Effect
2+
3+
vertex:
4+
inout: |
5+
uniform mat4 p3d_ModelViewMatrix;
6+
uniform float point_radius;
7+
8+
post_transform: |
9+
gl_PointSize = point_radius / -(p3d_ModelViewMatrix * p3d_Vertex).z;
10+
11+
12+
fragment:

src/rpcore/util/primitives.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ namespace rpcore {
1212

1313
static NodePath create_geom_node(const std::string& name, Geom* geom)
1414
{
15-
// default material
16-
CPT(RenderState) state = RenderState::make_empty();
17-
state = state->add_attrib(MaterialAttrib::make(RPMaterial().get_material()));
18-
1915
PT(GeomNode) geom_node = new GeomNode(name);
20-
geom_node->add_geom(geom, state);
16+
geom_node->add_geom(geom);
17+
18+
// default material
19+
NodePath np(geom_node);
20+
np.set_material(RPMaterial().get_material());
2121

22-
return NodePath(geom_node);
22+
return np;
2323
}
2424

2525
NodePath create_points(const std::string& name, int count)

0 commit comments

Comments
 (0)