/// <summary> /// Initializes the local part of the mod. /// </summary> public static void Startup(IntPtr _unmanagedModule) { if (!Scripting.IsHost) { Universe.CreateWorld("UpvoidMinerWorld", new UpvoidMinerNetworkWorldReceiver()); } // Create a simple camera that allows free movement. Camera = new GenericCamera (); Camera.FarClippingPlane = 3500.0; CameraControl = new FreeCameraControl (-10f, Camera); // Get the world (created by the host script) World world = Universe.GetWorldByName ("UpvoidMinerWorld"); // Place the camera in the world world.AttachCamera (Camera); if (Rendering.ActiveMainPipeline != null) Rendering.ActiveMainPipeline.SetCamera (Camera); GC.KeepAlive (Camera); if (!Scripting.IsHost) { ivec3 refPos = new ivec3 (0, 0, 0); float activeRadius = 10; float sleepingRadius = 20; float minLODRange = 10; float falloff = 5; world.AddActiveRegion (refPos, activeRadius, sleepingRadius, minLODRange, falloff); } // Configure the camera to receive user input Input.RootGroup.AddListener (CameraControl); // Registers the update callback that updates the camera position. Scripting.RegisterUpdateFunction(Update, 1 / 60.0f, 3 / 60.0f); }
/// <summary> /// Extracts bits [offset, offset + bits - 1] from value, returning them /// in the least significant bits of the result. /// The most significant bits will be set to the value of bit offset + base – 1. /// If bits is zero, the result will be zero. The result will be undefined if /// offset or bits is negative, or if the sum of offset and bits is greater than /// the number of bits used to store the operand. /// </summary> /// <returns></returns> protected static ivec3 bitfieldExtract(ivec3 value, int offset, int bits) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Log ((int)Math.Log((double)lhs, (double)rhs)). /// </summary> public static ivec3 Log(ivec3 lhs, ivec3 rhs) => ivec3.Log(lhs, rhs);
/// <summary> /// Returns a ivec3 from component-wise application of Max (Math.Max(lhs, rhs)). /// </summary> public static ivec3 Max(ivec3 lhs, ivec3 rhs) => ivec3.Max(lhs, rhs);
/// <summary> /// Returns a ivec3 from component-wise application of Step (v >= 0 ? 1 : 0). /// </summary> public static ivec3 Step(ivec3 v) => ivec3.Step(v);
/// <summary> /// Returns a ivec3 from component-wise application of HermiteInterpolationOrder5 (((6 * v - 15) * v + 10) * v * v * v). /// </summary> public static ivec3 HermiteInterpolationOrder5(ivec3 v) => ivec3.HermiteInterpolationOrder5(v);
public ivec2(ivec3 xyz) { x = xyz.x; y = xyz.y; }
/// <summary> /// Returns true iff this equals rhs type- and component-wise. /// </summary> public static bool Equals(ivec3 v, object obj) => v.Equals(obj);
/// <summary> /// Use integer texture coordinate P to lookup a single texel from sampler. /// The level-ofdetail lod is as described in sections 2.11.8 “Shader Execution” /// under Texel Fetches and 3.8 “Texturing” of the OpenGL GraphicsSystem Specification. /// </summary> protected internal static ivec4 TexelFetch(isampler3D sampler, ivec3 P, int lod) { throw _invalidAccess; }
/// <summary> Do an offset texture lookup with explicit LOD. See TextureLod and TextureOffset.</summary> protected internal static ivec4 TextureLodOffset(isampler3D sampler, vec3 P, float lod, ivec3 offset) { throw _invalidAccess; }
/// <summary>Do a texture lookup with both explicit gradient and offset, as described in TextureGrad and TextureOffset. </summary> protected internal static ivec4 TextureGradOffset(isampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy, ivec3 offset) { throw _invalidAccess; }
/// <summary> Do a projective texture lookup as described in TextureProj offset by offset as described in TextureOffset. </summary> protected internal static uvec4 TextureProjOffset(usampler3D sampler, vec4 P, ivec3 offset) { throw _invalidAccess; }
/// <summary> Do a projective texture lookup as described in TextureProj offset by offset as described in TextureOffset. </summary> protected internal static ivec4 TextureProjOffset(isampler3D sampler, vec4 P, ivec3 offset, float bias) { throw _invalidAccess; }
/// <summary> Fetch a single texel as in TexelFetch offset by offset as described in TextureOffset. </summary> protected internal static uvec4 TexelFetchOffset(usampler3D sampler, ivec3 P, int lod, ivec3 offset) { throw _invalidAccess; }
/// <summary> Do a texture lookup as in texture but with offset added to the (u,v,w) texel coordinates before looking up each texel. /// The offset value must be a constant expression. A limited range of offset values are supported; /// the minimum and maximum offset values are implementation-dependent and given by MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, respectively. /// Note that offset does not apply to the layer coordinate for texture arrays. This is explained in detail in section 3.8.11 /// “Texture Minification” of the OpenGL Graphics System Specification, where offset is (∂u ,∂v ,∂w). /// </summary> protected internal static uvec4 TextureOffset(usampler3D sampler, vec3 P, ivec3 offset, float bias) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 with independent and identically distributed uniform integer values between minValue (inclusive) and maxValue (exclusive). (minValue == maxValue is allowed and returns minValue. Negative values are allowed.) /// </summary> public static ivec3 RandomUniform(Random random, ivec3 minValue, ivec3 maxValue) => ivec3.RandomUniform(random, minValue, maxValue);
/// <summary> /// Returns the number of components (3). /// </summary> public static int Count(ivec3 v) => v.Count;
/// <summary> Do a texture lookup as in texture but with offset added to the (u,v,w) texel coordinates before looking up each texel. /// The offset value must be a constant expression. A limited range of offset values are supported; /// the minimum and maximum offset values are implementation-dependent and given by MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, respectively. /// Note that offset does not apply to the layer coordinate for texture arrays. This is explained in detail in section 3.8.11 /// “Texture Minification” of the OpenGL Graphics System Specification, where offset is (∂u ,∂v ,∂w). /// </summary> protected static vec4 textureOffset(sampler3D sampler, vec3 P, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns a bvec3 from component-wise application of Equal (lhs == rhs). /// </summary> public static bvec3 Equal(ivec3 lhs, ivec3 rhs) => ivec3.Equal(lhs, rhs);
/// <summary> Do a texture lookup as in texture but with offset added to the (u,v,w) texel coordinates before looking up each texel. /// The offset value must be a constant expression. A limited range of offset values are supported; /// the minimum and maximum offset values are implementation-dependent and given by MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, respectively. /// Note that offset does not apply to the layer coordinate for texture arrays. This is explained in detail in section 3.8.11 /// “Texture Minification” of the OpenGL Graphics System Specification, where offset is (∂u ,∂v ,∂w). /// </summary> protected static ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset, float bias) { throw _invalidAccess; }
/// <summary> /// Returns a bvec3 from component-wise application of LesserThanEqual (lhs <= rhs). /// </summary> public static bvec3 LesserThanEqual(ivec3 lhs, ivec3 rhs) => ivec3.LesserThanEqual(lhs, rhs);
/// <summary> /// Use integer texture coordinate P to lookup a single texel from sampler. /// The level-ofdetail lod is as described in sections 2.11.8 “Shader Execution” /// under Texel Fetches and 3.8 “Texturing” of the OpenGL GraphicsSystem Specification. /// </summary> protected static uvec4 texelFetch(usampler3D sampler, ivec3 P, int lod) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Pow3 (v * v * v). /// </summary> public static ivec3 Pow3(ivec3 v) => ivec3.Pow3(v);
/// <summary>Do a texture lookup projectively and with explicit gradient as described in textureProjGrad, /// as well as with offset, as described in textureOffset.</summary> protected static vec4 textureProjGradOffset(sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of InverseSqrt ((int)(1.0 / Math.Sqrt((double)v))). /// </summary> public static ivec3 InverseSqrt(ivec3 v) => ivec3.InverseSqrt(v);
/// <summary> Do an offset texture lookup with explicit LOD. See textureLod and textureOffset.</summary> protected static vec4 textureProjLodOffset(sampler3D sampler, vec4 P, float lod, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Min (Math.Min(lhs, rhs)). /// </summary> public static ivec3 Min(ivec3 lhs, ivec3 rhs) => ivec3.Min(lhs, rhs);
/// <summary> Fetch a single texel as in texelFetch offset by offset as described in textureOffset. </summary> protected static uvec4 texelFetchOffset(sampler3D sampler, uvec3 P, int lod, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Mix (min * (1-a) + max * a). /// </summary> public static ivec3 Mix(ivec3 min, ivec3 max, ivec3 a) => ivec3.Mix(min, max, a);
/// <summary> Do a projective texture lookup as described in textureProj offset by offset as described in textureOffset. </summary> protected static ivec4 textureProjOffset(isampler3D sampler, vec4 P, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 with independent and identically distributed uniform integer values between 0 (inclusive) and maxValue (exclusive). (A maxValue of 0 is allowed and returns 0.) /// </summary> public static ivec3 Random(Random random, ivec3 maxValue) => ivec3.Random(random, maxValue);
/// <summary> Do a projective texture lookup as described in textureProj offset by offset as described in textureOffset. </summary> protected static uvec4 textureProjOffset(usampler3D sampler, vec4 P, ivec3 offset, float bias) { throw _invalidAccess; }
/// <summary> /// Returns a string representation of this vector using a provided seperator and a format and format provider for each component. /// </summary> public static string ToString(ivec3 v, string sep, string format, IFormatProvider provider) => v.ToString(sep, format, provider);
/// <summary>Do a texture lookup with both explicit gradient and offset, as described in textureGrad and textureOffset. </summary> protected static uvec4 textureGradOffset(usampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns true iff this equals rhs component-wise. /// </summary> public static bool Equals(ivec3 v, ivec3 rhs) => v.Equals(rhs);
/// <summary> Do an offset texture lookup with explicit LOD. See textureLod and textureOffset.</summary> protected static uvec4 textureLodOffset(usampler3D sampler, vec3 P, float lod, ivec3 offset) { throw _invalidAccess; }
/// <summary> /// Returns a hash code for this instance. /// </summary> public static int GetHashCode(ivec3 v) => v.GetHashCode();
/// <summary>Returns y if y < x, otherwise it returns x.</summary> protected internal static ivec3 Min(ivec3 x, int y) { throw _invalidAccess; }
/// <summary> /// Returns a bvec3 from component-wise application of NotEqual (lhs != rhs). /// </summary> public static bvec3 NotEqual(ivec3 lhs, ivec3 rhs) => ivec3.NotEqual(lhs, rhs);
/// <summary> /// Splits x into a floating-point significand in the range [0.5, 1.0) /// and an integral exponent of two, such that: x=significand⋅2**exponent /// The significand is returned by the function and the exponent is returned in the parameter exp. /// For a floating-point value of zero, the significant and exponent are both zero. /// For a floating-point value that is an infinity or is not a number, the results are undefined. /// </summary> protected static dvec3 frexp(dvec3 x, out ivec3 exp) { throw _invalidAccess; }
/// <summary> /// Returns a bvec3 from component-wise application of GreaterThanEqual (lhs >= rhs). /// </summary> public static bvec3 GreaterThanEqual(ivec3 lhs, ivec3 rhs) => ivec3.GreaterThanEqual(lhs, rhs);
/// <summary> /// Returns a floating-point value corresponding to a signed integer encoding /// of a floating-point value. If a NaN is passed in, it will not signal, /// and the resulting floating point value is unspecified. If an Inf is passed in, /// the resulting floating-point value is the corresponding Inf. /// </summary> protected static vec3 intBitsToFloat(ivec3 value) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Abs (Math.Abs(v)). /// </summary> public static ivec3 Abs(ivec3 v) => ivec3.Abs(v);
/// <summary> /// Builds a floating-point number from x and the corresponding integral exponent of two in exp, /// returning: significand⋅2*+exponent /// If this product is too large to be represented in the floating-point type, the result is undefined. /// </summary> protected static dvec3 ldexp(dvec3 x, ivec3 exp) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Pow2 (v * v). /// </summary> public static ivec3 Pow2(ivec3 v) => ivec3.Pow2(v);
/// <summary>Returns 1.0 if x > 0, 0.0 if x = 0, or –1.0 if x < 0.</summary> /// <returns>The sign of x</returns> protected static ivec3 sign(ivec3 x) { throw _invalidAccess; }
/// <summary> /// Returns an object that can be used for arbitrary swizzling (e.g. swizzle.zy) /// </summary> public static swizzle_ivec3 swizzle(ivec3 v) => v.swizzle;
/// <summary>Returns Min (Max (x, minVal), maxVal). Results are undefined if minVal > maxVal.</summary> protected internal static ivec3 Clamp(ivec3 x, ivec3 minVal, ivec3 maxVal) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Sqrt ((int)Math.Sqrt((double)v)). /// </summary> public static ivec3 Sqrt(ivec3 v) => ivec3.Sqrt(v);
/// <summary>Returns x if x >= 0, otherwise it returns –x.</summary> /// <returns>The absolute value of x</returns> protected internal static ivec3 Abs(ivec3 x) { throw _invalidAccess; }
/// <summary> /// Returns a ivec3 from component-wise application of Sign (Math.Sign(v)). /// </summary> public static ivec3 Sign(ivec3 v) => ivec3.Sign(v);
/// <summary>Returns y if x < y, otherwise it returns x.</summary> protected internal static ivec3 Max(ivec3 x, ivec3 y) { throw _invalidAccess; }
/// <summary> /// Returns an array with all values /// </summary> public static int[] Values(ivec3 v) => v.Values;
/// <summary> /// Returns a string representation of this vector using a provided seperator and a format for each component. /// </summary> public static string ToString(ivec3 v, string sep, string format) => v.ToString(sep, format);
/// <summary> /// Returns a ivec3 from component-wise application of Pow ((int)Math.Pow((double)lhs, (double)rhs)). /// </summary> public static ivec3 Pow(ivec3 lhs, ivec3 rhs) => ivec3.Pow(lhs, rhs);
/// <summary> /// Returns a vector pointing in the same direction as another (faceforward orients a vector to point away from a surface as defined by its normal. If dot(Nref, I) is negative faceforward returns N, otherwise it returns -N). /// </summary> public static ivec3 FaceForward(ivec3 N, ivec3 I, ivec3 Nref) => ivec3.FaceForward(N, I, Nref);
/// <summary> /// Returns a ivec3 from component-wise application of Clamp (Math.Min(Math.Max(v, min), max)). /// </summary> public static ivec3 Clamp(ivec3 v, ivec3 min, ivec3 max) => ivec3.Clamp(v, min, max);
/// <summary> /// Returns the outer product (cross product, vector product) of the two vectors. /// </summary> public static ivec3 Cross(ivec3 l, ivec3 r) => ivec3.Cross(l, r);
/// <summary> /// </summary> /// <param name="uniformName"></param> /// <param name="values"></param> /// <returns></returns> public int SetUniform(string uniformName, ivec3[] values) { int location = GetUniformLocation(uniformName); if (location >= 0) { if (glUniform3iv == null) { glUniform3iv = OpenGL.GetDelegateFor<OpenGL.glUniform3iv>(); } int count = values.Length; var value = new int[count * 3]; int index = 0; for (int i = 0; i < value.Length; i++) { value[index++] = values[i].x; value[index++] = values[i].y; value[index++] = values[i].z; } glUniform3iv(location, count, value); } return location; }
/// <summary> /// Multiplies 32-bit integers x and y, producing a 64-bit result. /// The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb. /// </summary> protected static void imulExtended(ivec3 x, ivec3 y, out ivec3 msb, out ivec3 lsb) { throw _invalidAccess; }