Revision 7602a827
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/library/effect/Effect.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/EffectName.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/EffectQuality.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/EffectType.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
83 | 83 |
|
84 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
/** |
86 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
86 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
87 | 87 |
*/ |
88 | 88 |
public static void enable() |
89 | 89 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
81 | 81 |
|
82 | 82 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 83 |
/** |
84 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
84 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
85 | 85 |
*/ |
86 | 86 |
public static void enable() |
87 | 87 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
91 | 91 |
|
92 | 92 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
93 | 93 |
/** |
94 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
94 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
95 | 95 |
*/ |
96 | 96 |
public static void enable() |
97 | 97 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
81 | 81 |
|
82 | 82 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 83 |
/** |
84 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
84 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
85 | 85 |
*/ |
86 | 86 |
public static void enable() |
87 | 87 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
83 | 83 |
|
84 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
/** |
86 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
86 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
87 | 87 |
*/ |
88 | 88 |
public static void enable() |
89 | 89 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffect.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/MatrixEffectMove.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/MatrixEffectQuaternion.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/MatrixEffectRotate.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/MatrixEffectScale.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/MatrixEffectShear.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
21 | 21 |
|
22 | 22 |
import org.distorted.library.main.DistortedFramebuffer; |
23 |
import org.distorted.library.main.DistortedMaster;
|
|
23 |
import org.distorted.library.main.InternalMaster;
|
|
24 | 24 |
import org.distorted.library.program.DistortedProgram; |
25 | 25 |
|
26 | 26 |
import java.lang.reflect.Method; |
... | ... | |
33 | 33 |
/** |
34 | 34 |
* Abstract class that represents an Effect that works by running a certain Shader Program(s) on a Framebuffer. |
35 | 35 |
*/ |
36 |
public abstract class PostprocessEffect extends Effect implements DistortedMaster.Slave
|
|
36 |
public abstract class PostprocessEffect extends Effect implements InternalMaster.Slave
|
|
37 | 37 |
{ |
38 | 38 |
private static final int MIPMAP = 0; |
39 | 39 |
/** |
... | ... | |
251 | 251 |
public void setQuality(EffectQuality quality) |
252 | 252 |
{ |
253 | 253 |
mJobs.add(new Job(MIPMAP,quality.getLevel())); |
254 |
DistortedMaster.newSlave(this);
|
|
254 |
InternalMaster.newSlave(this);
|
|
255 | 255 |
} |
256 | 256 |
} |
src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
21 | 21 |
|
22 | 22 |
import android.opengl.GLES31; |
23 | 23 |
|
24 |
import org.distorted.library.main.Distorted; |
|
24 |
import org.distorted.library.main.DistortedLibrary;
|
|
25 | 25 |
import org.distorted.library.main.DistortedFramebuffer; |
26 |
import org.distorted.library.main.DistortedRenderState;
|
|
26 |
import org.distorted.library.main.InternalRenderState;
|
|
27 | 27 |
import org.distorted.library.program.DistortedProgram; |
28 | 28 |
import org.distorted.library.type.Data1D; |
29 | 29 |
|
... | ... | |
169 | 169 |
} |
170 | 170 |
} |
171 | 171 |
|
172 |
DistortedRenderState.useStencilMark();
|
|
172 |
InternalRenderState.useStencilMark();
|
|
173 | 173 |
|
174 | 174 |
buffer.setAsOutput(); |
175 | 175 |
|
... | ... | |
230 | 230 |
GLES31.glVertexAttribPointer(mProgram2.mAttribute[1], TEX_DATA_SIZE, GLES31.GL_FLOAT, false, 0, mQuadTexture); |
231 | 231 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
232 | 232 |
|
233 |
DistortedRenderState.unuseStencilMark();
|
|
233 |
InternalRenderState.unuseStencilMark();
|
|
234 | 234 |
|
235 | 235 |
return 2; |
236 | 236 |
} |
... | ... | |
239 | 239 |
// PUBLIC API |
240 | 240 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
241 | 241 |
/** |
242 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
242 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
243 | 243 |
*/ |
244 | 244 |
public static void enable() |
245 | 245 |
{ |
246 | 246 |
final String blurVertex = |
247 | 247 |
|
248 |
Distorted.GLSL_VERSION + |
|
248 |
DistortedLibrary.GLSL_VERSION +
|
|
249 | 249 |
"precision lowp float; \n"+ |
250 | 250 |
"in vec2 a_Position; \n"+ |
251 | 251 |
"in vec2 a_TexCoord; \n"+ |
... | ... | |
261 | 261 |
|
262 | 262 |
final String blurFragment1 = |
263 | 263 |
|
264 |
Distorted.GLSL_VERSION + |
|
264 |
DistortedLibrary.GLSL_VERSION +
|
|
265 | 265 |
"#define MAX_BLUR "+MAX_HALO+ "\n"+ |
266 | 266 |
"precision lowp float; \n"+ |
267 | 267 |
"in vec2 v_TexCoord; \n"+ |
... | ... | |
284 | 284 |
|
285 | 285 |
final String blurFragment2 = |
286 | 286 |
|
287 |
Distorted.GLSL_VERSION + |
|
287 |
DistortedLibrary.GLSL_VERSION +
|
|
288 | 288 |
"#define MAX_BLUR "+MAX_HALO+ "\n"+ |
289 | 289 |
"precision lowp float; \n"+ |
290 | 290 |
"in vec2 v_TexCoord; \n"+ |
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
21 | 21 |
|
22 | 22 |
import android.opengl.GLES31; |
23 | 23 |
|
24 |
import org.distorted.library.main.Distorted; |
|
24 |
import org.distorted.library.main.DistortedLibrary;
|
|
25 | 25 |
import org.distorted.library.main.DistortedFramebuffer; |
26 |
import org.distorted.library.main.DistortedRenderState;
|
|
26 |
import org.distorted.library.main.InternalRenderState;
|
|
27 | 27 |
import org.distorted.library.program.DistortedProgram; |
28 | 28 |
import org.distorted.library.type.Data1D; |
29 | 29 |
import org.distorted.library.type.Data4D; |
... | ... | |
172 | 172 |
} |
173 | 173 |
} |
174 | 174 |
|
175 |
DistortedRenderState.useStencilMark();
|
|
175 |
InternalRenderState.useStencilMark();
|
|
176 | 176 |
|
177 | 177 |
buffer.setAsOutput(); |
178 | 178 |
|
... | ... | |
233 | 233 |
GLES31.glVertexAttribPointer(mProgram2.mAttribute[1], TEX_DATA_SIZE, GLES31.GL_FLOAT, false, 0, mQuadTexture); |
234 | 234 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
235 | 235 |
|
236 |
DistortedRenderState.unuseStencilMark();
|
|
236 |
InternalRenderState.unuseStencilMark();
|
|
237 | 237 |
|
238 | 238 |
return 2; |
239 | 239 |
} |
... | ... | |
242 | 242 |
// PUBLIC API |
243 | 243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
244 | 244 |
/** |
245 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
245 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
246 | 246 |
*/ |
247 | 247 |
public static void enable() |
248 | 248 |
{ |
249 | 249 |
final String glowVertex = |
250 | 250 |
|
251 |
Distorted.GLSL_VERSION + |
|
251 |
DistortedLibrary.GLSL_VERSION +
|
|
252 | 252 |
"precision lowp float; \n"+ |
253 | 253 |
"in vec2 a_Position; \n"+ |
254 | 254 |
"in vec2 a_TexCoord; \n"+ |
... | ... | |
264 | 264 |
|
265 | 265 |
final String glowFragment1 = |
266 | 266 |
|
267 |
Distorted.GLSL_VERSION + |
|
267 |
DistortedLibrary.GLSL_VERSION +
|
|
268 | 268 |
"#define MAX_BLUR "+MAX_HALO+ "\n"+ |
269 | 269 |
"precision lowp float; \n"+ |
270 | 270 |
"in vec2 v_TexCoord; \n"+ |
... | ... | |
287 | 287 |
|
288 | 288 |
final String glowFragment2 = |
289 | 289 |
|
290 |
Distorted.GLSL_VERSION + |
|
290 |
DistortedLibrary.GLSL_VERSION +
|
|
291 | 291 |
"#define MAX_BLUR "+MAX_HALO+ "\n"+ |
292 | 292 |
"precision lowp float; \n"+ |
293 | 293 |
"in vec2 v_TexCoord; \n"+ |
src/main/java/org/distorted/library/effect/VertexEffect.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
src/main/java/org/distorted/library/effect/VertexEffectDeform.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
99 | 99 |
// 0<=C<1 looks completely ridiculous and C<0 destroys the system. |
100 | 100 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
101 | 101 |
/** |
102 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
102 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
103 | 103 |
*/ |
104 | 104 |
public static void enable() |
105 | 105 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectDistort.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
119 | 119 |
// a = vx*nz-vz*nx , b = vy*nz-vz*ny , c = (vx*ny-vy*nx)/(1+nz) (unless n=(0,0,-1)) |
120 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
/** |
122 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
122 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
123 | 123 |
*/ |
124 | 124 |
public static void enable() |
125 | 125 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectPinch.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
65 | 65 |
// (where 'line' above passes through the center point and goes along the vector) |
66 | 66 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
67 | 67 |
/** |
68 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
68 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
69 | 69 |
*/ |
70 | 70 |
public static void enable() |
71 | 71 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectSink.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
54 | 54 |
// when h>1 we are pushing points away from S: P' = P + (1/h-1)*dist(S-P) |
55 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
56 | 56 |
/** |
57 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
57 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
58 | 58 |
*/ |
59 | 59 |
public static void enable() |
60 | 60 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectSwirl.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
63 | 63 |
// by (1-d) around the center of the effect S. |
64 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
65 | 65 |
/** |
66 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
66 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
67 | 67 |
*/ |
68 | 68 |
public static void enable() |
69 | 69 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectWave.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2017 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
... | ... | |
123 | 123 |
// Generally speaking I'd keep to amplitude < length, as the opposite case has some other problems as well. |
124 | 124 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 125 |
/** |
126 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
126 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
|
|
127 | 127 |
*/ |
128 | 128 |
public static void enable() |
129 | 129 |
{ |
src/main/java/org/distorted/library/effectqueue/EffectQueue.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effectqueue; |
... | ... | |
22 | 22 |
import org.distorted.library.effect.Effect; |
23 | 23 |
import org.distorted.library.effect.EffectName; |
24 | 24 |
import org.distorted.library.effect.EffectType; |
25 |
import org.distorted.library.main.Distorted; |
|
26 |
import org.distorted.library.main.DistortedMaster;
|
|
25 |
import org.distorted.library.main.DistortedLibrary;
|
|
26 |
import org.distorted.library.main.InternalMaster;
|
|
27 | 27 |
import org.distorted.library.message.EffectListener; |
28 | 28 |
import org.distorted.library.message.EffectMessage; |
29 | 29 |
import org.distorted.library.message.EffectMessageSender; |
... | ... | |
37 | 37 |
* |
38 | 38 |
* @y.exclude |
39 | 39 |
*/ |
40 |
public abstract class EffectQueue implements DistortedMaster.Slave
|
|
40 |
public abstract class EffectQueue implements InternalMaster.Slave
|
|
41 | 41 |
{ |
42 | 42 |
static final int MAIN_VARIANTS = 3; // Number of Main program variants (ATM 3: MAIN, MAIN OIT, PREPROCESS) |
43 | 43 |
|
... | ... | |
100 | 100 |
mIndex = index; |
101 | 101 |
|
102 | 102 |
mJobs.add(new Job(CREATE,numUniforms,false,null)); // create the stuff that depends on max number |
103 |
DistortedMaster.newSlave(this); // of uniforms later, on first render.
|
|
103 |
InternalMaster.newSlave(this); // of uniforms later, on first render.
|
|
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
107 | 107 |
|
108 | 108 |
public static void allocateQueues(EffectQueue[] queues, EffectQueue[] from, int flags, long id) |
109 | 109 |
{ |
110 |
queues[0] = (flags & Distorted.CLONE_MATRIX ) != 0 ? from[0] : new EffectQueueMatrix(id); |
|
111 |
queues[1] = (flags & Distorted.CLONE_VERTEX ) != 0 ? from[1] : new EffectQueueVertex(id); |
|
112 |
queues[2] = (flags & Distorted.CLONE_FRAGMENT ) != 0 ? from[2] : new EffectQueueFragment(id); |
|
113 |
queues[3] = (flags & Distorted.CLONE_POSTPROCESS) != 0 ? from[3] : new EffectQueuePostprocess(id); |
|
110 |
queues[0] = (flags & DistortedLibrary.CLONE_MATRIX ) != 0 ? from[0] : new EffectQueueMatrix(id);
|
|
111 |
queues[1] = (flags & DistortedLibrary.CLONE_VERTEX ) != 0 ? from[1] : new EffectQueueVertex(id);
|
|
112 |
queues[2] = (flags & DistortedLibrary.CLONE_FRAGMENT ) != 0 ? from[2] : new EffectQueueFragment(id);
|
|
113 |
queues[3] = (flags & DistortedLibrary.CLONE_POSTPROCESS) != 0 ? from[3] : new EffectQueuePostprocess(id);
|
|
114 | 114 |
} |
115 | 115 |
|
116 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
189 | 189 |
|
190 | 190 |
public static boolean setMax(int index, int m) |
191 | 191 |
{ |
192 |
if( !Distorted.isInitialized() || m<=mMax[index] ) |
|
192 |
if( !DistortedLibrary.isInitialized() || m<=mMax[index] )
|
|
193 | 193 |
{ |
194 | 194 |
mMax[index] = m<0 ? 0:m; |
195 | 195 |
return true; |
... | ... | |
276 | 276 |
|
277 | 277 |
if( ret>0 ) |
278 | 278 |
{ |
279 |
DistortedMaster.newSlave(this);
|
|
279 |
InternalMaster.newSlave(this);
|
|
280 | 280 |
mNumEffectsToBe-=ret; |
281 | 281 |
} |
282 | 282 |
|
... | ... | |
292 | 292 |
if( mEffects[i].getID() == id ) |
293 | 293 |
{ |
294 | 294 |
mJobs.add(new Job(DETACH,0,true,mEffects[i])); |
295 |
DistortedMaster.newSlave(this);
|
|
295 |
InternalMaster.newSlave(this);
|
|
296 | 296 |
mNumEffectsToBe--; |
297 | 297 |
return 1; |
298 | 298 |
} |
... | ... | |
310 | 310 |
if( mEffects[i]==effect ) |
311 | 311 |
{ |
312 | 312 |
mJobs.add(new Job(DETACH,0,true,mEffects[i])); |
313 |
DistortedMaster.newSlave(this);
|
|
313 |
InternalMaster.newSlave(this);
|
|
314 | 314 |
mNumEffectsToBe--; |
315 | 315 |
return 1; |
316 | 316 |
} |
... | ... | |
326 | 326 |
public synchronized int abortAll(boolean notify) |
327 | 327 |
{ |
328 | 328 |
mJobs.add(new Job(DETALL,0,notify,null)); |
329 |
DistortedMaster.newSlave(this);
|
|
329 |
InternalMaster.newSlave(this);
|
|
330 | 330 |
mNumEffectsToBe = 0; |
331 | 331 |
return mNumEffects; |
332 | 332 |
} |
... | ... | |
338 | 338 |
if( mMax[mIndex]>mNumEffectsToBe || !mCreated ) |
339 | 339 |
{ |
340 | 340 |
mJobs.add(new Job(ATTACH,0,false,effect)); |
341 |
DistortedMaster.newSlave(this);
|
|
341 |
InternalMaster.newSlave(this);
|
|
342 | 342 |
mNumEffectsToBe++; |
343 | 343 |
return true; |
344 | 344 |
} |
src/main/java/org/distorted/library/effectqueue/EffectQueueFragment.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effectqueue; |
src/main/java/org/distorted/library/effectqueue/EffectQueueMatrix.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effectqueue; |
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effectqueue; |
... | ... | |
27 | 27 |
import org.distorted.library.effect.EffectType; |
28 | 28 |
import org.distorted.library.effect.PostprocessEffect; |
29 | 29 |
import org.distorted.library.effect.VertexEffect; |
30 |
import org.distorted.library.main.Distorted; |
|
30 |
import org.distorted.library.main.DistortedLibrary;
|
|
31 | 31 |
import org.distorted.library.main.DistortedFramebuffer; |
32 | 32 |
import org.distorted.library.main.DistortedNode; |
33 |
import org.distorted.library.main.DistortedOutputSurface;
|
|
34 |
import org.distorted.library.main.DistortedRenderState;
|
|
35 |
import org.distorted.library.main.DistortedSurface;
|
|
33 |
import org.distorted.library.main.InternalOutputSurface;
|
|
34 |
import org.distorted.library.main.InternalRenderState;
|
|
35 |
import org.distorted.library.main.InternalSurface;
|
|
36 | 36 |
import org.distorted.library.mesh.MeshBase; |
37 | 37 |
import org.distorted.library.message.EffectMessage; |
38 | 38 |
import org.distorted.library.message.EffectMessageSender; |
... | ... | |
117 | 117 |
|
118 | 118 |
int numV = VertexEffect.getNumEnabled(); |
119 | 119 |
|
120 |
String mainVertHeader= Distorted.GLSL_VERSION + ("#define NUM_VERTEX " + ( numV>0 ? Distorted.getMax(EffectType.VERTEX ) : 0 ) + "\n");
|
|
121 |
String mainFragHeader= Distorted.GLSL_VERSION + "\n"; |
|
120 |
String mainVertHeader= DistortedLibrary.GLSL_VERSION + ("#define NUM_VERTEX " + ( numV>0 ? DistortedLibrary.getMax(EffectType.VERTEX ) : 0 ) + "\n");
|
|
121 |
String mainFragHeader= DistortedLibrary.GLSL_VERSION + "\n";
|
|
122 | 122 |
|
123 | 123 |
String enabledEffectV= VertexEffect.getGLSL(); |
124 | 124 |
|
125 | 125 |
try |
126 | 126 |
{ |
127 | 127 |
mPreProgram = new DistortedProgram(mainVertStream, mainFragStream, mainVertHeader, mainFragHeader, |
128 |
enabledEffectV, null, Distorted.GLSL, null); |
|
128 |
enabledEffectV, null, DistortedLibrary.GLSL, null);
|
|
129 | 129 |
} |
130 | 130 |
catch(Exception e) |
131 | 131 |
{ |
... | ... | |
158 | 158 |
|
159 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
160 | 160 |
|
161 |
public int preprocess(DistortedOutputSurface buffer, DistortedNode node, float distance, float mipmap, float[] projection)
|
|
161 |
public int preprocess(InternalOutputSurface buffer, DistortedNode node, float distance, float mipmap, float[] projection)
|
|
162 | 162 |
{ |
163 | 163 |
buffer.setAsOutput(); |
164 |
DistortedSurface input = node.getInternalSurface();
|
|
164 |
InternalSurface input = node.getInternalSurface();
|
|
165 | 165 |
|
166 | 166 |
if( input.setAsInput() ) |
167 | 167 |
{ |
... | ... | |
174 | 174 |
int width = buffer.getWidth(); |
175 | 175 |
int height = buffer.getHeight(); |
176 | 176 |
|
177 |
DistortedRenderState.setUpStencilMark(mA!=0.0f);
|
|
178 |
DistortedRenderState.disableBlending();
|
|
177 |
InternalRenderState.setUpStencilMark(mA!=0.0f);
|
|
178 |
InternalRenderState.disableBlending();
|
|
179 | 179 |
|
180 | 180 |
GLES31.glViewport(0, 0, width, height ); |
181 | 181 |
|
... | ... | |
206 | 206 |
|
207 | 207 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() ); |
208 | 208 |
|
209 |
DistortedRenderState.restoreBlending();
|
|
210 |
DistortedRenderState.unsetUpStencilMark();
|
|
209 |
InternalRenderState.restoreBlending();
|
|
210 |
InternalRenderState.unsetUpStencilMark();
|
|
211 | 211 |
|
212 | 212 |
return 1; |
213 | 213 |
} |
src/main/java/org/distorted/library/effectqueue/EffectQueueVertex.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 | 2 |
// Copyright 2016 Leszek Koltunski // |
3 | 3 |
// // |
4 |
// This file is part of Distorted. // |
|
4 |
// This file is part of DistortedLibrary. //
|
|
5 | 5 |
// // |
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
6 |
// DistortedLibrary is free software: you can redistribute it and/or modify //
|
|
7 | 7 |
// it under the terms of the GNU General Public License as published by // |
8 | 8 |
// the Free Software Foundation, either version 2 of the License, or // |
9 | 9 |
// (at your option) any later version. // |
10 | 10 |
// // |
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
11 |
// DistortedLibrary is distributed in the hope that it will be useful, //
|
|
12 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
13 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
14 | 14 |
// GNU General Public License for more details. // |
15 | 15 |
// // |
16 | 16 |
// You should have received a copy of the GNU General Public License // |
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
17 |
// along with DistortedLibrary. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
|
20 | 20 |
package org.distorted.library.effectqueue; |
src/main/java/org/distorted/library/main/Distorted.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2016 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.library.main; |
|
21 |
|
|
22 |
import android.app.ActivityManager; |
|
23 |
import android.content.Context; |
|
24 |
import android.content.pm.ConfigurationInfo; |
|
25 |
import android.content.res.Resources; |
|
26 |
import android.opengl.GLES31; |
|
27 |
import android.util.Log; |
|
28 |
|
|
29 |
import org.distorted.library.R; |
|
30 |
import org.distorted.library.effect.Effect; |
|
31 |
import org.distorted.library.effectqueue.EffectQueue; |
|
32 |
import org.distorted.library.effectqueue.EffectQueuePostprocess; |
|
33 |
import org.distorted.library.effect.EffectType; |
|
34 |
import org.distorted.library.effect.FragmentEffect; |
|
35 |
import org.distorted.library.effect.PostprocessEffect; |
|
36 |
import org.distorted.library.effect.VertexEffect; |
|
37 |
import org.distorted.library.mesh.MeshBase; |
|
38 |
import org.distorted.library.message.EffectMessageSender; |
|
39 |
import org.distorted.library.program.DistortedProgram; |
|
40 |
|
|
41 |
import java.io.InputStream; |
|
42 |
import java.nio.ByteBuffer; |
|
43 |
import java.nio.ByteOrder; |
|
44 |
import java.nio.FloatBuffer; |
|
45 |
import java.nio.IntBuffer; |
|
46 |
|
|
47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
48 |
/** |
|
49 |
* A singleton class used to control various global settings. |
|
50 |
*/ |
|
51 |
public class Distorted |
|
52 |
{ |
|
53 |
public static final int GLSL = 310; |
|
54 |
public static final String GLSL_VERSION= "#version 310 es\n"; |
|
55 |
/** |
|
56 |
* When creating an instance of a DistortedTexture from another instance, clone the Bitmap that's |
|
57 |
* backing up our DistortedTexture. |
|
58 |
* <p> |
|
59 |
* This way we can have two DistortedTextures, both backed up by the same Bitmap, to which we can |
|
60 |
* apply different effects. Used in the copy constructor. |
|
61 |
*/ |
|
62 |
public static final int CLONE_SURFACE = 0x1; |
|
63 |
/** |
|
64 |
* When creating an instance of a DistortedEffects from another instance, clone the Matrix Effects. |
|
65 |
* <p> |
|
66 |
* This way we can have two different DistortedEffects sharing the MATRIX queue. |
|
67 |
*/ |
|
68 |
public static final int CLONE_MATRIX = 0x2; |
|
69 |
/** |
|
70 |
* When creating an instance of a DistortedEffects from another instance, clone the Vertex Effects. |
|
71 |
* <p> |
|
72 |
* This way we can have two different DistortedEffects sharing the VERTEX queue. |
|
73 |
*/ |
|
74 |
public static final int CLONE_VERTEX = 0x4; |
|
75 |
/** |
|
76 |
* When creating an instance of a DistortedEffects from another instance, clone the Fragment Effects. |
|
77 |
* <p> |
|
78 |
* This way we can have two different DistortedEffects sharing the FRAGMENT queue. |
|
79 |
*/ |
|
80 |
public static final int CLONE_FRAGMENT= 0x8; |
|
81 |
/** |
|
82 |
* When creating an instance of a DistortedEffects from another instance, clone the PostProcess Effects. |
|
83 |
* <p> |
|
84 |
* This way we can have two different DistortedEffects sharing the POSTPROCESS queue. |
|
85 |
*/ |
|
86 |
public static final int CLONE_POSTPROCESS= 0x10; |
|
87 |
/** |
|
88 |
* When creating an instance of a DistortedNode from another instance, clone the children Nodes. |
|
89 |
* <p> |
|
90 |
* This is mainly useful for creating many similar sub-trees and rendering then at different places |
|
91 |
* on the screen with (optionally) different Effects. |
|
92 |
*/ |
|
93 |
public static final int CLONE_CHILDREN= 0x20; |
|
94 |
|
|
95 |
/** |
|
96 |
* Work around bugs in ARM Mali driver by, instead to a single FBO, rendering to a circular queue |
|
97 |
* of FBO_QUEUE_SIZE FBOs. (otherwise we sometimes get a 'full pipeline flush' and the end result |
|
98 |
* might be missing part of the Objects) |
|
99 |
* |
|
100 |
* This bug only exists on Mali driver r12. |
|
101 |
* |
|
102 |
* https://community.arm.com/graphics/f/discussions/10285/opengl-es-3-1-on-mali-t880-flashes |
|
103 |
*/ |
|
104 |
static final int FBO_QUEUE_SIZE = 4; |
|
105 |
|
|
106 |
private static boolean mInitialized=false; |
|
107 |
|
|
108 |
////////////////////////////////////////////////////////////////////////////////////////////// |
|
109 |
/// MAIN PROGRAM /// |
|
110 |
private static DistortedProgram mMainProgram; |
|
111 |
private static int mMainTextureH; |
|
112 |
|
|
113 |
/// NORMAL PROGRAM ///// |
|
114 |
private static DistortedProgram mNormalProgram; |
|
115 |
private static int mNormalMVPMatrixH; |
|
116 |
|
|
117 |
/// MAIN OIT PROGRAM /// |
|
118 |
private static DistortedProgram mMainOITProgram; |
|
119 |
private static int mMainOITTextureH; |
|
120 |
private static int mMainOITSizeH; |
|
121 |
private static int mMainOITNumRecordsH; |
|
122 |
|
|
123 |
/// BLIT PROGRAM /// |
|
124 |
private static DistortedProgram mBlitProgram; |
|
125 |
private static int mBlitTextureH; |
|
126 |
private static int mBlitDepthH; |
|
127 |
private static final FloatBuffer mQuadPositions; |
|
128 |
|
|
129 |
static |
|
130 |
{ |
|
131 |
float[] positionData= { -0.5f, -0.5f, -0.5f, 0.5f, 0.5f,-0.5f, 0.5f, 0.5f }; |
|
132 |
mQuadPositions = ByteBuffer.allocateDirect(32).order(ByteOrder.nativeOrder()).asFloatBuffer(); |
|
133 |
mQuadPositions.put(positionData).position(0); |
|
134 |
} |
|
135 |
|
|
136 |
/// BLIT DEPTH PROGRAM /// |
|
137 |
private static DistortedProgram mBlitDepthProgram; |
|
138 |
private static int mBlitDepthTextureH; |
|
139 |
private static int mBlitDepthDepthTextureH; |
|
140 |
private static int mBlitDepthDepthH; |
|
141 |
private static int mBlitDepthTexCorrH; |
|
142 |
|
|
143 |
/// OIT SSBO BUFFER /// |
|
144 |
private static int[] mLinkedListSSBO = new int[1]; |
|
145 |
private static int[] mAtomicCounter = new int[Distorted.FBO_QUEUE_SIZE]; |
|
146 |
private static int mCurrBuffer; |
|
147 |
|
|
148 |
static |
|
149 |
{ |
|
150 |
mLinkedListSSBO[0]= -1; |
|
151 |
mCurrBuffer = 0; |
|
152 |
|
|
153 |
for(int i=0; i<Distorted.FBO_QUEUE_SIZE; i++) mAtomicCounter[i] = -1; |
|
154 |
} |
|
155 |
|
|
156 |
/////////////////////////////////////////////////////////////// |
|
157 |
// meaning: allocate 1.0 screenful of places for transparent |
|
158 |
// fragments in the SSBO backing up the OIT render method. |
|
159 |
private static float mBufferSize=1.0f; |
|
160 |
|
|
161 |
/// OIT CLEAR PROGRAM /// |
|
162 |
private static DistortedProgram mOITClearProgram; |
|
163 |
private static int mOITClearDepthH; |
|
164 |
private static int mOITClearTexCorrH; |
|
165 |
private static int mOITClearSizeH; |
|
166 |
|
|
167 |
/// OIT BUILD PROGRAM /// |
|
168 |
private static DistortedProgram mOITBuildProgram; |
|
169 |
private static int mOITBuildTextureH; |
|
170 |
private static int mOITBuildDepthTextureH; |
|
171 |
private static int mOITBuildDepthH; |
|
172 |
private static int mOITBuildTexCorrH; |
Also available in: Unified diff
Rename all the classes that are not exported to application to 'Internal'