Ejemplo n.º 1
1
        public SceneData(Enigma.D3.Scene scene)
        {
            scene_id = scene.x000_Id;
            scene_sno_id = scene.x0E8_SceneSnoId;
            area_sno_id = scene.x018_LevelAreaSnoId;

            min = new Vec3(scene.x0FC_MeshMinX, scene.x100_MeshMinY, scene.x104_MeshMinZ);
            max = new Vec3(scene.x174_MeshMaxX, scene.x178_MeshMaxY, scene.x104_MeshMinZ); //there is no max z, so consider all grid cells flat
        }
Ejemplo n.º 2
0
 public AttackTask(Weapon weapon, Dynamic target)
 {
     this.taskTime = 0f;
     this.weapon = weapon;
     this.targetPosition = new Vec3(float.NaN, float.NaN, float.NaN);
     this.targetEntity = target;
 }
Ejemplo n.º 3
0
 public ExploreCell(AABB aabb, List<Cell> cells, Vec3 position, int id = -1)
     : base(aabb.Min.X, aabb.Min.Y, 0, aabb.Max.X, aabb.Max.Y, 0, MovementFlag.None, id)
 {
     InitExploreCell();
     Position = position;
     Cells = cells;            
 }
Ejemplo n.º 4
0
 public DirectionalLight(SceneGraph graph, Vec3 intensity, Vec3 direction, float maxShadowDepth)
     : base(graph)
 {
     Intensity = intensity;
     MaxShadowDepth = maxShadowDepth;
     Direction = direction.Normalized;
 }
Ejemplo n.º 5
0
        public bool CellsContains2D(Vec3 p)
        {
            if (!Contains2D(p))
                return false;

            return Cells.Exists(c => c.Contains2D(p));
        }
Ejemplo n.º 6
0
 public Mat33(float exx, float exy, float exz, float eyx, float eyy, float eyz, float ezx,
     float ezy, float ezz)
 {
     ex = new Vec3(exx, exy, exz);
     ey = new Vec3(eyx, eyy, eyz);
     ez = new Vec3(ezx, ezy, ezz);
 }
Ejemplo n.º 7
0
 public Vertex(Vec3 position, Vec3 normal, Vec2 texCoord, Vec3 tangent)
 {
     this.position = position;
     this.normal = normal;
     this.texCoord = texCoord;
     this.tangent = tangent;
 }
Ejemplo n.º 8
0
 public override float GetIllumination( Vec3 position, Vec3 normal )
 {
     //normal
     float normalCoef = Vec3.Dot( normal, -lightDirection );
     MathFunctions.Saturate( ref normalCoef );
     return normalCoef;
 }
Ejemplo n.º 9
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnTick()"/>.</summary>
        protected override void OnTick()
        {
            //we call this before OnTick for saving old value of MainBody.LinearVelocity
            mainBodyVelocity = GetGroundRelativeVelocity();

            base.OnTick();
        }
Ejemplo n.º 10
0
		static void JetPackTick() {

			if (JetPackCtl) {
				float rotz = Mem.ReadFloat(ADDRESSES.DISPLAY.CAMERA_Z_ROT);
				var xVal = Math.Abs((float)Math.Cos(rotz)) * (rotz > 0 && rotz < HALF_PI || (rotz > (PI * 2 - HALF_PI) && rotz < PI * 2) ? -1 : 1);
				var yVal = Math.Abs((float)Math.Sin(rotz)) * (rotz > PI && rotz < PI * 2 ? 1 : -1);

				var coords = new Vec3(Mem.PtrToAddr(ADDRESSES.PLAYER.PlayerPointer, ADDRESSES.PLAYER.COORDS_X_OFFSET));
				coords.X += xVal * JetPackSpeed;
				coords.Y += yVal * JetPackSpeed;
				if ((bool)Config.jetPackCtlEnableZ.Value) {
					float rotx = Mem.ReadFloat(ADDRESSES.DISPLAY.CAMERA_X_ROT);
					coords.Z += rotx / HALF_PI * JetPackSpeed;
				}
				coords.MemWrite(Mem.PtrToAddr(ADDRESSES.PLAYER.PlayerPointer, ADDRESSES.PLAYER.COORDS_X_OFFSET));
			}

			new Vec3(0, 0, 0.0066016f).MemWrite(Mem.PtrToAddr(ADDRESSES.PLAYER.PlayerPointer, ADDRESSES.PLAYER.X_MOVE_SPEED));

			if (JetPackUp)
				Mem.WriteFloat(ADDRESSES.IsInVehicle	? Mem.PtrToAddr(ADDRESSES.VEHICLE.VehiclePointer, ADDRESSES.VEHICLE.SPEED_Z_OFFSET)
													: Mem.PtrToAddr(ADDRESSES.PLAYER.PlayerPointer, ADDRESSES.PLAYER.Z_MOVE_SPEED), JetPackSpeed * PI * 2);
			else if (JetPackDown)
				Mem.WriteFloat(ADDRESSES.IsInVehicle	? Mem.PtrToAddr(ADDRESSES.VEHICLE.VehiclePointer, ADDRESSES.VEHICLE.SPEED_Z_OFFSET)
													: Mem.PtrToAddr(ADDRESSES.PLAYER.PlayerPointer, ADDRESSES.PLAYER.Z_MOVE_SPEED), -JetPackSpeed * PI * 2);
		}
Ejemplo n.º 11
0
        public static unsafe extern IntPtr Initialize(
			 ref Vec3 bmin, ref Vec3 bmax,
			 float tileSize, float cellSize, float cellHeight,
			 int minRegionSize, int mergeRegionSize, [MarshalAs( UnmanagedType.U1 )] bool monotonePartitioning,
			 float maxEgdeLength, float maxEdgeError,
			 int vertsPerPoly, float detailSampleDistance, float detailMaxSampleError,
			 float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope );
Ejemplo n.º 12
0
 public MovementUpdate(Entity entity)
 {
     id = entity.Id;
     newPosition = entity.Get<PositionComponent>().Position;
     newRotation = entity.Get<PositionComponent>().Rotation;
     newVel = entity.Get<MovementComponent>().Velocity;
 }
Ejemplo n.º 13
0
        protected override void OnGetCameraTransform( out Vec3 position, out Vec3 forward,
			out Vec3 up, ref Degree cameraFov )
        {
            position = Vec3.Zero;
            forward = Vec3.XAxis;
            up = Vec3.ZAxis;

            Unit unit = GetPlayerUnit();
            if( unit == null )
                return;

            PlayerIntellect.Instance.FPSCamera = false;

            //To use data about orientation the camera if the cut scene is switched on
            if( IsCutSceneEnabled() )
            {
                if( CutSceneManager.Instance.GetCamera( out position, out forward, out up, out cameraFov ) )
                    return;
            }

            float distance = 25;
            position = unit.GetInterpolatedPosition() + new Vec3( 0, -distance, 0 );
            forward = Vec3.YAxis;
            up = Vec3.ZAxis;
        }
Ejemplo n.º 14
0
 public AttackTask(Weapon weapon, Vec3 target)
 {
     this.taskTime = 0f;
     this.weapon = weapon;
     this.targetPosition = target;
     this.targetEntity = null;
 }
Ejemplo n.º 15
0
 public TransformNode(SceneGraph graph, SceneNode node, Vec3 offset, Vec3 orientation, Vec3 scale)
     : base(graph, node)
 {
     _offset = offset;
     _orientation = orientation;
     _scale = scale;
     UpdateTransform ();
 }
Ejemplo n.º 16
0
        public override Ray GetCheckVisibilityRay( Vec3 position )
        {
            Vec3 dataPosition = position - lightDirection * 10000.0f;

            Vec3 diff = position - dataPosition;
            Vec3 dir = diff.GetNormalize();
            return new Ray( dataPosition, diff - dir * .01f );
        }
Ejemplo n.º 17
0
 public override void Update(double dt)
 {
     base.Update(dt);
     var len = (Entity.Get<PositionComponent>().Position - prevPos).Length;
     a += len * 5;
     k = GMath.Clamp(k + len * 10 - dt * 10, 0, 1);
     prevPos = Entity.Get<PositionComponent>().Position;
 }
Ejemplo n.º 18
0
 // Position callback
 public static void myPositionCallback(Object sender, TimeValue timestamp, Int32 sensor, Vec3 report)
 {
     Console.WriteLine("Got POSITION report: Position = ({0}, {1}, {2}), Sensor = ({3})",
         report.x,
         report.y,
         report.z,
         sensor);
 }
Ejemplo n.º 19
0
 public void Update(double dt)
 {
     nextSend -= dt;
     if (Entity.Local) {
         var dv = pushV * GMath.Clamp(dt * PUSH_SPEED, 1);
         Entity.Get<PositionComponent>().Position += dv;
         pushV -= dv;
     }
 }
Ejemplo n.º 20
0
Archivo: Crane.cs Proyecto: whztt07/SDK
 public override void GetFirstPersonCameraPosition( out Vec3 position, out Vec3 forward, out Vec3 up )
 {
     position = GetInterpolatedPosition() + Type.FPSCameraOffset * GetInterpolatedRotation();
     if( PlayerIntellect.Instance != null )
         forward = PlayerIntellect.Instance.LookDirection.GetVector();
     else
         forward = Vec3.XAxis;
     up = Vec3.ZAxis;
 }
Ejemplo n.º 21
0
        public void SetForceFireRotationLookTo( Vec3 lookTo )
        {
            setForceFireRotation = true;

            Vec3 diff = lookTo - Position;
            //Vec3 diff = lookTo - GetFirePosition( false );

            forceFireRotation = Quat.FromDirectionZAxisUp( diff );
        }
Ejemplo n.º 22
0
 public override void PhysX_GetDrivePosition( out Vec3 position, out Quat rotation )
 {
     if( nativeJoint == IntPtr.Zero )
     {
         position = Vec3.Zero;
         rotation = Quat.Identity;
         return;
     }
     PhysXNativeWrapper.PhysXNativeD6Joint.GetDrivePosition( nativeJoint, out position, out rotation );
 }
Ejemplo n.º 23
0
 public override void PhysX_GetDriveVelocity( out Vec3 linear, out Vec3 angular )
 {
     if( nativeJoint == IntPtr.Zero )
     {
         linear = Vec3.Zero;
         angular = Vec3.Zero;
         return;
     }
     PhysXNativeWrapper.PhysXNativeD6Joint.GetDriveVelocity( nativeJoint, out linear, out angular );
 }
Ejemplo n.º 24
0
        public void SetMomentaryTurnToPosition( Vec3 pos )
        {
            if( ( pos - Position ).Length() < 4.0f )
            {
                Vec3 dir = ( pos - Position ).GetNormalize();
                pos += dir * 10;
            }

            MomentaryTurnToPositionUpdate( pos );
        }
Ejemplo n.º 25
0
 protected override bool OnGetEditorSelectionByRay( Ray ray, out Vec3 pos, ref float priority )
 {
     float scale1, scale2;
     bool ret = GetBox().RayIntersection( ray, out scale1, out scale2 );
     if( ret )
         pos = ray.GetPointOnRay( Math.Min( scale1, scale2 ) );
     else
         pos = Vec3.Zero;
     return ret;
 }
Ejemplo n.º 26
0
 public void Push(Vec3 v)
 {
     if (!Entity.Local) {
         pushV += v;
     } else if (Entity.Model.Server != null) {
         Entity.Get<PositionComponent>().Position += v;
     } else {
         pushV += v;
     }
 }
Ejemplo n.º 27
0
    public static float solveLeastSquares(Mat3 a, Vec3 b, out Vec3 x,
	                                      float svd_tol, int svd_sweeps, float pinv_tol)
    {
        Mat3 at;
        SMat3 ata;
        Vec3 atb;
        MatUtils.transpose(out at, a);
        MatUtils.mmul_ata(out ata, a);
        MatUtils.vmul(out atb, at, b);
        return Svd.solveSymmetric(ata, atb, out x, svd_tol, svd_sweeps, pinv_tol);
    }
Ejemplo n.º 28
0
 public void UpdateOnce(double dt)
 {
     if (!Entity.Local && nextSend < 0 && pushV.Length != 0) {
         nextSend = Server.LAG;
         if (Entity.Model.Server != null)
             Entity.Model.Server.SendTo(new Messages.PushEntity(Entity, pushV), Entity.OwnerId);
         else
             Entity.Model.Client.AddToSend(new Messages.PushEntity(Entity, pushV));
         pushV = Vec3.Zero;
     }
 }
Ejemplo n.º 29
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //NeoAxis initialization
            if (!WinFormsAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this,
                "user:Logs/WinFormsAppExample.log", true, null, null, null, null))
            {
                Close();
                return;
            }

            UpdateVolume();

            renderTargetUserControl1.AutomaticUpdateFPS = 60;
            renderTargetUserControl1.KeyDown += renderTargetUserControl1_KeyDown;
            renderTargetUserControl1.KeyUp += renderTargetUserControl1_KeyUp;
            renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown;
            renderTargetUserControl1.MouseUp += renderTargetUserControl1_MouseUp;
            renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove;
            renderTargetUserControl1.Tick += renderTargetUserControl1_Tick;
            renderTargetUserControl1.Render += renderTargetUserControl1_Render;
            renderTargetUserControl1.RenderUI += renderTargetUserControl1_RenderUI;

            const string startMapName = "Maps\\MainMenu\\Map.map";

            //generate map list
            {
                string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories);
                foreach (string mapName in mapList)
                {
                    comboBoxMaps.Items.Add(mapName);
                    if (mapName == startMapName)
                        comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1;
                }
            }

            //load map
            WinFormsAppWorld.MapLoad(startMapName, true);

            //set camera position
            if (Map.Instance != null)
            {
                MapCamera mapCamera = FindFirstMapCamera();
                if (mapCamera != null)
                {
                    freeCameraPosition = mapCamera.Position;
                    freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward());
                }
                else
                {
                    freeCameraPosition = Map.Instance.EditorCameraPosition;
                    freeCameraDirection = Map.Instance.EditorCameraDirection;
                }
            }
        }
Ejemplo n.º 30
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var vector3 = (Vector3)value;
            var vec3 = new Vec3() {
                x = vector3.x,
                y = vector3.y,
                z = vector3.z
            };

            serializer.Serialize(writer, vec3);
        }
Ejemplo n.º 31
0
 public void addForce(Vec3 force)
 {
     forceAccum += force;
 }
Ejemplo n.º 32
0
        private static void DecodeSource(
            Source src,
            ESemantic semantic,
            int offset,
            int set,
            int maxSets,
            BasePrimitive prim,
            int[] indices,
            Vertex[][] vertices,
            InfluenceDef[] infList,
            Matrix4 bindMatrix,
            Matrix4 invTranspBindMatrix)
        {
            var acc = src.TechniqueCommonElement.AccessorElement;
            int stride = (int)acc.Stride;
            int startIndex, pointIndex;

            float[] list = src.GetArrayElement <FloatArray>().StringContent.Values;
            for (int i = 0, x = 0; i < prim.PointCount; ++i, x += prim.InputElements.Length)
            {
                if (vertices[i] == null)
                {
                    vertices[i] = new Vertex[maxSets];
                }

                startIndex = (pointIndex = indices[x + offset]) * stride;

                Vertex vtx = vertices[i][set];
                if (vtx == null)
                {
                    vtx = new Vertex();
                }

                switch (semantic)
                {
                case ESemantic.POSITION:
                    Vec3 position = new Vec3(
                        list[startIndex],
                        list[startIndex + 1],
                        list[startIndex + 2]);
                    position     = Vec3.TransformPosition(position, bindMatrix);
                    vtx.Position = position;
                    if (infList != null)
                    {
                        vtx.Influence = infList[pointIndex];
                    }
                    break;

                case ESemantic.NORMAL:
                    Vec3 normal = new Vec3(
                        list[startIndex],
                        list[startIndex + 1],
                        list[startIndex + 2]);
                    vtx.Normal = Vec3.TransformVector(normal, invTranspBindMatrix);
                    break;

                case ESemantic.BINORMAL:
                case ESemantic.TEXBINORMAL:
                    Vec3 binormal = new Vec3(
                        list[startIndex],
                        list[startIndex + 1],
                        list[startIndex + 2]);
                    vtx.Binormal = Vec3.TransformVector(binormal, invTranspBindMatrix);
                    break;

                case ESemantic.TANGENT:
                case ESemantic.TEXTANGENT:
                    Vec3 tangent = new Vec3(
                        list[startIndex],
                        list[startIndex + 1],
                        list[startIndex + 2]);
                    vtx.Tangent = Vec3.TransformVector(tangent, invTranspBindMatrix);
                    break;

                case ESemantic.TEXCOORD:
                    vtx.TexCoord = new Vec2(
                        list[startIndex],
                        ImportOptions.InvertTexCoordY ?
                        1.0f - list[startIndex + 1] : list[startIndex + 1]);
                    break;

                case ESemantic.COLOR:
                    vtx.Color = new ColorF4(
                        list[startIndex],
                        list[startIndex + 1],
                        list[startIndex + 2],
                        list[startIndex + 3]);
                    break;
                }
                vertices[i][set] = vtx;
            }
        }
Ejemplo n.º 33
0
        public void ProcessKeyboard(Vec3 direction, float deltaTime) {
	    	float velocity = MovementSpeed * deltaTime;
	    	Position += direction * velocity;
	    }
Ejemplo n.º 34
0
 public void SetLightDirection(int lightIndex, ref Vec3 direction) => EngineApplicationInterface.IScene.SetLightDirection(this.Pointer, lightIndex, direction);
 public void RenderDebugLine(Vec3 position, Vec3 direction, uint color = 4294967295, bool depthCheck = false, float time = 0) =>
 OriginalDebugManager.RenderDebugLine(position, direction, color, depthCheck, time);
Ejemplo n.º 36
0
 public void SetSunLight(ref Vec3 color, ref Vec3 direction) => EngineApplicationInterface.IScene.SetSunLight(this.Pointer, color, direction);
Ejemplo n.º 37
0
        private Unit ServerOrSingle_CreatePlayerUnit(PlayerManager.ServerOrSingle_Player player,
                                                     MapObject spawnPoint)
        {
            string unitTypeName;

            if (!player.Bot)
            {
                if (player.Intellect.Faction.Name == "AssaultKnights" && GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
                {
                    unitTypeName = "AKSoldier";
                }
                else if (player.Intellect.Faction.Name == "Omni" && GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
                {
                    unitTypeName = "OmniSoldier";
                }
                else if (GameMap.Instance.PlayerUnitType != null)
                {
                    unitTypeName = GameMap.Instance.PlayerUnitType.Name;
                }
                else
                {
                    unitTypeName = "Girl";
                }
            }
            else if (player.Bot)
            {
                unitTypeName = player.Name;
            }
            else
            {
                unitTypeName = "Rabbit";
            }

            Unit unit = (Unit)Entities.Instance.Create(unitTypeName, Map.Instance);

            Vec3 posOffset = new Vec3(0, 0, 1.5f);

            unit.Position = spawnPoint.Position + posOffset;
            unit.Rotation = spawnPoint.Rotation;
            unit.PostCreate();

            if (player.Intellect != null)
            {
                player.Intellect.ControlledObject = unit;
                unit.SetIntellect(player.Intellect, false);
            }

            Teleporter teleporter = spawnPoint as Teleporter;

            if (teleporter != null)
            {
                teleporter.ReceiveObject(unit, null);
            }

            //Incin -- Custom Box teleporter
            BoxTeleporter boxteleporter = spawnPoint as BoxTeleporter;

            if (boxteleporter != null)
            {
                boxteleporter.ReceiveObject(unit, null);
            }

            return(unit);
        }
Ejemplo n.º 38
0
 public void Move(Vec2 delta)
 {
     Eye += Right * delta.X * MovementScale;
     Eye += Dir * delta.Y * MovementScale;
 }
Ejemplo n.º 39
0
 private static extern bool Transform_getTranslation(IntPtr transform_reference, ref Vec3 translation);
Ejemplo n.º 40
0
 public bool GetTranslation(out Vec3 translation)
 {
     translation = new Vec3();
     return(Transform_getTranslation(GetNativeReference(), ref translation));
 }
Ejemplo n.º 41
0
 public void DrawLine(Vec3 p1, Vec3 p2)
 {
     //_graphics.DrawLine(Brushes.Red, new Point((int)p1.x, (int)p1.y), new Point((int)p2.x, (int)p2.y));
 }
Ejemplo n.º 42
0
        public override void OnAgentShootMissile(Agent shooterAgent, EquipmentIndex weaponIndex, Vec3 position, Vec3 velocity, Mat3 orientation, bool hasRigidBody, int forcedMissileIndex)
        {
            if (!_fireArrowEnabled)
            {
                return;
            }

            bool          allowed = false;
            MissionWeapon weapon  = shooterAgent.Equipment[weaponIndex];

            switch (weapon.CurrentUsageItem.WeaponClass)
            {
            case WeaponClass.Arrow:
            case WeaponClass.Bolt:
            case WeaponClass.Bow:
            case WeaponClass.Crossbow:
                allowed = true;
                break;

            case WeaponClass.ThrowingAxe:
            case WeaponClass.ThrowingKnife:
            case WeaponClass.Javelin:
                allowed = FireLordConfig.AllowFireThrownWeapon;
                break;
            }
            if (allowed)
            {
                foreach (Mission.Missile missile in Mission.Current.Missiles)
                {
                    if (!_missileParticles.ContainsKey(missile))
                    {
                        MatrixFrame    localFrame = new MatrixFrame(Mat3.Identity, new Vec3(0, 0, 0));
                        ParticleSystem particle   = ParticleSystem.CreateParticleSystemAttachedToEntity(
                            "psys_game_burning_agent", missile.Entity, ref localFrame);
                        Light light = Light.CreatePointLight(FireLordConfig.FireArrowLightRadius);
                        light.Intensity  = FireLordConfig.FireArrowLightIntensity;
                        light.LightColor = FireLordConfig.FireArrowLightColor;
                        missile.Entity.AddLight(light);
                        _missileParticles.Add(missile, particle);
                    }
                }
            }
        }
Ejemplo n.º 43
0
        protected virtual void CreateBullet(Mode mode)
        {
            Bullet obj = (Bullet)Entities.Instance.Create(mode.typeMode.BulletType, Parent);

            obj.SourceUnit = GetParentUnitHavingIntellect();
            obj.Position   = GetFirePosition(mode.typeMode);

            //Correcting position at a shot in very near object (when the point of a shot inside object).
            {
                Vec3 startPos = Position;
                if (AttachedMapObjectParent != null)
                {
                    startPos = AttachedMapObjectParent.Position;
                }

                Ray ray = new Ray(startPos, obj.Position - startPos);
                if (ray.Direction != Vec3.Zero)
                {
                    RayCastResult[] piercingResult = PhysicsWorld.Instance.RayCastPiercing(
                        ray, (int)ContactGroup.CastOnlyContact);

                    foreach (RayCastResult result in piercingResult)
                    {
                        MapObject mapObject = MapSystemWorld.GetMapObjectByBody(result.Shape.Body);

                        if (mapObject != null)
                        {
                            if (mapObject == this)
                            {
                                continue;
                            }
                            if (mapObject == this.AttachedMapObjectParent)
                            {
                                continue;
                            }
                        }

                        obj.Position = result.Position - ray.Direction * .01f;
                        break;
                    }
                }
            }

            Quat   rot             = GetFireRotation(mode.typeMode);
            Radian dispersionAngle = mode.typeMode.DispersionAngle;

            if (dispersionAngle != 0)
            {
                EngineRandom random = World.Instance.Random;

                Mat3 matrix;
                matrix  = Mat3.FromRotateByX(random.NextFloat() * MathFunctions.PI * 2);
                matrix *= Mat3.FromRotateByZ(random.NextFloat() * dispersionAngle);

                rot *= matrix.ToQuat();
            }
            obj.Rotation = rot;

            obj.PostCreate();

            //set damage coefficient
            float coef = obj.DamageCoefficient;
            Unit  unit = GetParentUnitHavingIntellect();

            if (unit != null && unit.BigDamageInfluence != null)
            {
                coef *= unit.BigDamageInfluence.Type.Coefficient;
            }
            obj.DamageCoefficient = coef;
        }
Ejemplo n.º 44
0
 public void SetSun(ref Vec3 color, float altitude, float angle, float intensity) => EngineApplicationInterface.IScene.SetSun(this.Pointer, color, altitude, angle, intensity);
Ejemplo n.º 45
0
 public void SetSunDirection(ref Vec3 direction) => EngineApplicationInterface.IScene.SetSunDirection(this.Pointer, direction);
Ejemplo n.º 46
0
 extern internal static void ActivateOutputVec3(IntPtr nodePtr, int port, Vec3 value);
Ejemplo n.º 47
0
 public DiffuseAndSpecular(Vec3 diff, Vec3 spec)
 {
     diffuse  = diff;
     specular = spec;
 }
Ejemplo n.º 48
0
 SerializableVector3 ReadVec3(Vec3 vec)
 {
     return(new SerializableVector3(vec.X, vec.Y, vec.Z));
 }
 public void RenderDebugSphere(Vec3 position, float radius, uint color = 4294967295, bool depthCheck = false, float time = 0) =>
 OriginalDebugManager.RenderDebugSphere(position, radius, color, depthCheck, time);
Ejemplo n.º 50
0
 public void SetFogAmbientColor(ref Vec3 fogAmbientColor) => EngineApplicationInterface.IScene.SetFogAmbientColor(this.Pointer, ref fogAmbientColor);
Ejemplo n.º 51
0
 /// <summary>
 /// Calculates the position of the vertex.
 /// </summary>
 /// <returns></returns>
 protected virtual Vec3 CalculateVertex(Vec3 origin, float[] values, int edgeMask)
 {
     return(origin);
 }
Ejemplo n.º 52
0
 public MD5Weight(int boneIndex, float weight, Vec3 ofs)
 {
     this.boneIndex = boneIndex;
     this.weight    = weight;
     this.offset    = ofs;
 }
Ejemplo n.º 53
0
        protected override void PostStep(int x, int y, int z, Vec3 origin)
        {
            // Pointer to buffer
            var pointer = z + y * (_gridZ) + (_gridZ) * (_gridY) * x;

            // Calculate cube corners!
            Vec3[]  corners = new Vec3[8];
            float[] values  = new float[8];
            for (int i = 0; i < 8; i++)
            {
                var p = origin + cornersDiff[i];
                corners[i] = p;
                values[i]  = _obj.Distance(p);
            }

            // Calculate 8bit mask for fast sign checks!
            byte mask = 0;

            if (values[0] <= 0)
            {
                mask |= 1;
            }
            if (values[1] <= 0)
            {
                mask |= 2;
            }
            if (values[2] <= 0)
            {
                mask |= 4;
            }
            if (values[3] <= 0)
            {
                mask |= 8;
            }
            if (values[4] <= 0)
            {
                mask |= 16;
            }
            if (values[5] <= 0)
            {
                mask |= 32;
            }
            if (values[6] <= 0)
            {
                mask |= 64;
            }
            if (values[7] <= 0)
            {
                mask |= 128;
            }

            // Check for early termination
            if (mask == 0 || mask == 255)
            {
                return;
            }

            // Calculate sum of edges!
            var edgeMask = edge_table[mask];

            //Calculate vertex
            var vertex = CalculateVertex(origin, values, edgeMask);

            // Store all vertices generated
            buffer[pointer] = vertices.Count;
            vertices.Add(vertex);

            // Add faces
            for (int i = 0; i < 3; ++i)
            {
                //The first three entries of the edge_mask count the crossings along the edge
                if ((edgeMask & (1 << i)) == 0)
                {
                    continue;
                }

                var iu = (i + 1) % 3;
                var iv = (i + 2) % 3;

                if ((z == minz && (iu == 0 || iv == 0)) ||
                    (y == miny && (iu == 1 || iv == 1)) ||
                    (x == minx && (iu == 2 || iv == 2)))
                {
                    continue;
                }

                var du = offsets[iu];
                var dv = offsets[iv];

                //Remember to flip orientation depending on the sign of the corner.
                if ((mask & 1) == 0)
                {
                    _builder.Append(vertices[buffer[pointer]], vertices[buffer[pointer - du]], vertices[buffer[pointer - du - dv]]);
                    _builder.Append(vertices[buffer[pointer - du - dv]], vertices[buffer[pointer - dv]], vertices[buffer[pointer]]);
                }
                else
                {
                    _builder.Append(vertices[buffer[pointer]], vertices[buffer[pointer - dv]], vertices[buffer[pointer - du - dv]]);
                    _builder.Append(vertices[buffer[pointer - du - dv]], vertices[buffer[pointer - du]], vertices[buffer[pointer]]);
                }
            }
        }
Ejemplo n.º 54
0
 public void SetLightPosition(int lightIndex, ref Vec3 position) => EngineApplicationInterface.IScene.SetLightPosition(this.Pointer, lightIndex, position);
Ejemplo n.º 55
0
 public void SetFog(float fogDensity, ref Vec3 fogColor, float fogFalloff) => EngineApplicationInterface.IScene.SetFog(this.Pointer, fogDensity, ref fogColor, fogFalloff);
Ejemplo n.º 56
0
 public int AddDirectionalLight(ref Vec3 position, ref Vec3 direction, float radius) => EngineApplicationInterface.IScene.AddDirectionalLight(this.Pointer, position, direction, radius);
Ejemplo n.º 57
0
 public void SetLightDiffuseColor(int lightIndex, ref Vec3 diffuseColor) => EngineApplicationInterface.IScene.SetLightDiffuseColor(this.Pointer, lightIndex, diffuseColor);
Ejemplo n.º 58
0
 public override MyColor GetColor(Ray ray, Light lightSample, Vec3 normal, Vec3 position)
 {
     return(materialColor);
 }
Ejemplo n.º 59
0
 public void setCurrentPos(Vec3 np)
 {
     this.currentPosition = np;
 }
Ejemplo n.º 60
0
 private Vector3 ToVector3(Vec3 v)
 {
     return(new Vector3(v.x, v.y, v.z));
 }