Here's a port of cspice and a patch for celestia to support it. Tested
on i386 and amd64.

Index: Makefile
===================================================================
RCS file: /cvs/ports/astro/celestia/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile	17 Nov 2009 23:12:16 -0000	1.14
+++ Makefile	30 Nov 2009 16:50:45 -0000
@@ -10,6 +10,9 @@ HOMEPAGE=	http://www.shatters.net/celest
 
 MAINTAINER=	Antoine Jacoutot <[email protected]>
 
+FLAVORS=	spice
+FLAVOR?=
+
 # GPLv2
 PERMIT_PACKAGE_CDROM=	Yes
 PERMIT_PACKAGE_FTP=	Yes
@@ -45,6 +48,19 @@ CONFIGURE_ARGS=	${CONFIGURE_SHARED} \
 		--with-lua \
 		--enable-cairo \
 		--enable-theora
+
+.if ${FLAVOR:L:Mspice}
+
+# Might bundled according to <[email protected]>
+PERMIT_PACKAGE_CDROM=	No
+PERMIT_PACKAGE_FTP=	No
+
+BUILD_DEPENDS+=	::astro/cspice
+
+CONFIGURE_ARGS+=	--with-cspice-dir=${PREFIX}
+MESSAGE=		${PKGDIR}/MESSAGE-spice
+
+.endif
 
 pre-configure:
 	${SUBST_CMD} ${WRKSRC}/src/celestia/celestiacore.cpp
Index: patches/patch-src_celengine_spiceorbit_cpp
===================================================================
RCS file: patches/patch-src_celengine_spiceorbit_cpp
diff -N patches/patch-src_celengine_spiceorbit_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_celengine_spiceorbit_cpp	30 Nov 2009 16:50:45 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/celengine/spiceorbit.cpp.orig	Mon Jun 22 17:44:08 2009
++++ src/celengine/spiceorbit.cpp	Wed Nov 18 10:46:18 2009
+@@ -128,7 +128,7 @@ SpiceOrbit::init(const string& path,
+ 	ktotal_c("spk", &spkCount);
+
+     // Get coverage window for target and origin object
+-	const int MaxIntervals = 10;
++	const int MaxIntervals = 1000;
+ 	SPICEDOUBLE_CELL ( targetCoverage, MaxIntervals * 2 );
+
+     // Clear the coverage window.
Index: patches/patch-src_celengine_spicerotation_cpp
===================================================================
RCS file: patches/patch-src_celengine_spicerotation_cpp
diff -N patches/patch-src_celengine_spicerotation_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_celengine_spicerotation_cpp	30 Nov 2009 16:50:45 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+--- src/celengine/spicerotation.cpp.orig	Mon Jun 22 17:44:08 2009
++++ src/celengine/spicerotation.cpp	Wed Nov 18 10:50:50 2009
+@@ -170,9 +170,18 @@ SpiceRotation::computeSpin(double jd) const
+         }
+
+ #if 1
+-        Mat3d m(Vec3d(xform[0][0], xform[0][1], xform[0][2]),
+-                Vec3d(xform[1][0], xform[1][1], xform[1][2]),
+-                Vec3d(xform[2][0], xform[2][1], xform[2][2]));
++        double a00, a01, a02;
++        double a10, a11, a12;
++        double a20, a21, a22;
++
++        a00 = xform[0][0]; a01 = xform[0][1]; a02 = xform[0][2];
++        a10 = xform[1][0]; a11 = xform[1][1]; a12 = xform[1][2];
++        a20 = xform[2][0]; a21 = xform[2][1]; a22 = xform[2][2];
++
++        Mat3d m(Vec3d(a00, a01, a02),
++                Vec3d(a10, a11, a12),
++                Vec3d(a20, a21, a22));
++
+ #else
+         Mat3d m(Vec3d(xform[0][0], xform[1][0], xform[2][0]),
+                 Vec3d(xform[0][1], xform[1][1], xform[2][1]),
Index: pkg/MESSAGE-spice
===================================================================
RCS file: pkg/MESSAGE-spice
diff -N pkg/MESSAGE-spice
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/MESSAGE-spice	30 Nov 2009 16:50:45 -0000
@@ -0,0 +1,2 @@
+Now, you can load NAIF spice kernels into celestia. See,
+http://en.wikibooks.org/wiki/Celestia/SPICE for an example.

Attachment: cspice.tar.gz
Description: Binary data

-- 
Manuel Giraud

Reply via email to