[Scummvm-git-logs] scummvm master -> a37fdcf2f1d44ad3fb08798f2e84becec9e6e759

aquadran noreply at scummvm.org
Sun Jan 2 09:44:31 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a37fdcf2f1 TINYGL: Move gl_vertex_transform to GLContext


Commit: a37fdcf2f1d44ad3fb08798f2e84becec9e6e759
    https://github.com/scummvm/scummvm/commit/a37fdcf2f1d44ad3fb08798f2e84becec9e6e759
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-01-02T10:43:29+01:00

Commit Message:
TINYGL: Move gl_vertex_transform to GLContext

Changed paths:
    graphics/tinygl/vertex.cpp
    graphics/tinygl/zgl.h


diff --git a/graphics/tinygl/vertex.cpp b/graphics/tinygl/vertex.cpp
index 1fae66bfb1c..f7d32d294a4 100644
--- a/graphics/tinygl/vertex.cpp
+++ b/graphics/tinygl/vertex.cpp
@@ -154,33 +154,31 @@ void GLContext::glopBegin(GLParam *p) {
 
 // coords, tranformation, clip code and projection
 // TODO : handle all cases
-static inline void gl_vertex_transform(GLContext *c, GLVertex *v) {
+void GLContext::gl_vertex_transform(GLVertex *v) {
 	Matrix4 *m;
 
-	if (c->lighting_enabled) {
+	if (lighting_enabled) {
 		// eye coordinates needed for lighting
-
-		m = c->matrix_stack_ptr[0];
+		m = matrix_stack_ptr[0];
 		m->transform3x4(v->coord, v->ec);
 
 		// projection coordinates
-		m = c->matrix_stack_ptr[1];
+		m = matrix_stack_ptr[1];
 		m->transform(v->ec, v->pc);
 
-		m = &c->matrix_model_view_inv;
-
-		m->transform3x3(c->current_normal, v->normal);
+		m = &matrix_model_view_inv;
+		m->transform3x3(current_normal, v->normal);
 
-		if (c->normalize_enabled) {
+		if (normalize_enabled) {
 			v->normal.normalize();
 		}
 	} else {
 		// no eye coordinates needed, no normal
 		// NOTE: W = 1 is assumed
-		m = &c->matrix_model_projection;
-
+		m = &matrix_model_projection;
 		m->transform3x4(v->coord, v->pc);
-		if (c->matrix_model_projection_no_w_transform) {
+
+		if (matrix_model_projection_no_w_transform) {
 			v->pc.W = (m->_m[3][3]);
 		}
 		v->normal.X = v->normal.Y = v->normal.Z = 0;
@@ -222,7 +220,7 @@ void GLContext::glopVertex(GLParam *p) {
 	v->coord.Z = p[3].f;
 	v->coord.W = p[4].f;
 
-	gl_vertex_transform(this, v);
+	gl_vertex_transform(v);
 
 	// color
 
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 9a3b36bc626..4e16b3c8c34 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -118,7 +118,6 @@ struct GLMaterial {
 	int do_specular;
 };
 
-
 struct GLViewport {
 	int xmin, ymin, xsize, ysize;
 	Vector3 scale;
@@ -435,6 +434,8 @@ struct GLContext {
 	LinearAllocator _drawCallAllocator[2];
 	bool _debugRectsEnabled;
 
+	void gl_vertex_transform(GLVertex *v);
+
 public:
 	// The glob* functions exposed to public, however they are only for internal use.
 	// Calling them from outside of TinyGL is forbidden




More information about the Scummvm-git-logs mailing list