Project

General

Profile

« Previous | Next » 

Revision 39fb9047

Added by Leszek Koltunski over 5 years ago

Enhance the TRANSPARENCY effect with a Wave.

View differences:

distorted-cube.iml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<module external.linked.project.id=":distorted-cube" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3
  <component name="FacetManager">
4
    <facet type="android-gradle" name="Android-Gradle">
5
      <configuration>
6
        <option name="GRADLE_PROJECT_PATH" value=":distorted-cube" />
7
      </configuration>
8
    </facet>
9
    <facet type="android" name="Android">
10
      <configuration>
11
        <option name="SELECTED_BUILD_VARIANT" value="debug" />
12
        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
13
        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
14
        <afterSyncTasks>
15
          <task>generateDebugSources</task>
16
        </afterSyncTasks>
17
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
18
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
19
        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
20
        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
21
        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
22
        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
23
      </configuration>
24
    </facet>
25
  </component>
26
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
27
    <output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
28
    <output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
29
    <exclude-output />
30
    <content url="file://$MODULE_DIR$">
31
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
32
      <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
33
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
34
      <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
35
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
36
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
37
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
38
      <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
39
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
40
      <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
41
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
42
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
43
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
44
      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
45
      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
46
      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
47
      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
48
      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
49
      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
50
      <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
51
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
52
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
53
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
54
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
55
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
56
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
57
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
58
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
59
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
60
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
61
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
62
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
63
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
64
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
65
      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
66
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
67
      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
68
      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
69
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
70
      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
71
      <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
72
      <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
73
      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
74
      <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
75
      <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
76
      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
77
      <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
78
      <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
79
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
80
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
81
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
82
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
83
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
84
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
85
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
86
      <excludeFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources" />
87
      <excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" />
88
      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
89
      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
90
    </content>
91
    <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
92
    <orderEntry type="sourceFolder" forTests="false" />
93
    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:27.1.1@aar" level="project" />
94
    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:1.1.0@aar" level="project" />
95
    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils:27.1.1@aar" level="project" />
96
    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:1.1.0@aar" level="project" />
97
    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.0@jar" level="project" />
98
    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
99
    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:1.1.0@aar" level="project" />
100
    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui:27.1.1@aar" level="project" />
101
    <orderEntry type="library" name="Gradle: com.android.support:support-compat:27.1.1@aar" level="project" />
102
    <orderEntry type="library" name="Gradle: android.arch.core:runtime:1.1.0@aar" level="project" />
103
    <orderEntry type="library" name="Gradle: com.android.support:support-fragment:27.1.1@aar" level="project" />
104
    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:27.1.1@aar" level="project" />
105
    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:27.1.1@aar" level="project" />
106
    <orderEntry type="library" name="Gradle: android.arch.core:common:1.1.0@jar" level="project" />
107
    <orderEntry type="module" module-name="distorted-library" />
108
    <orderEntry type="module" module-name="distorted-library" />
109
    <orderEntry type="module" module-name="distorted-library" />
110
    <orderEntry type="module" module-name="distorted-library" />
111
    <orderEntry type="module" module-name="distorted-library" />
112
    <orderEntry type="module" module-name="distorted-library" />
113
    <orderEntry type="module" module-name="distorted-library" />
114
    <orderEntry type="module" module-name="distorted-library" />
115
    <orderEntry type="module" module-name="distorted-library" />
116
    <orderEntry type="module" module-name="distorted-library" />
117
  </component>
118
</module>
src/main/java/org/distorted/effect/AppearEffectTransparency.java
21 21

  
22 22
import org.distorted.library.effect.Effect;
23 23
import org.distorted.library.effect.FragmentEffectAlpha;
24
import org.distorted.library.effect.VertexEffectWave;
24 25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Dynamic5D;
25 27
import org.distorted.library.type.Static1D;
28
import org.distorted.library.type.Static3D;
29
import org.distorted.library.type.Static5D;
26 30

  
27 31
///////////////////////////////////////////////////////////////////////////////////////////////////
28 32

  
......
38 42
    d0.add(new Static1D(1.0f));
39 43
    mCubeEffects[0] = new FragmentEffectAlpha(d0);
40 44

  
41
    return 1;
45
    mNodeEffectPosition = new int[] {-1};
46
    mNodeEffects        = new Effect[mNodeEffectPosition.length];
47

  
48
    int w = mScreen.getWidth();
49
    int h = mScreen.getHeight();
50
    int min = w<h ? w:h;
51

  
52
    float init_amplitude = min/15.0f;
53
    float end_amplitude  = 0.0f;
54
    float length         = min/15.0f;
55
    float init_phase     = 0.0f;
56
    float end_phase      = 360.0f;
57
    float alpha          = 30.0f;
58
    float beta           = 90.0f;
59

  
60
    Dynamic5D d1 = new Dynamic5D(duration, 0.5f);
61
    d1.add(new Static5D( init_amplitude, length, init_phase, alpha, beta) );
62
    d1.add(new Static5D( end_amplitude , length, end_phase , alpha, beta) );
63
    Static3D center = new Static3D(min*0.5f,min*0.5f,0);
64
    mNodeEffects[0] = new VertexEffectWave(d1, center, null);
65

  
66
    return 2;
42 67
    }
43 68

  
44 69
///////////////////////////////////////////////////////////////////////////////////////////////////
......
48 73
  static void enable()
49 74
    {
50 75
    FragmentEffectAlpha.enable();
76
    VertexEffectWave.enable();
51 77
    }
52 78
  }
src/main/java/org/distorted/effect/DisappearEffectTransparency.java
21 21

  
22 22
import org.distorted.library.effect.Effect;
23 23
import org.distorted.library.effect.FragmentEffectAlpha;
24
import org.distorted.library.effect.VertexEffectWave;
24 25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Dynamic5D;
25 27
import org.distorted.library.type.Static1D;
28
import org.distorted.library.type.Static3D;
29
import org.distorted.library.type.Static5D;
26 30

  
27 31
///////////////////////////////////////////////////////////////////////////////////////////////////
28 32

  
......
38 42
    d0.add(new Static1D(0.0f));
39 43
    mCubeEffects[0] = new FragmentEffectAlpha(d0);
40 44

  
41
    return 1;
45
    mNodeEffectPosition = new int[] {-1};
46
    mNodeEffects        = new Effect[mNodeEffectPosition.length];
47

  
48
    int w = mScreen.getWidth();
49
    int h = mScreen.getHeight();
50
    int min = w<h ? w:h;
51

  
52
    float init_amplitude = 0.0f;
53
    float end_amplitude  = min/15.0f;
54
    float length         = min/15.0f;
55
    float init_phase     = 360.0f;
56
    float end_phase      = 0.0f;
57
    float alpha          = 30.0f;
58
    float beta           = 90.0f;
59

  
60
    Dynamic5D d1 = new Dynamic5D(duration, 0.5f);
61
    d1.add(new Static5D( init_amplitude, length, init_phase, alpha, beta) );
62
    d1.add(new Static5D( end_amplitude , length, end_phase , alpha, beta) );
63
    Static3D center = new Static3D(min*0.5f,min*0.5f,0);
64
    mNodeEffects[0] = new VertexEffectWave(d1, center, null);
65

  
66
    return 2;
42 67
    }
43 68

  
44 69
///////////////////////////////////////////////////////////////////////////////////////////////////
......
48 73
  static void enable()
49 74
    {
50 75
    FragmentEffectAlpha.enable();
76
    VertexEffectWave.enable();
51 77
    }
52 78
  }
src/main/java/org/distorted/magic/RubikCube.java
34 34
import org.distorted.library.main.DistortedNode;
35 35
import org.distorted.library.main.DistortedTexture;
36 36
import org.distorted.library.mesh.MeshCubes;
37
import org.distorted.library.mesh.MeshQuad;
37
import org.distorted.library.mesh.MeshFlat;
38 38
import org.distorted.library.message.EffectListener;
39 39
import org.distorted.library.type.Dynamic1D;
40 40
import org.distorted.library.type.Static1D;
......
71 71

  
72 72
///////////////////////////////////////////////////////////////////////////////////////////////////
73 73

  
74
    RubikCube(int size, Static4D quatC, Static4D quatA, DistortedTexture texture, MeshQuad mesh, DistortedEffects effects)
74
    RubikCube(int size, Static4D quatC, Static4D quatA, DistortedTexture texture, MeshFlat mesh, DistortedEffects effects)
75 75
      {
76 76
      super(texture,effects,mesh);
77 77

  
src/main/java/org/distorted/magic/RubikRenderer.java
28 28
import org.distorted.library.main.DistortedLibrary;
29 29
import org.distorted.library.main.DistortedScreen;
30 30
import org.distorted.library.main.DistortedTexture;
31
import org.distorted.library.mesh.MeshQuad;
31
import org.distorted.library.mesh.MeshFlat;
32 32
import org.distorted.library.message.EffectListener;
33 33
import org.distorted.library.type.Static4D;
34 34

  
......
54 54
    private boolean mCanRotate, mCanDrag;
55 55
    private RubikCube mOldCube, mNewCube;
56 56
    private int mScreenWidth, mScreenHeight;
57
    private MeshQuad mMesh;
57
    private MeshFlat mMesh;
58 58
    private AppearEffect.Type mAppearType;
59 59
    private DisappearEffect.Type mDisappearType;
60 60
    private int mAppearDuration, mDisappearDuration;
......
90 90
      mAppearDuration    = 1000;
91 91
      mDisappearDuration = 1000;
92 92

  
93
      mMesh= new MeshQuad();
93
      mMesh= new MeshFlat(20,20);
94 94
      mNextCubeSize =RubikActivity.getSize();
95 95
      }
96 96

  

Also available in: Unified diff