From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1152191-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 65BC6138239
	for <garchives@archives.gentoo.org>; Sat, 14 Mar 2020 17:59:39 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 38061E0C0C;
	Sat, 14 Mar 2020 17:59:29 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id D3D3CE0C3F
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Mar 2020 17:59:28 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id DFACB34EEF9
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Mar 2020 17:59:27 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id C7D26185
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Mar 2020 17:59:24 +0000 (UTC)
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" <asturm@gentoo.org>
Message-ID: <1584208738.5b8613a622a069d4d32332617a354c55dcc4f3c8.asturm@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: games-engines/openmw/files/, games-engines/openmw/
X-VCS-Repository: repo/gentoo
X-VCS-Files: games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-1.patch games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-2.patch games-engines/openmw/openmw-0.45.0.ebuild
X-VCS-Directories: games-engines/openmw/files/ games-engines/openmw/
X-VCS-Committer: asturm
X-VCS-Committer-Name: Andreas Sturmlechner
X-VCS-Revision: 5b8613a622a069d4d32332617a354c55dcc4f3c8
X-VCS-Branch: master
Date: Sat, 14 Mar 2020 17:59:24 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: ef4a8862-890e-40aa-b0b1-955780eba447
X-Archives-Hash: a23b1efcbdda2da420b775bfeb536fef

commit:     5b8613a622a069d4d32332617a354c55dcc4f3c8
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 14 17:36:07 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 17:58:58 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b8613a6

games-engines/openmw: Fix build w/ >=dev-games/openscenegraph-3.6.5

Bug: https://bugs.gentoo.org/709878
Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../openmw/files/openmw-0.45.0-osg-3.6.5-1.patch   | 51 ++++++++++++++++++++++
 .../openmw/files/openmw-0.45.0-osg-3.6.5-2.patch   | 21 +++++++++
 games-engines/openmw/openmw-0.45.0.ebuild          |  2 +
 3 files changed, 74 insertions(+)

diff --git a/games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-1.patch b/games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-1.patch
new file mode 100644
index 00000000000..b47fab28d12
--- /dev/null
+++ b/games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-1.patch
@@ -0,0 +1,51 @@
+From 807f550386a1eac6f7306589a4e4a01e783e65df Mon Sep 17 00:00:00 2001
+From: Alexander Olofsson <ace@haxalot.com>
+Date: Thu, 13 Feb 2020 19:15:33 +0100
+Subject: [PATCH] Fix building mwrender/sky with OSG 3.6.5
+
+OSG commit aff574b completely replaces the method of doing user-defined
+query geometry, removing support for modifying the default geometry.
+---
+ apps/openmw/mwrender/sky.cpp | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp
+index 3996f472c2..e13f5a7b65 100644
+--- a/apps/openmw/mwrender/sky.cpp
++++ b/apps/openmw/mwrender/sky.cpp
+@@ -558,16 +558,22 @@ class Sun : public CelestialBody
+         osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode;
+         oqn->setQueriesEnabled(true);
+ 
++#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
++        // With OSG 3.6.5, the method of providing user defined query geometry has been completely replaced
++        osg::ref_ptr<osg::QueryGeometry> queryGeom = new osg::QueryGeometry(oqn->getName());
++#else
++        auto* queryGeom = oqn->getQueryGeometry();
++#endif
++
+         // Make it fast! A DYNAMIC query geometry means we can't break frame until the flare is rendered (which is rendered after all the other geometry,
+         // so that would be pretty bad). STATIC should be safe, since our node's local bounds are static, thus computeBounds() which modifies the queryGeometry
+         // is only called once.
+         // Note the debug geometry setDebugDisplay(true) is always DYNAMIC and that can't be changed, not a big deal.
+-        oqn->getQueryGeometry()->setDataVariance(osg::Object::STATIC);
++        queryGeom->setDataVariance(osg::Object::STATIC);
+ 
+         // Set up the query geometry to match the actual sun's rendering shape. osg::OcclusionQueryNode wasn't originally intended to allow this,
+         // normally it would automatically adjust the query geometry to match the sub graph's bounding box. The below hack is needed to
+         // circumvent this.
+-        osg::Geometry* queryGeom = oqn->getQueryGeometry();
+         queryGeom->setVertexArray(mGeom->getVertexArray());
+         queryGeom->setTexCoordArray(0, mGeom->getTexCoordArray(0), osg::Array::BIND_PER_VERTEX);
+         queryGeom->removePrimitiveSet(0, oqn->getQueryGeometry()->getNumPrimitiveSets());
+@@ -578,6 +584,10 @@ class Sun : public CelestialBody
+         // Still need a proper bounding sphere.
+         oqn->setInitialBound(queryGeom->getBound());
+ 
++#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
++        oqn->setQueryGeometry(queryGeom.release());
++#endif
++
+         osg::StateSet* queryStateSet = new osg::StateSet;
+         if (queryVisible)
+         {

diff --git a/games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-2.patch b/games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-2.patch
new file mode 100644
index 00000000000..6b13291911c
--- /dev/null
+++ b/games-engines/openmw/files/openmw-0.45.0-osg-3.6.5-2.patch
@@ -0,0 +1,21 @@
+From 7db58a893a1448b7229de5464696b3cc6eb7663c Mon Sep 17 00:00:00 2001
+From: Alexander Olofsson <ace@haxalot.com>
+Date: Thu, 13 Feb 2020 19:32:17 +0100
+Subject: [PATCH] Ensure osg/Version is included
+
+---
+ apps/openmw/mwrender/sky.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp
+index e13f5a7b65..7cf2af88d0 100644
+--- a/apps/openmw/mwrender/sky.cpp
++++ b/apps/openmw/mwrender/sky.cpp
+@@ -16,6 +16,7 @@
+ #include <osg/BlendFunc>
+ #include <osg/AlphaFunc>
+ #include <osg/PolygonOffset>
++#include <osg/Version>
+ #include <osg/observer_ptr>
+ 
+ #include <osgParticle/BoxPlacer>

diff --git a/games-engines/openmw/openmw-0.45.0.ebuild b/games-engines/openmw/openmw-0.45.0.ebuild
index 54e986e845b..755240fa113 100644
--- a/games-engines/openmw/openmw-0.45.0.ebuild
+++ b/games-engines/openmw/openmw-0.45.0.ebuild
@@ -47,6 +47,8 @@ BDEPEND="
 	)
 "
 
+PATCHES=( "${FILESDIR}"/${P}-osg-3.6.5-{1,2}.patch ) # bug #709878
+
 S="${WORKDIR}/${PN}-${P}"
 
 src_prepare() {