public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Rich Mattes <richmattes@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/libQGLViewer] epel10: Do Vec::operator() overloading in a generic way
Date: Mon, 30 Nov 2026 13:55:08 GMT	[thread overview]
Message-ID: <179604690855.1.2922537365999670461.rpms-libQGLViewer-6724afb1b7d9@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/libQGLViewer
Branch : epel10
Commit : 6724afb1b7d9d8d55a35ec8b857283457dceeae3
Author : Rich Mattes <richmattes@gmail.com>
Date   : 2018-08-12T11:05:34-04:00
Stats  : +69/-18 in 1 file(s)
URL    : https://src.fedoraproject.org/rpms/libQGLViewer/c/6724afb1b7d9d8d55a35ec8b857283457dceeae3?branch=epel10

Log:
Do Vec::operator() overloading in a generic way

---
diff --git a/libQGLViewer-2.6.4-qreal.patch b/libQGLViewer-2.6.4-qreal.patch
index cdbc099..21d6e84 100644
--- a/libQGLViewer-2.6.4-qreal.patch
+++ b/libQGLViewer-2.6.4-qreal.patch
@@ -1,36 +1,87 @@
 diff -up ./QGLViewer/vec.h.qreal ./QGLViewer/vec.h
 --- ./QGLViewer/vec.h.qreal	2016-10-06 16:08:49.000000000 -0400
-+++ ./QGLViewer/vec.h	2018-08-12 10:23:01.494354925 -0400
++++ ./QGLViewer/vec.h	2018-08-12 11:05:00.541174453 -0400
 @@ -160,6 +160,7 @@ public:
  	const qreal* address() const { qWarning("Vec::address() is deprecated, use operator const qreal* instead."); return operator const qreal*(); }
  #endif
  
-+#ifndef __arm__
++
  	/*! Conversion operator returning the memory address of the vector.
  
    Very convenient to pass a Vec pointer as a parameter to \c GLdouble OpenGL functions:
-@@ -187,6 +188,7 @@ public:
+@@ -168,24 +169,36 @@ public:
+   glNormal3dv(normal);
+   glVertex3dv(pos);
+   \endcode */
+-	operator const qreal*() const {
++	operator const double*() const {
++        if (sizeof(x) == sizeof(double)) {
+ #ifdef QGLVIEWER_UNION_NOT_SUPPORTED
+-		return &x;
++		return (double*)&x;
+ #else
+-		return v_;
++		return (double*)v_;
  #endif
++        }
++        else if (sizeof(x) == sizeof(float)) {
++            static double* const result = new double[3];
++            result[0] = static_cast<double>(x);
++            result[1] = static_cast<double>(y);
++            result[2] = static_cast<double>(z);
++            return result;
++        }
++        else {
++            throw std::logic_error("sizeof(qreal) must be sizeof(float) or sizeof(double)");
++        }
  	}
  
-+// only enable on platforms where qreal is defined as double
+ 	/*! Non const conversion operator returning the memory address of the vector.
+ 
+   Useful to pass a Vec to a method that requires and fills a \c qreal*, as provided by certain libraries. */
+-	operator qreal*() {
+-#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
+-		return &x;
+-#else
+-		return v_;
+-#endif
+-	}
++//	operator qreal*() {
++//#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
++//		return &x;
++//#else
++//		return v_;
++//#endif
++//	}
+ 
  	/*! Conversion operator returning the memory address of the vector.
  
-   Very convenient to pass a Vec pointer as a \c float parameter to OpenGL functions:
-@@ -204,6 +206,16 @@ public:
- 		return result;
- 	}
- 	//@}
-+#else //ifndef __arm__
-+    operator const float*() const {
+@@ -197,11 +210,23 @@ public:
+   \endcode
+   \note The returned float array is a static shared by all \c Vec instances. */
+ 	operator const float*() const {
+-		static float* const result = new float[3];
+-		result[0] = (float)x;
+-		result[1] = (float)y;
+-		result[2] = (float)z;
+-		return result;
++        if (std::is_same<double, qreal>::value) {
++		    static float* const result = new float[3];
++		    result[0] = static_cast<float>(x);
++		    result[1] = static_cast<float>(y);
++		    result[2] = static_cast<float>(z);
++		    return result;
++        }
++        else if (std::is_same<float, qreal>::value) {
 +#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
-+        return &x;
++            return (float*)&x;
 +#else
-+        return v_;
++            return (float*)v_;
 +#endif
-+    }
-+#endif
-+
++        }
++        else {
++            throw std::logic_error("sizeof(qreal) must be sizeof(float) or sizeof(double)");
++        }
+ 	}
+ 	//@}
  
- 	/*! @name Algebraic computations */
- 	//@{

                 reply	other threads:[~2026-11-30 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179604690855.1.2922537365999670461.rpms-libQGLViewer-6724afb1b7d9@fedoraproject.org \
    --to=richmattes@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox