summaryrefslogtreecommitdiff
path: root/graphics.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-07-13 10:23:52 +0000
committerrodri <rgl@antares-labs.eu>2024-07-13 10:23:52 +0000
commit04d50b8bbe324fdb7a8a1e724fbc59c4050862f0 (patch)
tree285be4b648747346d96e5e0c87d0abec9f80d6a5 /graphics.h
parent45c21bb2483adf0ad1dd2f9950681f6a07a14b24 (diff)
downloadlibgraphics-04d50b8bbe324fdb7a8a1e724fbc59c4050862f0.tar.gz
libgraphics-04d50b8bbe324fdb7a8a1e724fbc59c4050862f0.tar.bz2
libgraphics-04d50b8bbe324fdb7a8a1e724fbc59c4050862f0.zip
fix the geometry glitches when moving things around.
it's possible for interactive programs to keep updating the geometry of the scene during rendering, which caused primitives to look deformed or shattered in the final image. to avoid this we take a snapshot of the current state of things (scene and camera), and render based on that copy.
Diffstat (limited to 'graphics.h')
-rw-r--r--graphics.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/graphics.h b/graphics.h
index fbeea2f..47a41cd 100644
--- a/graphics.h
+++ b/graphics.h
@@ -156,6 +156,7 @@ struct Model
struct Entity
{
RFrame3;
+ char *name;
Model *mdl;
Entity *prev, *next;
@@ -294,10 +295,10 @@ struct Camera
};
/* camera */
+void reloadcamera(Camera*);
void configcamera(Camera*, Viewport*, double, double, double, Projection);
void placecamera(Camera*, Point3, Point3, Point3);
void aimcamera(Camera*, Point3);
-void reloadcamera(Camera*);
void shootcamera(Camera*, Shadertab*);
/* viewport */
@@ -326,10 +327,13 @@ void orthographic(Matrix3, double, double, double, double, double, double);
/* scene */
int loadobjmodel(Model*, OBJ*);
Model *newmodel(void);
+Model *dupmodel(Model*);
void delmodel(Model*);
-Entity *newentity(Model*);
+Entity *newentity(char*, Model*);
+Entity *dupentity(Entity*);
void delentity(Entity*);
Scene *newscene(char*);
+Scene *dupscene(Scene*);
void delscene(Scene*);
void clearscene(Scene*);
@@ -339,6 +343,7 @@ Vertexattr *getvattr(Vertex*, char*);
/* texture */
Texture *alloctexture(int, Memimage*);
+Texture *duptexture(Texture*);
void freetexture(Texture*);
Color neartexsampler(Texture*, Point2);
Color bilitexsampler(Texture*, Point2);
@@ -353,6 +358,7 @@ double fmax(double, double);
Point2 modulapt2(Point2, Point2);
Point3 modulapt3(Point3, Point3);
Memimage *rgb(ulong);
+Memimage *dupmemimage(Memimage*);
/* color */
Color srgb2linear(Color);