• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Go で書き直した Ikemen


Commit MetaInfo

Révision4f1dcc84b9671f7e906260907aa954d914972add (tree)
l'heure2019-07-19 18:29:52
Auteurneatunsou <sisiy4excite@gmai...>
Commiterneatunsou

Message de Log

Windblade氏の更新に対応

Change Summary

Modification

--- a/src/main.go
+++ b/src/main.go
@@ -90,19 +90,19 @@ func main() {
9090 "LifebarFontScale":1,
9191 "System":"script/main.lua",
9292 "KeyConfig":[{
93- "Joystick":-1,
94- "Buttons":["UP","DOWN","LEFT","RIGHT","z","x","c","a","s","d","RETURN","q","w"]
95- },{
96- "Joystick":-1,
97- "Buttons":["t","g","f","h","j","k","l","u","i","o","RSHIFT","LEFTBRACKET","RIGHTBRACKET"]
98- }],
93+ "Joystick":-1,
94+ "Buttons":["UP","DOWN","LEFT","RIGHT","z","x","c","a","s","d","RETURN","q","w"]
95+ },{
96+ "Joystick":-1,
97+ "Buttons":["t","g","f","h","j","k","l","u","i","o","RSHIFT","LEFTBRACKET","RIGHTBRACKET"]
98+ }],
9999 "JoystickConfig":[{
100- "Joystick":0,
101- "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
102- },{
103- "Joystick":1,
104- "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
105- }],
100+ "Joystick":0,
101+ "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
102+ },{
103+ "Joystick":1,
104+ "Buttons":["-7","-8","-5","-6","0","1","4","2","3","5","7","6","8"]
105+ }],
106106 "Motif":"data/system.def",
107107 "CommonAir":"data/common.air",
108108 "CommonCmd":"data/common.cmd",
@@ -133,26 +133,27 @@ func main() {
133133 "AllowDebugKeys":true,
134134 "PostProcessingShader": 0,
135135 "LocalcoordScalingType": 1,
136+ "MSAA": false,
136137 "IP":{
137138 }
138139 }
139140 `, "\n"), "\r\n"))
140141 tmp := struct {
141- HelperMax int32
142- PlayerProjectileMax int
143- ExplodMax int
144- AfterImageMax int32
145- MasterVolume int
146- WavVolume int
147- BgmVolume int
148- Attack_LifeToPowerMul float32 `json:"Attack.LifeToPowerMul"`
149- GetHit_LifeToPowerMul float32 `json:"GetHit.LifeToPowerMul"`
150- Width int32
151- Height int32
152- Super_TargetDefenceMul float32 `json:"Super.TargetDefenceMul"`
153- LifebarFontScale float32
154- System string
155- KeyConfig []struct {
142+ HelperMax int32
143+ PlayerProjectileMax int
144+ ExplodMax int
145+ AfterImageMax int32
146+ MasterVolume int
147+ WavVolume int
148+ BgmVolume int
149+ Attack_LifeToPowerMul float32 `json:"Attack.LifeToPowerMul"`
150+ GetHit_LifeToPowerMul float32 `json:"GetHit.LifeToPowerMul"`
151+ Width int32
152+ Height int32
153+ Super_TargetDefenceMul float32 `json:"Super.TargetDefenceMul"`
154+ LifebarFontScale float32
155+ System string
156+ KeyConfig []struct {
156157 Joystick int
157158 Buttons []interface{}
158159 }
@@ -160,17 +161,18 @@ func main() {
160161 Joystick int
161162 Buttons []interface{}
162163 }
163- NumTag int
164- TeamLifeShare bool
165- AIRandomColor bool
166- Fullscreen bool
167- AudioDucking bool
168- AllowDebugKeys bool
169- PostProcessingShader int32
170- LocalcoordScalingType int32
171- CommonAir string
172- CommonCmd string
173- QuickLaunch int
164+ NumTag int
165+ TeamLifeShare bool
166+ AIRandomColor bool
167+ Fullscreen bool
168+ AudioDucking bool
169+ AllowDebugKeys bool
170+ MSAA bool
171+ PostProcessingShader int32
172+ LocalcoordScalingType int32
173+ CommonAir string
174+ CommonCmd string
175+ QuickLaunch int
174176 }{}
175177 chk(json.Unmarshal(defcfg, &tmp))
176178 const configFile = "data/config.json"
@@ -234,6 +236,7 @@ func main() {
234236 sys.teamLifeShare = tmp.TeamLifeShare
235237 sys.fullscreen = tmp.Fullscreen
236238 sys.PostProcessingShader = tmp.PostProcessingShader
239+ sys.MultisampleAntialiasing = tmp.MSAA
237240 sys.LocalcoordScalingType = tmp.LocalcoordScalingType
238241 sys.aiRandomColor = tmp.AIRandomColor
239242 sys.allowDebugKeys = tmp.AllowDebugKeys
--- a/src/render.go
+++ b/src/render.go
@@ -21,7 +21,12 @@ var indices = [4]int32{1, 2, 0, 3}
2121
2222 // Post-processing
2323 var fbo, fbo_texture uint32
24+
25+// Clasic AA
26+var rbo_depth uint32
27+// MSAA
2428 var fbo_f, fbo_f_texture uint32
29+
2530 var postShader uintptr
2631 var postVertAttrib int32
2732 var postTexUniform int32
@@ -199,33 +204,60 @@ func RenderInit() {
199204 gl.DeleteObjectARB(vertObj)
200205 gl.DeleteObjectARB(fragObj)
201206
202- gl.Enable(gl.MULTISAMPLE)
207+ if sys.MultisampleAntialiasing {
208+ gl.Enable(gl.MULTISAMPLE)
209+ }
203210
204211 gl.ActiveTexture(gl.TEXTURE0)
205212 gl.GenTextures(1, &fbo_texture)
206- gl.BindTexture(gl.TEXTURE_2D_MULTISAMPLE, fbo_texture)
213+
214+ if sys.MultisampleAntialiasing {
215+ gl.BindTexture(gl.TEXTURE_2D_MULTISAMPLE, fbo_texture)
216+ } else {
217+ gl.BindTexture(gl.TEXTURE_2D, fbo_texture)
218+ }
219+
207220 gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
208221 gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
209222 gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
210223 gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
211- gl.TexImage2DMultisample(gl.TEXTURE_2D_MULTISAMPLE, 16, gl.RGBA, sys.scrrect[2], sys.scrrect[3], false)
224+
225+ if sys.MultisampleAntialiasing {
226+ gl.TexImage2DMultisample(gl.TEXTURE_2D_MULTISAMPLE, 16, gl.RGBA, sys.scrrect[2], sys.scrrect[3], false)
227+ } else {
228+ gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, sys.scrrect[2], sys.scrrect[3], 0, gl.RGBA, gl.UNSIGNED_BYTE, nil)
229+ }
230+
212231 gl.BindTexture(gl.TEXTURE_2D, 0)
213232
214- gl.GenTextures(1, &fbo_f_texture)
215- gl.BindTexture(gl.TEXTURE_2D, fbo_f_texture)
216- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
217- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
218- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
219- gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
220- gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, sys.scrrect[2], sys.scrrect[3], 0, gl.RGBA, gl.UNSIGNED_BYTE, nil)
233+ if sys.MultisampleAntialiasing {
234+ gl.GenTextures(1, &fbo_f_texture)
235+ gl.BindTexture(gl.TEXTURE_2D, fbo_f_texture)
236+ gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)
237+ gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
238+ gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
239+ gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
240+ gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, sys.scrrect[2], sys.scrrect[3], 0, gl.RGBA, gl.UNSIGNED_BYTE, nil)
241+ } else {
242+ gl.GenRenderbuffers(1, &rbo_depth)
243+ gl.BindRenderbuffer(gl.RENDERBUFFER, rbo_depth)
244+ gl.RenderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, sys.scrrect[2], sys.scrrect[3])
245+ gl.BindRenderbuffer(gl.RENDERBUFFER, 0)
246+ }
221247
222248 gl.GenFramebuffers(1, &fbo)
223249 gl.BindFramebuffer(gl.FRAMEBUFFER, fbo)
224- gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D_MULTISAMPLE, fbo_texture, 0)
225250
226- gl.GenFramebuffers(1, &fbo_f)
227- gl.BindFramebuffer(gl.FRAMEBUFFER, fbo_f)
228- gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fbo_f_texture, 0)
251+ if sys.MultisampleAntialiasing {
252+ gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D_MULTISAMPLE, fbo_texture, 0)
253+
254+ gl.GenFramebuffers(1, &fbo_f)
255+ gl.BindFramebuffer(gl.FRAMEBUFFER, fbo_f)
256+ gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fbo_f_texture, 0)
257+ } else {
258+ gl.FramebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fbo_texture, 0)
259+ gl.FramebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, rbo_depth)
260+ }
229261
230262 gl.BindFramebuffer(gl.FRAMEBUFFER, 0)
231263 }
@@ -235,11 +267,14 @@ func bindFB() {
235267 }
236268
237269 func unbindFB() {
238- gl.BindFramebuffer(gl.DRAW_FRAMEBUFFER, fbo_f)
239- gl.BindFramebuffer(gl.READ_FRAMEBUFFER, fbo)
240- gl.BlitFramebuffer(0, 0, sys.scrrect[2], sys.scrrect[3], 0, 0, sys.scrrect[2], sys.scrrect[3], gl.COLOR_BUFFER_BIT, gl.LINEAR)
270+ if sys.MultisampleAntialiasing {
271+ gl.BindFramebuffer(gl.DRAW_FRAMEBUFFER, fbo_f)
272+ gl.BindFramebuffer(gl.READ_FRAMEBUFFER, fbo)
273+ gl.BlitFramebuffer(0, 0, sys.scrrect[2], sys.scrrect[3], 0, 0, sys.scrrect[2], sys.scrrect[3], gl.COLOR_BUFFER_BIT, gl.LINEAR)
274+ }
241275
242276 gl.BindFramebuffer(gl.FRAMEBUFFER, 0)
277+
243278 postShader = postShaderSelect[sys.PostProcessingShader]
244279
245280 postVertAttrib = gl.GetAttribLocationARB(postShader, gl.Str("VertCoord\x00"))
@@ -248,7 +283,13 @@ func unbindFB() {
248283
249284 gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
250285 gl.UseProgramObjectARB(postShader)
251- gl.BindTexture(gl.TEXTURE_2D, fbo_f_texture)
286+
287+ if sys.MultisampleAntialiasing {
288+ gl.BindTexture(gl.TEXTURE_2D, fbo_f_texture)
289+ } else {
290+ gl.BindTexture(gl.TEXTURE_2D, fbo_texture)
291+ }
292+
252293 gl.Uniform1iARB(postTexUniform, 0)
253294 gl.Uniform2fARB(postTexSizeUniform, float32(sys.scrrect[2]), float32(sys.scrrect[3]))
254295 gl.EnableVertexAttribArrayARB(uint32(postVertAttrib))
--- a/src/system.go
+++ b/src/system.go
@@ -64,14 +64,15 @@ var sys = System{
6464 keyInput: glfw.KeyUnknown,
6565 keyString: "",
6666 // Localcoord sceenpack
67- luaSpriteScale: 1,
68- luaSmallPortraitScale: 1,
69- luaBigPortraitScale: 1,
70- luaSpriteOffsetX: 0,
71- lifebarScale: 1,
72- lifebarOffsetX: 0,
67+ luaSpriteScale: 1,
68+ luaSmallPortraitScale: 1,
69+ luaBigPortraitScale: 1,
70+ luaSpriteOffsetX: 0,
71+ lifebarScale: 1,
72+ lifebarOffsetX: 0,
7373 //Shader vars
74- PostProcessingShader: 0,
74+ MultisampleAntialiasing: false,
75+ PostProcessingShader: 0,
7576 }
7677
7778 type TeamMode int32
@@ -256,6 +257,7 @@ type System struct {
256257 LocalcoordScalingType int32
257258
258259 PostProcessingShader int32
260+ MultisampleAntialiasing bool
259261 }
260262
261263 func (s *System) init(w, h int32) *lua.LState {