订阅所有JSP/Servlet的日志 订阅 | 这是最新一篇日志 上一篇 | 下一篇日志 下一篇 ]
FLASH技术

CParticleEngine

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    class CParticleEngine
    {
        var hit_mc, prevTime;
        function CParticleEngine () {
        }
        function clear() {
            var _local1 = this;
            while (_local1.p_array.pop() != undefined) {
            }
            while (_local1.w_array.pop() != undefined) {
            }
            while (_local1.c_array.pop() != undefined) {
            }
        }
        function setHitMovie(hit_mc_) {
            hit_mc = hit_mc_;
        }
        function addParticle(p) {
            p_array.push(p);
        }
        function addWheel(wheel, p, maxSpeed, radius) {
            wheel.init(p, maxSpeed, radius);
            w_array.push(wheel);
        }
        function addSpringConstraint(p1, p2, koeffStiff1, koeffStiff2) {
            var _local1 = new CSpringConstraint(p1, p2, koeffStiff1, koeffStiff2);
            c_array.push(_local1);
        }
        function start() {
            prevTime = getTimer();
        }
        function computeForces() {
            var _local2 = this;
            var _local1;
            var _local3 = _local2.p_array.length;
            _local1 = 0;
            while (_local1 < _local3) {
                _local2.p_array[_local1].acc.x = 0;
                _local2.p_array[_local1].acc.y = _local2.gravity * _local2.p_array[_local1].mass;
                _local1++;
            }
        }
        function clearForces() {
            var _local3 = w_array.length;
            var _local1;
            var _local2;
            _local1 = 0;
            while (_local1 < _local3) {
                _local2 = w_array[_local1];
                _local2.addedAcc.x = (_local2.addedAcc.y = 0);
                _local1++;
            }
        }
        function applyManFrictions() {
            var _local3 = this;
            var _local2 = _local3.w_array.length;
            var _local1;
            _local1 = 0;
            while (_local1 < _local2) {
                _local3.w_array[_local1].applyAddedAcc();
                _local1++;
            }
        }
        function verlet(dTime) {
            var _local2 = this;
            var koeffDamp = 0.995;
            var _local1;
            var _local3 = _local2.p_array.length;
            _local1 = 0;
            while (_local1 < _local3) {
                _local2.p_array[_local1].verlet(dTime, koeffDamp);
                _local1++;
            }
            _local3 = _local2.w_array.length;
            var acc = 0;
            if (Key.isDown(40)) {
                acc = -0.6;
            } else if (Key.isDown(38)) {
                acc = 1;
            }
            _local1 = 0;
            while (_local1 < _local3) {
                _local2.w_array[_local1].process(dTime, (_local2.w_array[_local1].maxAccSpeed * acc) / 3.2, 0.99);
                _local1++;
            }
        }
        function checkCollisions() {
            var _local2 = this;
            var _local1;
            var _local3 = _local2.w_array.length;
            _local1 = 0;
            while (_local1 < _local3) {
                _local2.w_array[_local1].checkCollision(_local2.hit_mc);
                _local1++;
            }
        }
        function checkConstraints(dTime) {
            var _local3 = this;
            var _local1;
            var _local2 = _local3.c_array.length;
            _local1 = 0;
            while (_local1 < _local2) {
                _local3.c_array[_local1].resolve(dTime);
                _local1++;
            }
        }
        function process() {
            var _local1 = this;
            var curTime = getTimer();
            var dTime = ((curTime - _local1.prevTime) / 1000);
            _local1.prevTime = curTime;
            var _local2;
            var _local3 = Math.min(Math.round(dTime / _local1.t), _local1.maxSteps);
            _local2 = 0;
            while (_local2 < _local3) {
                _local1.computeForces();
                _local1.applyManFrictions();
                _local1.verlet(_local1.t);
                _local1.checkConstraints(_local1.t);
                _local1.checkCollisions();
                _local2++;
            }
            _local1.clearForces();
        }
        var p_array = new Array();
        var w_array = new Array();
        var c_array = new Array();
        var t = 0.02;
        var maxSteps = 2;
        var gravity = 3.15;
    }
 


平均得分
(0 次评分)





文章来自: 本站原创
标签: CParticleEngine 
评论: 6 | 查看次数: 1103
  • 共有 6 条评论
yanlink [2010-07-23 17:29:58]
yanlink [2010-06-18 15:09:34]
uggbootscheap [2010-04-30 19:50:15]
With friendship, mbt shoes review life is happy and harmonious. Without friendship, life is hostile and unfortunate. I have friends in the rank and mbt chapa azul file. Some are rich and in power. Some are low and common. Some are like myself, working as a teacher, reading and writing and content with the simple mbt sport black life we have. To many of my friends, I know what to treasure, what to tolerate and what to share mbt sport white , I will never forget my old friends and keep making new friends. I will not he cold and indifferent to the poor friends and will show mbt lami black concern for them, even if it is only a comforting mbt walk black word.As life is full of strife and conflict, we need friends to support and help as out of difficulties. Our frinods give us warnings against danger. True friends share not only joy but, more often than not, they share mbt m walk silver sorrow. 30 April LH
uggbootscheap [2010-04-10 22:03:42]
100410SLLHI'm very glad to have received timberland roll tops letter you sent me two weeks ago. I' ve been thinking about cheap timberland boots question you asked me. In my opinion, you should come back after you finish your studies abroad.For one white timberland boots reason, what you are studying is badly needed nowadays in usa. It will be quite easy for you to find a good pink timberland boots job. In fact, I know a few big companies in our city are hoping to employ people like you. For another womens timberland boots reason, I think it will be much more convenient for you to look after your timberland kids shoes parents as they are getting old. Therefore, I think it's a good chukka boots men idea for you to return. So what are you waiting for mens 6 inch timberland boots?
szjzfbq [2009-09-09 16:27:07]
也许今天很多人都期望杜丽能够拿到本届奥运会的首枚金牌,当最终她只获得了一个第五时,可能大家都感到些许遗,当记者问她是不是感觉压力很大时.深圳搬家杜丽先是笑了笑,但还是抑制不住掉下了眼泪,她说:"我已经非常努力了我只想看到五星红旗飘起来……”。 深圳搬家公司</a和>深圳空调拆装师傅都来到现场,其实虽然你没有拿到这个冠军,但是我想说的是你仍然是我们中国人心中的冠军!深圳布吉搬家公司我们还是会一如既往的支持你在几天以后的比赛中发挥出色,杜丽加油!中国加油!奥运加油!深圳搬厂公司 ....
beeflee [2009-05-05 17:27:33]
  • 共有 6 条评论
发表评论
昵 称:  登录
内 容:
选 项:
字数限制 1000 字 | UBB代码 开启 | [img]标签 开启