repo_name
stringclasses 5
values | pr_number
int64 1.52k
15.5k
| pr_title
stringlengths 8
143
| pr_description
stringlengths 0
10.2k
| author
stringlengths 3
18
| date_created
unknown | date_merged
unknown | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 11
10.2k
| filepath
stringlengths 6
220
| before_content
stringlengths 0
597M
| after_content
stringlengths 0
597M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/conformance/DisplayModeTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.conformance;
import java.util.Arrays;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics.DisplayMode;
import com.badlogic.gdx.tests.utils.GdxTest;
public class DisplayModeTest extends GdxTest {
@Override
public void create () {
DisplayMode displayMode = Gdx.graphics.getDisplayMode();
DisplayMode displayModeForMonitor = Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor());
DisplayMode[] displayModes = Gdx.graphics.getDisplayModes();
DisplayMode[] displayModesForMonitor = Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor());
Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode() ) : " + displayMode);
Gdx.app.log("DisplayModeTest",
"Display mode (using Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor()) ) : " + Arrays.toString(displayModes));
Gdx.app.log("DisplayModeTest",
"Display mode (using Gdx.graphics.getDisplayModes() ) : " + Arrays.toString(displayModesForMonitor));
Gdx.app.log("DisplayModeTest",
"Display mode (using Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor()) ): " + displayModeForMonitor);
assertDisplayModeEquals(displayMode, displayModeForMonitor);
assertDisplayModesEquals(displayModes, displayModesForMonitor);
}
void assertDisplayModesEquals (DisplayMode[] a, DisplayMode[] b) {
if (a.length == 0 || b.length == 0) throw new AssertionError("Argument a or b can't be a zero length array");
if (a.length != b.length) {
throw new AssertionError("Display modes " + Arrays.toString(a) + " aren't equal to display modes " + Arrays.toString(b));
}
boolean equal = true;
for (int i = 0; i < a.length; i++) {
equal = equal && isDisplayModeEqual(a[i], b[i]);
}
if (!equal) {
throw new AssertionError("Display modes " + Arrays.toString(a) + " aren't equal to display modes " + Arrays.toString(b));
}
}
void assertDisplayModeEquals (DisplayMode a, DisplayMode b) {
if (!isDisplayModeEqual(a, b)) {
throw new AssertionError(a + " isn't equal to " + b);
}
}
boolean isDisplayModeEqual (DisplayMode a, DisplayMode b) {
if (a == null || b == null) return false;
boolean equal = a.bitsPerPixel == b.bitsPerPixel && a.height == b.height && a.refreshRate == b.refreshRate
&& a.width == b.width;
return equal;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.conformance;
import java.util.Arrays;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics.DisplayMode;
import com.badlogic.gdx.tests.utils.GdxTest;
public class DisplayModeTest extends GdxTest {
@Override
public void create () {
DisplayMode displayMode = Gdx.graphics.getDisplayMode();
DisplayMode displayModeForMonitor = Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor());
DisplayMode[] displayModes = Gdx.graphics.getDisplayModes();
DisplayMode[] displayModesForMonitor = Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor());
Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode() ) : " + displayMode);
Gdx.app.log("DisplayModeTest",
"Display mode (using Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor()) ) : " + Arrays.toString(displayModes));
Gdx.app.log("DisplayModeTest",
"Display mode (using Gdx.graphics.getDisplayModes() ) : " + Arrays.toString(displayModesForMonitor));
Gdx.app.log("DisplayModeTest",
"Display mode (using Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor()) ): " + displayModeForMonitor);
assertDisplayModeEquals(displayMode, displayModeForMonitor);
assertDisplayModesEquals(displayModes, displayModesForMonitor);
}
void assertDisplayModesEquals (DisplayMode[] a, DisplayMode[] b) {
if (a.length == 0 || b.length == 0) throw new AssertionError("Argument a or b can't be a zero length array");
if (a.length != b.length) {
throw new AssertionError("Display modes " + Arrays.toString(a) + " aren't equal to display modes " + Arrays.toString(b));
}
boolean equal = true;
for (int i = 0; i < a.length; i++) {
equal = equal && isDisplayModeEqual(a[i], b[i]);
}
if (!equal) {
throw new AssertionError("Display modes " + Arrays.toString(a) + " aren't equal to display modes " + Arrays.toString(b));
}
}
void assertDisplayModeEquals (DisplayMode a, DisplayMode b) {
if (!isDisplayModeEqual(a, b)) {
throw new AssertionError(a + " isn't equal to " + b);
}
}
boolean isDisplayModeEqual (DisplayMode a, DisplayMode b) {
if (a == null || b == null) return false;
boolean equal = a.bitsPerPixel == b.bitsPerPixel && a.height == b.height && a.refreshRate == b.refreshRate
&& a.width == b.width;
return equal;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests-android/src/com/badlogic/gdx/tests/android/FragmentTestStarter.java |
package com.badlogic.gdx.tests.android;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.badlogic.gdx.backends.android.AndroidFragmentApplication;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.GdxTests;
public class FragmentTestStarter extends FragmentActivity implements AndroidFragmentApplication.Callbacks {
FrameLayout list;
FrameLayout view;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GdxTests.tests.add(MatrixTest.class);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.HORIZONTAL);
list = new FrameLayout(this);
list.setId(R.id.framelayout);
list.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
layout.addView(list);
list.setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
view = new FrameLayout(this);
view.setId(R.id.viewlayout);
view.setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 2));
layout.addView(view);
setContentView(layout);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.framelayout, new TestListFragment()).commit();
}
}
public void onTestSelected (String testName) {
if (view != null) {
getSupportFragmentManager().beginTransaction().replace(R.id.viewlayout, TestViewFragment.newInstance(testName)).commit();
} else {
startActivity(new Intent(this, GdxTestActivity.class).putExtra("test", testName));
}
}
@Override
public void exit () {
}
public static class TestListFragment extends ListFragment {
private SharedPreferences prefs;
private FragmentTestStarter activity;
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<String> testNames = GdxTests.getNames();
setListAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, testNames));
prefs = getActivity().getSharedPreferences("libgdx-tests", Context.MODE_PRIVATE);
}
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
((ListView)view.findViewById(android.R.id.list)).setSelectionFromTop(prefs.getInt("index", 0), prefs.getInt("top", 0));
return view;
}
@Override
public void onListItemClick (ListView listView, View view, int position, long id) {
super.onListItemClick(listView, view, position, id);
Object o = this.getListAdapter().getItem(position);
String testName = o.toString();
if (activity != null) {
activity.onTestSelected(testName);
}
}
@Override
public void onAttach (Activity activity) {
super.onAttach(activity);
if (activity instanceof FragmentTestStarter) {
this.activity = (FragmentTestStarter)activity;
}
}
}
public static class TestViewFragment extends AndroidFragmentApplication {
public static TestViewFragment newInstance (String testName) {
Bundle arguments = new Bundle();
arguments.putString("test", testName);
TestViewFragment fragment = new TestViewFragment();
fragment.setArguments(arguments);
return fragment;
}
GdxTest test;
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
test = GdxTests.newTest(getArguments().getString("test"));
}
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useImmersiveMode = true;
return initializeForView(test, config);
}
}
}
|
package com.badlogic.gdx.tests.android;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.badlogic.gdx.backends.android.AndroidFragmentApplication;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.GdxTests;
public class FragmentTestStarter extends FragmentActivity implements AndroidFragmentApplication.Callbacks {
FrameLayout list;
FrameLayout view;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GdxTests.tests.add(MatrixTest.class);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.HORIZONTAL);
list = new FrameLayout(this);
list.setId(R.id.framelayout);
list.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
layout.addView(list);
list.setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
view = new FrameLayout(this);
view.setId(R.id.viewlayout);
view.setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 2));
layout.addView(view);
setContentView(layout);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.framelayout, new TestListFragment()).commit();
}
}
public void onTestSelected (String testName) {
if (view != null) {
getSupportFragmentManager().beginTransaction().replace(R.id.viewlayout, TestViewFragment.newInstance(testName)).commit();
} else {
startActivity(new Intent(this, GdxTestActivity.class).putExtra("test", testName));
}
}
@Override
public void exit () {
}
public static class TestListFragment extends ListFragment {
private SharedPreferences prefs;
private FragmentTestStarter activity;
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<String> testNames = GdxTests.getNames();
setListAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, testNames));
prefs = getActivity().getSharedPreferences("libgdx-tests", Context.MODE_PRIVATE);
}
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
((ListView)view.findViewById(android.R.id.list)).setSelectionFromTop(prefs.getInt("index", 0), prefs.getInt("top", 0));
return view;
}
@Override
public void onListItemClick (ListView listView, View view, int position, long id) {
super.onListItemClick(listView, view, position, id);
Object o = this.getListAdapter().getItem(position);
String testName = o.toString();
if (activity != null) {
activity.onTestSelected(testName);
}
}
@Override
public void onAttach (Activity activity) {
super.onAttach(activity);
if (activity instanceof FragmentTestStarter) {
this.activity = (FragmentTestStarter)activity;
}
}
}
public static class TestViewFragment extends AndroidFragmentApplication {
public static TestViewFragment newInstance (String testName) {
Bundle arguments = new Bundle();
arguments.putString("test", testName);
TestViewFragment fragment = new TestViewFragment();
fragment.setArguments(arguments);
return fragment;
}
GdxTest test;
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
test = GdxTests.newTest(getArguments().getString("test"));
}
@Override
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useImmersiveMode = true;
return initializeForView(test, config);
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/g3d/utils/shapebuilders/ConeShapeBuilder.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.utils.shapebuilders;
import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder;
import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder.VertexInfo;
import com.badlogic.gdx.math.MathUtils;
/** Helper class with static methods to build cone shapes using {@link MeshPartBuilder}.
* @author xoppa */
public class ConeShapeBuilder extends BaseShapeBuilder {
public static void build (MeshPartBuilder builder, float width, float height, float depth, int divisions) {
build(builder, width, height, depth, divisions, 0, 360);
}
public static void build (MeshPartBuilder builder, float width, float height, float depth, int divisions, float angleFrom,
float angleTo) {
build(builder, width, height, depth, divisions, angleFrom, angleTo, true);
}
public static void build (MeshPartBuilder builder, float width, float height, float depth, int divisions, float angleFrom,
float angleTo, boolean close) {
// FIXME create better cylinder method (- axis on which to create the cone (matrix?))
builder.ensureVertices(divisions + 2);
builder.ensureTriangleIndices(divisions);
final float hw = width * 0.5f;
final float hh = height * 0.5f;
final float hd = depth * 0.5f;
final float ao = MathUtils.degreesToRadians * angleFrom;
final float step = (MathUtils.degreesToRadians * (angleTo - angleFrom)) / divisions;
final float us = 1f / divisions;
float u = 0f;
float angle = 0f;
VertexInfo curr1 = vertTmp3.set(null, null, null, null);
curr1.hasUV = curr1.hasPosition = curr1.hasNormal = true;
VertexInfo curr2 = vertTmp4.set(null, null, null, null).setPos(0, hh, 0).setNor(0, 1, 0).setUV(0.5f, 0);
final short base = builder.vertex(curr2);
short i1, i2 = 0;
for (int i = 0; i <= divisions; i++) {
angle = ao + step * i;
u = 1f - us * i;
curr1.position.set(MathUtils.cos(angle) * hw, 0f, MathUtils.sin(angle) * hd);
curr1.normal.set(curr1.position).nor();
curr1.position.y = -hh;
curr1.uv.set(u, 1);
i1 = builder.vertex(curr1);
if (i != 0) builder.triangle(base, i1, i2); // FIXME don't duplicate lines and points
i2 = i1;
}
if (close) EllipseShapeBuilder.build(builder, width, depth, 0, 0, divisions, 0, -hh, 0, 0, -1, 0, -1, 0, 0, 0, 0, 1,
180f - angleTo, 180f - angleFrom);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.utils.shapebuilders;
import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder;
import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder.VertexInfo;
import com.badlogic.gdx.math.MathUtils;
/** Helper class with static methods to build cone shapes using {@link MeshPartBuilder}.
* @author xoppa */
public class ConeShapeBuilder extends BaseShapeBuilder {
public static void build (MeshPartBuilder builder, float width, float height, float depth, int divisions) {
build(builder, width, height, depth, divisions, 0, 360);
}
public static void build (MeshPartBuilder builder, float width, float height, float depth, int divisions, float angleFrom,
float angleTo) {
build(builder, width, height, depth, divisions, angleFrom, angleTo, true);
}
public static void build (MeshPartBuilder builder, float width, float height, float depth, int divisions, float angleFrom,
float angleTo, boolean close) {
// FIXME create better cylinder method (- axis on which to create the cone (matrix?))
builder.ensureVertices(divisions + 2);
builder.ensureTriangleIndices(divisions);
final float hw = width * 0.5f;
final float hh = height * 0.5f;
final float hd = depth * 0.5f;
final float ao = MathUtils.degreesToRadians * angleFrom;
final float step = (MathUtils.degreesToRadians * (angleTo - angleFrom)) / divisions;
final float us = 1f / divisions;
float u = 0f;
float angle = 0f;
VertexInfo curr1 = vertTmp3.set(null, null, null, null);
curr1.hasUV = curr1.hasPosition = curr1.hasNormal = true;
VertexInfo curr2 = vertTmp4.set(null, null, null, null).setPos(0, hh, 0).setNor(0, 1, 0).setUV(0.5f, 0);
final short base = builder.vertex(curr2);
short i1, i2 = 0;
for (int i = 0; i <= divisions; i++) {
angle = ao + step * i;
u = 1f - us * i;
curr1.position.set(MathUtils.cos(angle) * hw, 0f, MathUtils.sin(angle) * hd);
curr1.normal.set(curr1.position).nor();
curr1.position.y = -hh;
curr1.uv.set(u, 1);
i1 = builder.vertex(curr1);
if (i != 0) builder.triangle(base, i1, i2); // FIXME don't duplicate lines and points
i2 = i1;
}
if (close) EllipseShapeBuilder.build(builder, width, depth, 0, 0, divisions, 0, -hh, 0, 0, -1, 0, -1, 0, 0, 0, 0, 1,
180f - angleTo, 180f - angleFrom);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/SWIGTYPE_p_btAlignedObjectArrayT_float_p_t.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
public class SWIGTYPE_p_btAlignedObjectArrayT_float_p_t {
private transient long swigCPtr;
protected SWIGTYPE_p_btAlignedObjectArrayT_float_p_t (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_btAlignedObjectArrayT_float_p_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_btAlignedObjectArrayT_float_p_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
public class SWIGTYPE_p_btAlignedObjectArrayT_float_p_t {
private transient long swigCPtr;
protected SWIGTYPE_p_btAlignedObjectArrayT_float_p_t (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_btAlignedObjectArrayT_float_p_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_btAlignedObjectArrayT_float_p_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/net/NetJavaImpl.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.net;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.Net.HttpMethods;
import com.badlogic.gdx.Net.HttpRequest;
import com.badlogic.gdx.Net.HttpResponse;
import com.badlogic.gdx.Net.HttpResponseListener;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.StreamUtils;
/** Implements part of the {@link Net} API using {@link HttpURLConnection}, to be easily reused between the Android and Desktop
* backends.
* @author acoppes */
public class NetJavaImpl {
static class HttpClientResponse implements HttpResponse {
private final HttpURLConnection connection;
private HttpStatus status;
public HttpClientResponse (HttpURLConnection connection) throws IOException {
this.connection = connection;
try {
this.status = new HttpStatus(connection.getResponseCode());
} catch (IOException e) {
this.status = new HttpStatus(-1);
}
}
@Override
public byte[] getResult () {
InputStream input = getInputStream();
// If the response does not contain any content, input will be null.
if (input == null) {
return StreamUtils.EMPTY_BYTES;
}
try {
return StreamUtils.copyStreamToByteArray(input, connection.getContentLength());
} catch (IOException e) {
return StreamUtils.EMPTY_BYTES;
} finally {
StreamUtils.closeQuietly(input);
}
}
@Override
public String getResultAsString () {
InputStream input = getInputStream();
// If the response does not contain any content, input will be null.
if (input == null) {
return "";
}
try {
return StreamUtils.copyStreamToString(input, connection.getContentLength(), "UTF8");
} catch (IOException e) {
return "";
} finally {
StreamUtils.closeQuietly(input);
}
}
@Override
public InputStream getResultAsStream () {
return getInputStream();
}
@Override
public HttpStatus getStatus () {
return status;
}
@Override
public String getHeader (String name) {
return connection.getHeaderField(name);
}
@Override
public Map<String, List<String>> getHeaders () {
return connection.getHeaderFields();
}
private InputStream getInputStream () {
try {
return connection.getInputStream();
} catch (IOException e) {
return connection.getErrorStream();
}
}
}
private final ThreadPoolExecutor executorService;
final ObjectMap<HttpRequest, HttpURLConnection> connections;
final ObjectMap<HttpRequest, HttpResponseListener> listeners;
final ObjectMap<HttpRequest, Future<?>> tasks;
public NetJavaImpl () {
this(Integer.MAX_VALUE);
}
public NetJavaImpl (int maxThreads) {
final boolean isCachedPool = maxThreads == Integer.MAX_VALUE;
executorService = new ThreadPoolExecutor(isCachedPool ? 0 : maxThreads, maxThreads, 60L, TimeUnit.SECONDS,
isCachedPool ? new SynchronousQueue<Runnable>() : new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {
AtomicInteger threadID = new AtomicInteger();
@Override
public Thread newThread (Runnable r) {
Thread thread = new Thread(r, "NetThread" + threadID.getAndIncrement());
thread.setDaemon(true);
return thread;
}
});
executorService.allowCoreThreadTimeOut(!isCachedPool);
connections = new ObjectMap<HttpRequest, HttpURLConnection>();
listeners = new ObjectMap<HttpRequest, HttpResponseListener>();
tasks = new ObjectMap<HttpRequest, Future<?>>();
}
public void sendHttpRequest (final HttpRequest httpRequest, final HttpResponseListener httpResponseListener) {
if (httpRequest.getUrl() == null) {
httpResponseListener.failed(new GdxRuntimeException("can't process a HTTP request without URL set"));
return;
}
try {
final String method = httpRequest.getMethod();
URL url;
final boolean doInput = !method.equalsIgnoreCase(HttpMethods.HEAD);
// should be enabled to upload data.
final boolean doingOutPut = method.equalsIgnoreCase(HttpMethods.POST) || method.equalsIgnoreCase(HttpMethods.PUT)
|| method.equalsIgnoreCase(HttpMethods.PATCH);
if (method.equalsIgnoreCase(HttpMethods.GET) || method.equalsIgnoreCase(HttpMethods.HEAD)) {
String queryString = "";
String value = httpRequest.getContent();
if (value != null && !"".equals(value)) queryString = "?" + value;
url = new URL(httpRequest.getUrl() + queryString);
} else {
url = new URL(httpRequest.getUrl());
}
final HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(doingOutPut);
connection.setDoInput(doInput);
connection.setRequestMethod(method);
HttpURLConnection.setFollowRedirects(httpRequest.getFollowRedirects());
putIntoConnectionsAndListeners(httpRequest, httpResponseListener, connection);
// Headers get set regardless of the method
for (Map.Entry<String, String> header : httpRequest.getHeaders().entrySet())
connection.addRequestProperty(header.getKey(), header.getValue());
// Set Timeouts
connection.setConnectTimeout(httpRequest.getTimeOut());
connection.setReadTimeout(httpRequest.getTimeOut());
tasks.put(httpRequest, executorService.submit(new Runnable() {
@Override
public void run () {
try {
// Set the content for POST and PUT (GET has the information embedded in the URL)
if (doingOutPut) {
// we probably need to use the content as stream here instead of using it as a string.
String contentAsString = httpRequest.getContent();
if (contentAsString != null) {
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF8");
try {
writer.write(contentAsString);
} finally {
StreamUtils.closeQuietly(writer);
}
} else {
InputStream contentAsStream = httpRequest.getContentStream();
if (contentAsStream != null) {
OutputStream os = connection.getOutputStream();
try {
StreamUtils.copyStream(contentAsStream, os);
} finally {
StreamUtils.closeQuietly(os);
}
}
}
}
connection.connect();
final HttpClientResponse clientResponse = new HttpClientResponse(connection);
try {
HttpResponseListener listener = getFromListeners(httpRequest);
if (listener != null) {
listener.handleHttpResponse(clientResponse);
}
removeFromConnectionsAndListeners(httpRequest);
} finally {
connection.disconnect();
}
} catch (final Exception e) {
connection.disconnect();
try {
httpResponseListener.failed(e);
} finally {
removeFromConnectionsAndListeners(httpRequest);
}
}
}
}));
} catch (Exception e) {
try {
httpResponseListener.failed(e);
} finally {
removeFromConnectionsAndListeners(httpRequest);
}
return;
}
}
public void cancelHttpRequest (HttpRequest httpRequest) {
HttpResponseListener httpResponseListener = getFromListeners(httpRequest);
if (httpResponseListener != null) {
httpResponseListener.cancelled();
cancelTask(httpRequest);
removeFromConnectionsAndListeners(httpRequest);
}
}
private void cancelTask (HttpRequest httpRequest) {
Future<?> task = tasks.get(httpRequest);
if (task != null) {
task.cancel(false);
}
}
synchronized void removeFromConnectionsAndListeners (final HttpRequest httpRequest) {
connections.remove(httpRequest);
listeners.remove(httpRequest);
tasks.remove(httpRequest);
}
synchronized void putIntoConnectionsAndListeners (final HttpRequest httpRequest,
final HttpResponseListener httpResponseListener, final HttpURLConnection connection) {
connections.put(httpRequest, connection);
listeners.put(httpRequest, httpResponseListener);
}
synchronized HttpResponseListener getFromListeners (HttpRequest httpRequest) {
HttpResponseListener httpResponseListener = listeners.get(httpRequest);
return httpResponseListener;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.net;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.badlogic.gdx.Net;
import com.badlogic.gdx.Net.HttpMethods;
import com.badlogic.gdx.Net.HttpRequest;
import com.badlogic.gdx.Net.HttpResponse;
import com.badlogic.gdx.Net.HttpResponseListener;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.StreamUtils;
/** Implements part of the {@link Net} API using {@link HttpURLConnection}, to be easily reused between the Android and Desktop
* backends.
* @author acoppes */
public class NetJavaImpl {
static class HttpClientResponse implements HttpResponse {
private final HttpURLConnection connection;
private HttpStatus status;
public HttpClientResponse (HttpURLConnection connection) throws IOException {
this.connection = connection;
try {
this.status = new HttpStatus(connection.getResponseCode());
} catch (IOException e) {
this.status = new HttpStatus(-1);
}
}
@Override
public byte[] getResult () {
InputStream input = getInputStream();
// If the response does not contain any content, input will be null.
if (input == null) {
return StreamUtils.EMPTY_BYTES;
}
try {
return StreamUtils.copyStreamToByteArray(input, connection.getContentLength());
} catch (IOException e) {
return StreamUtils.EMPTY_BYTES;
} finally {
StreamUtils.closeQuietly(input);
}
}
@Override
public String getResultAsString () {
InputStream input = getInputStream();
// If the response does not contain any content, input will be null.
if (input == null) {
return "";
}
try {
return StreamUtils.copyStreamToString(input, connection.getContentLength(), "UTF8");
} catch (IOException e) {
return "";
} finally {
StreamUtils.closeQuietly(input);
}
}
@Override
public InputStream getResultAsStream () {
return getInputStream();
}
@Override
public HttpStatus getStatus () {
return status;
}
@Override
public String getHeader (String name) {
return connection.getHeaderField(name);
}
@Override
public Map<String, List<String>> getHeaders () {
return connection.getHeaderFields();
}
private InputStream getInputStream () {
try {
return connection.getInputStream();
} catch (IOException e) {
return connection.getErrorStream();
}
}
}
private final ThreadPoolExecutor executorService;
final ObjectMap<HttpRequest, HttpURLConnection> connections;
final ObjectMap<HttpRequest, HttpResponseListener> listeners;
final ObjectMap<HttpRequest, Future<?>> tasks;
public NetJavaImpl () {
this(Integer.MAX_VALUE);
}
public NetJavaImpl (int maxThreads) {
final boolean isCachedPool = maxThreads == Integer.MAX_VALUE;
executorService = new ThreadPoolExecutor(isCachedPool ? 0 : maxThreads, maxThreads, 60L, TimeUnit.SECONDS,
isCachedPool ? new SynchronousQueue<Runnable>() : new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {
AtomicInteger threadID = new AtomicInteger();
@Override
public Thread newThread (Runnable r) {
Thread thread = new Thread(r, "NetThread" + threadID.getAndIncrement());
thread.setDaemon(true);
return thread;
}
});
executorService.allowCoreThreadTimeOut(!isCachedPool);
connections = new ObjectMap<HttpRequest, HttpURLConnection>();
listeners = new ObjectMap<HttpRequest, HttpResponseListener>();
tasks = new ObjectMap<HttpRequest, Future<?>>();
}
public void sendHttpRequest (final HttpRequest httpRequest, final HttpResponseListener httpResponseListener) {
if (httpRequest.getUrl() == null) {
httpResponseListener.failed(new GdxRuntimeException("can't process a HTTP request without URL set"));
return;
}
try {
final String method = httpRequest.getMethod();
URL url;
final boolean doInput = !method.equalsIgnoreCase(HttpMethods.HEAD);
// should be enabled to upload data.
final boolean doingOutPut = method.equalsIgnoreCase(HttpMethods.POST) || method.equalsIgnoreCase(HttpMethods.PUT)
|| method.equalsIgnoreCase(HttpMethods.PATCH);
if (method.equalsIgnoreCase(HttpMethods.GET) || method.equalsIgnoreCase(HttpMethods.HEAD)) {
String queryString = "";
String value = httpRequest.getContent();
if (value != null && !"".equals(value)) queryString = "?" + value;
url = new URL(httpRequest.getUrl() + queryString);
} else {
url = new URL(httpRequest.getUrl());
}
final HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(doingOutPut);
connection.setDoInput(doInput);
connection.setRequestMethod(method);
HttpURLConnection.setFollowRedirects(httpRequest.getFollowRedirects());
putIntoConnectionsAndListeners(httpRequest, httpResponseListener, connection);
// Headers get set regardless of the method
for (Map.Entry<String, String> header : httpRequest.getHeaders().entrySet())
connection.addRequestProperty(header.getKey(), header.getValue());
// Set Timeouts
connection.setConnectTimeout(httpRequest.getTimeOut());
connection.setReadTimeout(httpRequest.getTimeOut());
tasks.put(httpRequest, executorService.submit(new Runnable() {
@Override
public void run () {
try {
// Set the content for POST and PUT (GET has the information embedded in the URL)
if (doingOutPut) {
// we probably need to use the content as stream here instead of using it as a string.
String contentAsString = httpRequest.getContent();
if (contentAsString != null) {
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF8");
try {
writer.write(contentAsString);
} finally {
StreamUtils.closeQuietly(writer);
}
} else {
InputStream contentAsStream = httpRequest.getContentStream();
if (contentAsStream != null) {
OutputStream os = connection.getOutputStream();
try {
StreamUtils.copyStream(contentAsStream, os);
} finally {
StreamUtils.closeQuietly(os);
}
}
}
}
connection.connect();
final HttpClientResponse clientResponse = new HttpClientResponse(connection);
try {
HttpResponseListener listener = getFromListeners(httpRequest);
if (listener != null) {
listener.handleHttpResponse(clientResponse);
}
removeFromConnectionsAndListeners(httpRequest);
} finally {
connection.disconnect();
}
} catch (final Exception e) {
connection.disconnect();
try {
httpResponseListener.failed(e);
} finally {
removeFromConnectionsAndListeners(httpRequest);
}
}
}
}));
} catch (Exception e) {
try {
httpResponseListener.failed(e);
} finally {
removeFromConnectionsAndListeners(httpRequest);
}
return;
}
}
public void cancelHttpRequest (HttpRequest httpRequest) {
HttpResponseListener httpResponseListener = getFromListeners(httpRequest);
if (httpResponseListener != null) {
httpResponseListener.cancelled();
cancelTask(httpRequest);
removeFromConnectionsAndListeners(httpRequest);
}
}
private void cancelTask (HttpRequest httpRequest) {
Future<?> task = tasks.get(httpRequest);
if (task != null) {
task.cancel(false);
}
}
synchronized void removeFromConnectionsAndListeners (final HttpRequest httpRequest) {
connections.remove(httpRequest);
listeners.remove(httpRequest);
tasks.remove(httpRequest);
}
synchronized void putIntoConnectionsAndListeners (final HttpRequest httpRequest,
final HttpResponseListener httpResponseListener, final HttpURLConnection connection) {
connections.put(httpRequest, connection);
listeners.put(httpRequest, httpResponseListener);
}
synchronized HttpResponseListener getFromListeners (HttpRequest httpRequest) {
HttpResponseListener httpResponseListener = listeners.get(httpRequest);
return httpResponseListener;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/org/jbox2d/pooling/arrays/GeneratorArray.java |
package org.jbox2d.pooling.arrays;
import java.util.HashMap;
import org.jbox2d.particle.VoronoiDiagram;
public class GeneratorArray {
private final HashMap<Integer, VoronoiDiagram.Generator[]> map = new HashMap<Integer, VoronoiDiagram.Generator[]>();
public VoronoiDiagram.Generator[] get (int length) {
assert (length > 0);
if (!map.containsKey(length)) {
map.put(length, getInitializedArray(length));
}
assert (map.get(length).length == length) : "Array not built of correct length";
return map.get(length);
}
protected VoronoiDiagram.Generator[] getInitializedArray (int length) {
final VoronoiDiagram.Generator[] ray = new VoronoiDiagram.Generator[length];
for (int i = 0; i < ray.length; i++) {
ray[i] = new VoronoiDiagram.Generator();
}
return ray;
}
}
|
package org.jbox2d.pooling.arrays;
import java.util.HashMap;
import org.jbox2d.particle.VoronoiDiagram;
public class GeneratorArray {
private final HashMap<Integer, VoronoiDiagram.Generator[]> map = new HashMap<Integer, VoronoiDiagram.Generator[]>();
public VoronoiDiagram.Generator[] get (int length) {
assert (length > 0);
if (!map.containsKey(length)) {
map.put(length, getInitializedArray(length));
}
assert (map.get(length).length == length) : "Array not built of correct length";
return map.get(length);
}
protected VoronoiDiagram.Generator[] getInitializedArray (int length) {
final VoronoiDiagram.Generator[] ray = new VoronoiDiagram.Generator[length];
for (int i = 0; i < ray.length; i++) {
ray[i] = new VoronoiDiagram.Generator();
}
return ray;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/linearmath/com/badlogic/gdx/physics/bullet/linearmath/btSpinMutex.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class btSpinMutex extends BulletBase {
private long swigCPtr;
protected btSpinMutex (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btSpinMutex, normally you should not need this constructor it's intended for low-level usage. */
public btSpinMutex (long cPtr, boolean cMemoryOwn) {
this("btSpinMutex", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btSpinMutex obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_btSpinMutex(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btSpinMutex () {
this(LinearMathJNI.new_btSpinMutex(), true);
}
public void lock () {
LinearMathJNI.btSpinMutex_lock(swigCPtr, this);
}
public void unlock () {
LinearMathJNI.btSpinMutex_unlock(swigCPtr, this);
}
public boolean tryLock () {
return LinearMathJNI.btSpinMutex_tryLock(swigCPtr, this);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class btSpinMutex extends BulletBase {
private long swigCPtr;
protected btSpinMutex (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btSpinMutex, normally you should not need this constructor it's intended for low-level usage. */
public btSpinMutex (long cPtr, boolean cMemoryOwn) {
this("btSpinMutex", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btSpinMutex obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_btSpinMutex(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btSpinMutex () {
this(LinearMathJNI.new_btSpinMutex(), true);
}
public void lock () {
LinearMathJNI.btSpinMutex_lock(swigCPtr, this);
}
public void unlock () {
LinearMathJNI.btSpinMutex_unlock(swigCPtr, this);
}
public boolean tryLock () {
return LinearMathJNI.btSpinMutex_tryLock(swigCPtr, this);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/TextButtonTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.ScreenUtils;
public class TextButtonTest extends GdxTest {
private Stage stage;
private Skin skin;
@Override
public void create () {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
for (int i = 0; i < 1; i++) {
TextButton t = new TextButton("Button" + i, skin);
t.setX(MathUtils.random(0, Gdx.graphics.getWidth()));
t.setY(MathUtils.random(0, Gdx.graphics.getHeight()));
t.setWidth(MathUtils.random(50, 200));
t.setHeight(MathUtils.random(0, 100));
stage.addActor(t);
}
}
@Override
public void render () {
ScreenUtils.clear(0.2f, 0.2f, 0.2f, 1);
stage.draw();
Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
spriteBatch.totalRenderCalls = 0;
}
@Override
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
stage.dispose();
skin.dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.ScreenUtils;
public class TextButtonTest extends GdxTest {
private Stage stage;
private Skin skin;
@Override
public void create () {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
for (int i = 0; i < 1; i++) {
TextButton t = new TextButton("Button" + i, skin);
t.setX(MathUtils.random(0, Gdx.graphics.getWidth()));
t.setY(MathUtils.random(0, Gdx.graphics.getHeight()));
t.setWidth(MathUtils.random(50, 200));
t.setHeight(MathUtils.random(0, 100));
stage.addActor(t);
}
}
@Override
public void render () {
ScreenUtils.clear(0.2f, 0.2f, 0.2f, 1);
stage.draw();
Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
spriteBatch.totalRenderCalls = 0;
}
@Override
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
stage.dispose();
skin.dispose();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/linearmath/com/badlogic/gdx/physics/bullet/linearmath/SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
public class SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t {
private transient long swigCPtr;
protected SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t (long cPtr,
@SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
public class SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t {
private transient long swigCPtr;
protected SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t (long cPtr,
@SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_btAlignedObjectArrayT_btCollisionObjectDoubleData_p_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/inversedynamics/com/badlogic/gdx/physics/bullet/inversedynamics/SWIGTYPE_p_vec3.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.inversedynamics;
public class SWIGTYPE_p_vec3 {
private transient long swigCPtr;
protected SWIGTYPE_p_vec3 (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_vec3 () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_vec3 obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.inversedynamics;
public class SWIGTYPE_p_vec3 {
private transient long swigCPtr;
protected SWIGTYPE_p_vec3 (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_vec3 () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_vec3 obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/btMultiBodyJointLimitConstraint.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class btMultiBodyJointLimitConstraint extends btMultiBodyConstraint {
private long swigCPtr;
protected btMultiBodyJointLimitConstraint (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btMultiBodyJointLimitConstraint_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btMultiBodyJointLimitConstraint, normally you should not need this constructor it's intended for low-level
* usage. */
public btMultiBodyJointLimitConstraint (long cPtr, boolean cMemoryOwn) {
this("btMultiBodyJointLimitConstraint", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btMultiBodyJointLimitConstraint_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btMultiBodyJointLimitConstraint obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btMultiBodyJointLimitConstraint(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btMultiBodyJointLimitConstraint (btMultiBody body, int link, float lower, float upper) {
this(DynamicsJNI.new_btMultiBodyJointLimitConstraint(btMultiBody.getCPtr(body), body, link, lower, upper), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class btMultiBodyJointLimitConstraint extends btMultiBodyConstraint {
private long swigCPtr;
protected btMultiBodyJointLimitConstraint (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btMultiBodyJointLimitConstraint_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btMultiBodyJointLimitConstraint, normally you should not need this constructor it's intended for low-level
* usage. */
public btMultiBodyJointLimitConstraint (long cPtr, boolean cMemoryOwn) {
this("btMultiBodyJointLimitConstraint", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btMultiBodyJointLimitConstraint_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btMultiBodyJointLimitConstraint obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btMultiBodyJointLimitConstraint(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btMultiBodyJointLimitConstraint (btMultiBody body, int link, float lower, float upper) {
this(DynamicsJNI.new_btMultiBodyJointLimitConstraint(btMultiBody.getCPtr(body), body, link, lower, upper), true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-tools/src/com/badlogic/gdx/tools/flame/TexturePanel.java |
package com.badlogic.gdx.tools.flame;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.FileTextureData;
import com.badlogic.gdx.utils.Array;
/** @author Inferno */
public class TexturePanel extends ImagePanel {
private Color selectedColor = Color.GREEN, unselectedColor = Color.BLUE, indexBackgroundColor = Color.BLACK,
indexColor = Color.WHITE;
Array<TextureRegion> selectedRegions;
Array<TextureRegion> unselectedRegions;
Texture texture;
public TexturePanel () {
selectedRegions = new Array<TextureRegion>();
unselectedRegions = new Array<TextureRegion>();
addMouseListener(new MouseAdapter() {
public void mouseClicked (MouseEvent event) {
float x = event.getX(), y = event.getY();
for (TextureRegion region : unselectedRegions) {
if (isInsideRegion(region, x, y)) {
select(region);
return;
}
}
for (TextureRegion region : selectedRegions) {
if (isInsideRegion(region, x, y)) {
unselect(region);
return;
}
}
}
});
}
protected boolean isInsideRegion (TextureRegion region, float x, float y) {
float rx = region.getRegionX(), ry = region.getRegionY();
return rx <= x && x <= rx + region.getRegionWidth() && ry <= y && y <= ry + region.getRegionHeight();
}
public TexturePanel (Texture texture, Array<TextureRegion> regions) {
this();
setTexture(texture);
setRegions(regions);
}
public void setTexture (Texture texture) {
if (this.texture == texture) return;
this.texture = texture;
FileTextureData data = (FileTextureData)texture.getTextureData();
setImage(data.getFileHandle().file().getAbsolutePath());
}
public Texture getTexture () {
return texture;
}
public void clear () {
selectedRegions.clear();
unselectedRegions.clear();
}
public void clearSelection () {
unselectedRegions.addAll(selectedRegions);
selectedRegions.clear();
repaint();
}
public void setRegions (Array<TextureRegion> regions) {
unselectedRegions.clear();
selectedRegions.clear();
unselectedRegions.addAll(regions);
}
private void swap (TextureRegion region, Array<TextureRegion> src, Array<TextureRegion> dst) {
int index = src.indexOf(region, true);
if (index > -1) {
src.removeIndex(index);
dst.add(region);
repaint();
}
}
public void select (TextureRegion region) {
swap(region, unselectedRegions, selectedRegions);
}
public void unselect (TextureRegion region) {
swap(region, selectedRegions, unselectedRegions);
}
public void selectAll () {
selectedRegions.addAll(unselectedRegions);
unselectedRegions.clear();
repaint();
}
@Override
protected void paintComponent (Graphics g) {
super.paintComponent(g);
draw(g, unselectedRegions, unselectedColor, false);
draw(g, selectedRegions, selectedColor, true);
}
private void draw (Graphics g, Array<TextureRegion> regions, Color color, boolean drawIndex) {
int i = 0;
for (TextureRegion region : regions) {
int x = region.getRegionX(), y = region.getRegionY(), h = region.getRegionHeight();
if (drawIndex) {
String indexString = "" + i;
Rectangle bounds = g.getFontMetrics().getStringBounds(indexString, g).getBounds();
g.setColor(indexBackgroundColor);
g.fillRect(x, y + h - bounds.height, bounds.width, bounds.height);
g.setColor(indexColor);
g.drawString(indexString, x, y + h);
++i;
}
g.setColor(color);
g.drawRect(x, y, region.getRegionWidth(), h);
}
}
}
|
package com.badlogic.gdx.tools.flame;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.FileTextureData;
import com.badlogic.gdx.utils.Array;
/** @author Inferno */
public class TexturePanel extends ImagePanel {
private Color selectedColor = Color.GREEN, unselectedColor = Color.BLUE, indexBackgroundColor = Color.BLACK,
indexColor = Color.WHITE;
Array<TextureRegion> selectedRegions;
Array<TextureRegion> unselectedRegions;
Texture texture;
public TexturePanel () {
selectedRegions = new Array<TextureRegion>();
unselectedRegions = new Array<TextureRegion>();
addMouseListener(new MouseAdapter() {
public void mouseClicked (MouseEvent event) {
float x = event.getX(), y = event.getY();
for (TextureRegion region : unselectedRegions) {
if (isInsideRegion(region, x, y)) {
select(region);
return;
}
}
for (TextureRegion region : selectedRegions) {
if (isInsideRegion(region, x, y)) {
unselect(region);
return;
}
}
}
});
}
protected boolean isInsideRegion (TextureRegion region, float x, float y) {
float rx = region.getRegionX(), ry = region.getRegionY();
return rx <= x && x <= rx + region.getRegionWidth() && ry <= y && y <= ry + region.getRegionHeight();
}
public TexturePanel (Texture texture, Array<TextureRegion> regions) {
this();
setTexture(texture);
setRegions(regions);
}
public void setTexture (Texture texture) {
if (this.texture == texture) return;
this.texture = texture;
FileTextureData data = (FileTextureData)texture.getTextureData();
setImage(data.getFileHandle().file().getAbsolutePath());
}
public Texture getTexture () {
return texture;
}
public void clear () {
selectedRegions.clear();
unselectedRegions.clear();
}
public void clearSelection () {
unselectedRegions.addAll(selectedRegions);
selectedRegions.clear();
repaint();
}
public void setRegions (Array<TextureRegion> regions) {
unselectedRegions.clear();
selectedRegions.clear();
unselectedRegions.addAll(regions);
}
private void swap (TextureRegion region, Array<TextureRegion> src, Array<TextureRegion> dst) {
int index = src.indexOf(region, true);
if (index > -1) {
src.removeIndex(index);
dst.add(region);
repaint();
}
}
public void select (TextureRegion region) {
swap(region, unselectedRegions, selectedRegions);
}
public void unselect (TextureRegion region) {
swap(region, selectedRegions, unselectedRegions);
}
public void selectAll () {
selectedRegions.addAll(unselectedRegions);
unselectedRegions.clear();
repaint();
}
@Override
protected void paintComponent (Graphics g) {
super.paintComponent(g);
draw(g, unselectedRegions, unselectedColor, false);
draw(g, selectedRegions, selectedColor, true);
}
private void draw (Graphics g, Array<TextureRegion> regions, Color color, boolean drawIndex) {
int i = 0;
for (TextureRegion region : regions) {
int x = region.getRegionX(), y = region.getRegionY(), h = region.getRegionHeight();
if (drawIndex) {
String indexString = "" + i;
Rectangle bounds = g.getFontMetrics().getStringBounds(indexString, g).getBounds();
g.setColor(indexBackgroundColor);
g.fillRect(x, y + h - bounds.height, bounds.width, bounds.height);
g.setColor(indexColor);
g.drawString(indexString, x, y + h);
++i;
}
g.setColor(color);
g.drawRect(x, y, region.getRegionWidth(), h);
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/test/com/badlogic/gdx/math/BezierTest.java |
package com.badlogic.gdx.math;
import java.util.ArrayList;
import java.util.Collection;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import com.badlogic.gdx.utils.Array;
@RunWith(Parameterized.class)
public class BezierTest {
private static float epsilon = Float.MIN_NORMAL;
private static float epsilonApprimations = 1e-6f;
private static enum ImportType {
LibGDXArrays, JavaArrays, JavaVarArgs
}
@Parameters(name = "imported type {0} use setter {1}")
public static Collection<Object[]> parameters () {
Collection<Object[]> parameters = new ArrayList<Object[]>();
for (ImportType type : ImportType.values()) {
parameters.add(new Object[] {type, true});
parameters.add(new Object[] {type, false});
}
return parameters;
}
@Parameter(0) public ImportType type;
/** use constructor or setter */
@Parameter(1) public boolean useSetter;
private Bezier<Vector2> bezier;
@Before
public void setup () {
bezier = null;
}
protected Vector2[] create (Vector2[] points) {
if (useSetter) {
bezier = new Bezier<Vector2>();
if (type == ImportType.LibGDXArrays) {
bezier.set(new Array<Vector2>(points), 0, points.length);
} else if (type == ImportType.JavaArrays) {
bezier.set(points, 0, points.length);
} else {
bezier.set(points);
}
} else {
if (type == ImportType.LibGDXArrays) {
bezier = new Bezier<Vector2>(new Array<Vector2>(points), 0, points.length);
} else if (type == ImportType.JavaArrays) {
bezier = new Bezier<Vector2>(points, 0, points.length);
} else {
bezier = new Bezier<Vector2>(points);
}
}
return points;
}
@Test
public void testLinear2D () {
Vector2[] points = create(new Vector2[] {new Vector2(0, 0), new Vector2(1, 1)});
float len = bezier.approxLength(2);
Assert.assertEquals(Math.sqrt(2), len, epsilonApprimations);
Vector2 d = bezier.derivativeAt(new Vector2(), 0.5f);
Assert.assertEquals(1, d.x, epsilon);
Assert.assertEquals(1, d.y, epsilon);
Vector2 v = bezier.valueAt(new Vector2(), 0.5f);
Assert.assertEquals(0.5f, v.x, epsilon);
Assert.assertEquals(0.5f, v.y, epsilon);
float t = bezier.approximate(new Vector2(.5f, .5f));
Assert.assertEquals(.5f, t, epsilonApprimations);
float l = bezier.locate(new Vector2(.5f, .5f));
Assert.assertEquals(.5f, t, epsilon);
}
}
|
package com.badlogic.gdx.math;
import java.util.ArrayList;
import java.util.Collection;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import com.badlogic.gdx.utils.Array;
@RunWith(Parameterized.class)
public class BezierTest {
private static float epsilon = Float.MIN_NORMAL;
private static float epsilonApprimations = 1e-6f;
private static enum ImportType {
LibGDXArrays, JavaArrays, JavaVarArgs
}
@Parameters(name = "imported type {0} use setter {1}")
public static Collection<Object[]> parameters () {
Collection<Object[]> parameters = new ArrayList<Object[]>();
for (ImportType type : ImportType.values()) {
parameters.add(new Object[] {type, true});
parameters.add(new Object[] {type, false});
}
return parameters;
}
@Parameter(0) public ImportType type;
/** use constructor or setter */
@Parameter(1) public boolean useSetter;
private Bezier<Vector2> bezier;
@Before
public void setup () {
bezier = null;
}
protected Vector2[] create (Vector2[] points) {
if (useSetter) {
bezier = new Bezier<Vector2>();
if (type == ImportType.LibGDXArrays) {
bezier.set(new Array<Vector2>(points), 0, points.length);
} else if (type == ImportType.JavaArrays) {
bezier.set(points, 0, points.length);
} else {
bezier.set(points);
}
} else {
if (type == ImportType.LibGDXArrays) {
bezier = new Bezier<Vector2>(new Array<Vector2>(points), 0, points.length);
} else if (type == ImportType.JavaArrays) {
bezier = new Bezier<Vector2>(points, 0, points.length);
} else {
bezier = new Bezier<Vector2>(points);
}
}
return points;
}
@Test
public void testLinear2D () {
Vector2[] points = create(new Vector2[] {new Vector2(0, 0), new Vector2(1, 1)});
float len = bezier.approxLength(2);
Assert.assertEquals(Math.sqrt(2), len, epsilonApprimations);
Vector2 d = bezier.derivativeAt(new Vector2(), 0.5f);
Assert.assertEquals(1, d.x, epsilon);
Assert.assertEquals(1, d.y, epsilon);
Vector2 v = bezier.valueAt(new Vector2(), 0.5f);
Assert.assertEquals(0.5f, v.x, epsilon);
Assert.assertEquals(0.5f, v.y, epsilon);
float t = bezier.approximate(new Vector2(.5f, .5f));
Assert.assertEquals(.5f, t, epsilonApprimations);
float l = bezier.locate(new Vector2(.5f, .5f));
Assert.assertEquals(.5f, t, epsilon);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3GL30.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.lwjgl3;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import java.nio.ShortBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL21;
import org.lwjgl.opengl.GL30;
import org.lwjgl.opengl.GL31;
import org.lwjgl.opengl.GL32;
import org.lwjgl.opengl.GL33;
import org.lwjgl.opengl.GL40;
import org.lwjgl.opengl.GL41;
import org.lwjgl.opengl.GL43;
import com.badlogic.gdx.utils.GdxRuntimeException;
class Lwjgl3GL30 extends Lwjgl3GL20 implements com.badlogic.gdx.graphics.GL30 {
@Override
public void glReadBuffer (int mode) {
GL11.glReadBuffer(mode);
}
@Override
public void glDrawRangeElements (int mode, int start, int end, int count, int type, Buffer indices) {
if (indices instanceof ByteBuffer)
GL12.glDrawRangeElements(mode, start, end, (ByteBuffer)indices);
else if (indices instanceof ShortBuffer)
GL12.glDrawRangeElements(mode, start, end, (ShortBuffer)indices);
else if (indices instanceof IntBuffer)
GL12.glDrawRangeElements(mode, start, end, (IntBuffer)indices);
else
throw new GdxRuntimeException("indices must be byte, short or int buffer");
}
@Override
public void glDrawRangeElements (int mode, int start, int end, int count, int type, int offset) {
GL12.glDrawRangeElements(mode, start, end, count, type, offset);
}
@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
int offset) {
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, offset);
}
@Override
public void glTexImage3D (int target, int level, int internalformat, int width, int height, int depth, int border, int format,
int type, Buffer pixels) {
if (pixels == null)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ByteBuffer)null);
else if (pixels instanceof ByteBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (FloatBuffer)pixels);
else if (pixels instanceof DoubleBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (DoubleBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
}
@Override
public void glTexImage3D (int target, int level, int internalformat, int width, int height, int depth, int border, int format,
int type, int offset) {
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, offset);
}
@Override
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
int offset) {
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, offset);
}
@Override
public void glTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
int format, int type, Buffer pixels) {
if (pixels instanceof ByteBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (FloatBuffer)pixels);
else if (pixels instanceof DoubleBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (DoubleBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
}
@Override
public void glTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
int format, int type, int offset) {
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, offset);
}
@Override
public void glCopyTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width,
int height) {
GL12.glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
}
@Override
public void glGenQueries (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
ids[i] = GL15.glGenQueries();
}
}
@Override
public void glGenQueries (int n, IntBuffer ids) {
for (int i = 0; i < n; i++) {
ids.put(GL15.glGenQueries());
}
}
@Override
public void glDeleteQueries (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
GL15.glDeleteQueries(ids[i]);
}
}
@Override
public void glDeleteQueries (int n, IntBuffer ids) {
for (int i = 0; i < n; i++) {
GL15.glDeleteQueries(ids.get());
}
}
@Override
public boolean glIsQuery (int id) {
return GL15.glIsQuery(id);
}
@Override
public void glBeginQuery (int target, int id) {
GL15.glBeginQuery(target, id);
}
@Override
public void glEndQuery (int target) {
GL15.glEndQuery(target);
}
@Override
public void glGetQueryiv (int target, int pname, IntBuffer params) {
GL15.glGetQueryiv(target, pname, params);
}
@Override
public void glGetQueryObjectuiv (int id, int pname, IntBuffer params) {
GL15.glGetQueryObjectuiv(id, pname, params);
}
@Override
public boolean glUnmapBuffer (int target) {
return GL15.glUnmapBuffer(target);
}
@Override
public Buffer glGetBufferPointerv (int target, int pname) {
// FIXME glGetBufferPointerv needs a proper translation
// return GL15.glGetBufferPointer(target, pname);
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void glDrawBuffers (int n, IntBuffer bufs) {
int limit = bufs.limit();
((Buffer)bufs).limit(n);
GL20.glDrawBuffers(bufs);
((Buffer)bufs).limit(limit);
}
@Override
public void glUniformMatrix2x3fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix2x3fv(location, transpose, value);
}
@Override
public void glUniformMatrix3x2fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix3x2fv(location, transpose, value);
}
@Override
public void glUniformMatrix2x4fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix2x4fv(location, transpose, value);
}
@Override
public void glUniformMatrix4x2fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix4x2fv(location, transpose, value);
}
@Override
public void glUniformMatrix3x4fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix3x4fv(location, transpose, value);
}
@Override
public void glUniformMatrix4x3fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix4x3fv(location, transpose, value);
}
@Override
public void glBlitFramebuffer (int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1,
int mask, int filter) {
GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
@Override
public void glBindFramebuffer (int target, int framebuffer) {
GL30.glBindFramebuffer(target, framebuffer);
}
@Override
public void glBindRenderbuffer (int target, int renderbuffer) {
GL30.glBindRenderbuffer(target, renderbuffer);
}
@Override
public int glCheckFramebufferStatus (int target) {
return GL30.glCheckFramebufferStatus(target);
}
@Override
public void glDeleteFramebuffers (int n, IntBuffer framebuffers) {
GL30.glDeleteFramebuffers(framebuffers);
}
@Override
public void glDeleteFramebuffer (int framebuffer) {
GL30.glDeleteFramebuffers(framebuffer);
}
@Override
public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) {
GL30.glDeleteRenderbuffers(renderbuffers);
}
@Override
public void glDeleteRenderbuffer (int renderbuffer) {
GL30.glDeleteRenderbuffers(renderbuffer);
}
@Override
public void glGenerateMipmap (int target) {
GL30.glGenerateMipmap(target);
}
@Override
public void glGenFramebuffers (int n, IntBuffer framebuffers) {
GL30.glGenFramebuffers(framebuffers);
}
@Override
public int glGenFramebuffer () {
return GL30.glGenFramebuffers();
}
@Override
public void glGenRenderbuffers (int n, IntBuffer renderbuffers) {
GL30.glGenRenderbuffers(renderbuffers);
}
@Override
public int glGenRenderbuffer () {
return GL30.glGenRenderbuffers();
}
@Override
public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) {
GL30.glGetRenderbufferParameteriv(target, pname, params);
}
@Override
public boolean glIsFramebuffer (int framebuffer) {
return GL30.glIsFramebuffer(framebuffer);
}
@Override
public boolean glIsRenderbuffer (int renderbuffer) {
return GL30.glIsRenderbuffer(renderbuffer);
}
@Override
public void glRenderbufferStorage (int target, int internalformat, int width, int height) {
GL30.glRenderbufferStorage(target, internalformat, width, height);
}
@Override
public void glRenderbufferStorageMultisample (int target, int samples, int internalformat, int width, int height) {
GL30.glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
}
@Override
public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) {
GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
@Override
public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) {
GL30.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}
@Override
public void glFramebufferTextureLayer (int target, int attachment, int texture, int level, int layer) {
GL30.glFramebufferTextureLayer(target, attachment, texture, level, layer);
}
@Override
public java.nio.Buffer glMapBufferRange (int target, int offset, int length, int access) {
return GL30.glMapBufferRange(target, offset, length, access, null);
}
@Override
public void glFlushMappedBufferRange (int target, int offset, int length) {
GL30.glFlushMappedBufferRange(target, offset, length);
}
@Override
public void glBindVertexArray (int array) {
GL30.glBindVertexArray(array);
}
@Override
public void glDeleteVertexArrays (int n, int[] arrays, int offset) {
for (int i = offset; i < offset + n; i++) {
GL30.glDeleteVertexArrays(arrays[i]);
}
}
@Override
public void glDeleteVertexArrays (int n, IntBuffer arrays) {
GL30.glDeleteVertexArrays(arrays);
}
@Override
public void glGenVertexArrays (int n, int[] arrays, int offset) {
for (int i = offset; i < offset + n; i++) {
arrays[i] = GL30.glGenVertexArrays();
}
}
@Override
public void glGenVertexArrays (int n, IntBuffer arrays) {
GL30.glGenVertexArrays(arrays);
}
@Override
public boolean glIsVertexArray (int array) {
return GL30.glIsVertexArray(array);
}
@Override
public void glBeginTransformFeedback (int primitiveMode) {
GL30.glBeginTransformFeedback(primitiveMode);
}
@Override
public void glEndTransformFeedback () {
GL30.glEndTransformFeedback();
}
@Override
public void glBindBufferRange (int target, int index, int buffer, int offset, int size) {
GL30.glBindBufferRange(target, index, buffer, offset, size);
}
@Override
public void glBindBufferBase (int target, int index, int buffer) {
GL30.glBindBufferBase(target, index, buffer);
}
@Override
public void glTransformFeedbackVaryings (int program, String[] varyings, int bufferMode) {
GL30.glTransformFeedbackVaryings(program, varyings, bufferMode);
}
@Override
public void glVertexAttribIPointer (int index, int size, int type, int stride, int offset) {
GL30.glVertexAttribIPointer(index, size, type, stride, offset);
}
@Override
public void glGetVertexAttribIiv (int index, int pname, IntBuffer params) {
GL30.glGetVertexAttribIiv(index, pname, params);
}
@Override
public void glGetVertexAttribIuiv (int index, int pname, IntBuffer params) {
GL30.glGetVertexAttribIuiv(index, pname, params);
}
@Override
public void glVertexAttribI4i (int index, int x, int y, int z, int w) {
GL30.glVertexAttribI4i(index, x, y, z, w);
}
@Override
public void glVertexAttribI4ui (int index, int x, int y, int z, int w) {
GL30.glVertexAttribI4ui(index, x, y, z, w);
}
@Override
public void glGetUniformuiv (int program, int location, IntBuffer params) {
GL30.glGetUniformuiv(program, location, params);
}
@Override
public int glGetFragDataLocation (int program, String name) {
return GL30.glGetFragDataLocation(program, name);
}
@Override
public void glUniform1uiv (int location, int count, IntBuffer value) {
GL30.glUniform1uiv(location, value);
}
@Override
public void glUniform3uiv (int location, int count, IntBuffer value) {
GL30.glUniform3uiv(location, value);
}
@Override
public void glUniform4uiv (int location, int count, IntBuffer value) {
GL30.glUniform4uiv(location, value);
}
@Override
public void glClearBufferiv (int buffer, int drawbuffer, IntBuffer value) {
GL30.glClearBufferiv(buffer, drawbuffer, value);
}
@Override
public void glClearBufferuiv (int buffer, int drawbuffer, IntBuffer value) {
GL30.glClearBufferuiv(buffer, drawbuffer, value);
}
@Override
public void glClearBufferfv (int buffer, int drawbuffer, FloatBuffer value) {
GL30.glClearBufferfv(buffer, drawbuffer, value);
}
@Override
public void glClearBufferfi (int buffer, int drawbuffer, float depth, int stencil) {
GL30.glClearBufferfi(buffer, drawbuffer, depth, stencil);
}
@Override
public String glGetStringi (int name, int index) {
return GL30.glGetStringi(name, index);
}
@Override
public void glCopyBufferSubData (int readTarget, int writeTarget, int readOffset, int writeOffset, int size) {
GL31.glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
}
@Override
public void glGetUniformIndices (int program, String[] uniformNames, IntBuffer uniformIndices) {
GL31.glGetUniformIndices(program, uniformNames, uniformIndices);
}
@Override
public void glGetActiveUniformsiv (int program, int uniformCount, IntBuffer uniformIndices, int pname, IntBuffer params) {
GL31.glGetActiveUniformsiv(program, uniformIndices, pname, params);
}
@Override
public int glGetUniformBlockIndex (int program, String uniformBlockName) {
return GL31.glGetUniformBlockIndex(program, uniformBlockName);
}
@Override
public void glGetActiveUniformBlockiv (int program, int uniformBlockIndex, int pname, IntBuffer params) {
GL31.glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
}
@Override
public void glGetActiveUniformBlockName (int program, int uniformBlockIndex, Buffer length, Buffer uniformBlockName) {
GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, (IntBuffer)length, (ByteBuffer)uniformBlockName);
}
@Override
public String glGetActiveUniformBlockName (int program, int uniformBlockIndex) {
return GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, 1024);
}
@Override
public void glUniformBlockBinding (int program, int uniformBlockIndex, int uniformBlockBinding) {
GL31.glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
}
@Override
public void glDrawArraysInstanced (int mode, int first, int count, int instanceCount) {
GL31.glDrawArraysInstanced(mode, first, count, instanceCount);
}
@Override
public void glDrawElementsInstanced (int mode, int count, int type, int indicesOffset, int instanceCount) {
GL31.glDrawElementsInstanced(mode, count, type, indicesOffset, instanceCount);
}
@Override
public void glGetInteger64v (int pname, LongBuffer params) {
GL32.glGetInteger64v(pname, params);
}
@Override
public void glGetBufferParameteri64v (int target, int pname, LongBuffer params) {
params.put(GL32.glGetBufferParameteri64(target, pname));
}
@Override
public void glGenSamplers (int count, int[] samplers, int offset) {
for (int i = offset; i < offset + count; i++) {
samplers[i] = GL33.glGenSamplers();
}
}
@Override
public void glGenSamplers (int count, IntBuffer samplers) {
GL33.glGenSamplers(samplers);
}
@Override
public void glDeleteSamplers (int count, int[] samplers, int offset) {
for (int i = offset; i < offset + count; i++) {
GL33.glDeleteSamplers(samplers[i]);
}
}
@Override
public void glDeleteSamplers (int count, IntBuffer samplers) {
GL33.glDeleteSamplers(samplers);
}
@Override
public boolean glIsSampler (int sampler) {
return GL33.glIsSampler(sampler);
}
@Override
public void glBindSampler (int unit, int sampler) {
GL33.glBindSampler(unit, sampler);
}
@Override
public void glSamplerParameteri (int sampler, int pname, int param) {
GL33.glSamplerParameteri(sampler, pname, param);
}
@Override
public void glSamplerParameteriv (int sampler, int pname, IntBuffer param) {
GL33.glSamplerParameteriv(sampler, pname, param);
}
@Override
public void glSamplerParameterf (int sampler, int pname, float param) {
GL33.glSamplerParameterf(sampler, pname, param);
}
@Override
public void glSamplerParameterfv (int sampler, int pname, FloatBuffer param) {
GL33.glSamplerParameterfv(sampler, pname, param);
}
@Override
public void glGetSamplerParameteriv (int sampler, int pname, IntBuffer params) {
GL33.glGetSamplerParameterIiv(sampler, pname, params);
}
@Override
public void glGetSamplerParameterfv (int sampler, int pname, FloatBuffer params) {
GL33.glGetSamplerParameterfv(sampler, pname, params);
}
@Override
public void glVertexAttribDivisor (int index, int divisor) {
GL33.glVertexAttribDivisor(index, divisor);
}
@Override
public void glBindTransformFeedback (int target, int id) {
GL40.glBindTransformFeedback(target, id);
}
@Override
public void glDeleteTransformFeedbacks (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
GL40.glDeleteTransformFeedbacks(ids[i]);
}
}
@Override
public void glDeleteTransformFeedbacks (int n, IntBuffer ids) {
GL40.glDeleteTransformFeedbacks(ids);
}
@Override
public void glGenTransformFeedbacks (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
ids[i] = GL40.glGenTransformFeedbacks();
}
}
@Override
public void glGenTransformFeedbacks (int n, IntBuffer ids) {
GL40.glGenTransformFeedbacks(ids);
}
@Override
public boolean glIsTransformFeedback (int id) {
return GL40.glIsTransformFeedback(id);
}
@Override
public void glPauseTransformFeedback () {
GL40.glPauseTransformFeedback();
}
@Override
public void glResumeTransformFeedback () {
GL40.glResumeTransformFeedback();
}
@Override
public void glProgramParameteri (int program, int pname, int value) {
GL41.glProgramParameteri(program, pname, value);
}
@Override
public void glInvalidateFramebuffer (int target, int numAttachments, IntBuffer attachments) {
GL43.glInvalidateFramebuffer(target, attachments);
}
@Override
public void glInvalidateSubFramebuffer (int target, int numAttachments, IntBuffer attachments, int x, int y, int width,
int height) {
GL43.glInvalidateSubFramebuffer(target, attachments, x, y, width, height);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.lwjgl3;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import java.nio.ShortBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL21;
import org.lwjgl.opengl.GL30;
import org.lwjgl.opengl.GL31;
import org.lwjgl.opengl.GL32;
import org.lwjgl.opengl.GL33;
import org.lwjgl.opengl.GL40;
import org.lwjgl.opengl.GL41;
import org.lwjgl.opengl.GL43;
import com.badlogic.gdx.utils.GdxRuntimeException;
class Lwjgl3GL30 extends Lwjgl3GL20 implements com.badlogic.gdx.graphics.GL30 {
@Override
public void glReadBuffer (int mode) {
GL11.glReadBuffer(mode);
}
@Override
public void glDrawRangeElements (int mode, int start, int end, int count, int type, Buffer indices) {
if (indices instanceof ByteBuffer)
GL12.glDrawRangeElements(mode, start, end, (ByteBuffer)indices);
else if (indices instanceof ShortBuffer)
GL12.glDrawRangeElements(mode, start, end, (ShortBuffer)indices);
else if (indices instanceof IntBuffer)
GL12.glDrawRangeElements(mode, start, end, (IntBuffer)indices);
else
throw new GdxRuntimeException("indices must be byte, short or int buffer");
}
@Override
public void glDrawRangeElements (int mode, int start, int end, int count, int type, int offset) {
GL12.glDrawRangeElements(mode, start, end, count, type, offset);
}
@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
int offset) {
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, offset);
}
@Override
public void glTexImage3D (int target, int level, int internalformat, int width, int height, int depth, int border, int format,
int type, Buffer pixels) {
if (pixels == null)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ByteBuffer)null);
else if (pixels instanceof ByteBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (FloatBuffer)pixels);
else if (pixels instanceof DoubleBuffer)
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, (DoubleBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
}
@Override
public void glTexImage3D (int target, int level, int internalformat, int width, int height, int depth, int border, int format,
int type, int offset) {
GL12.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, offset);
}
@Override
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
int offset) {
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, offset);
}
@Override
public void glTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
int format, int type, Buffer pixels) {
if (pixels instanceof ByteBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (FloatBuffer)pixels);
else if (pixels instanceof DoubleBuffer)
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (DoubleBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
}
@Override
public void glTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth,
int format, int type, int offset) {
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, offset);
}
@Override
public void glCopyTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width,
int height) {
GL12.glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
}
@Override
public void glGenQueries (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
ids[i] = GL15.glGenQueries();
}
}
@Override
public void glGenQueries (int n, IntBuffer ids) {
for (int i = 0; i < n; i++) {
ids.put(GL15.glGenQueries());
}
}
@Override
public void glDeleteQueries (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
GL15.glDeleteQueries(ids[i]);
}
}
@Override
public void glDeleteQueries (int n, IntBuffer ids) {
for (int i = 0; i < n; i++) {
GL15.glDeleteQueries(ids.get());
}
}
@Override
public boolean glIsQuery (int id) {
return GL15.glIsQuery(id);
}
@Override
public void glBeginQuery (int target, int id) {
GL15.glBeginQuery(target, id);
}
@Override
public void glEndQuery (int target) {
GL15.glEndQuery(target);
}
@Override
public void glGetQueryiv (int target, int pname, IntBuffer params) {
GL15.glGetQueryiv(target, pname, params);
}
@Override
public void glGetQueryObjectuiv (int id, int pname, IntBuffer params) {
GL15.glGetQueryObjectuiv(id, pname, params);
}
@Override
public boolean glUnmapBuffer (int target) {
return GL15.glUnmapBuffer(target);
}
@Override
public Buffer glGetBufferPointerv (int target, int pname) {
// FIXME glGetBufferPointerv needs a proper translation
// return GL15.glGetBufferPointer(target, pname);
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void glDrawBuffers (int n, IntBuffer bufs) {
int limit = bufs.limit();
((Buffer)bufs).limit(n);
GL20.glDrawBuffers(bufs);
((Buffer)bufs).limit(limit);
}
@Override
public void glUniformMatrix2x3fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix2x3fv(location, transpose, value);
}
@Override
public void glUniformMatrix3x2fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix3x2fv(location, transpose, value);
}
@Override
public void glUniformMatrix2x4fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix2x4fv(location, transpose, value);
}
@Override
public void glUniformMatrix4x2fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix4x2fv(location, transpose, value);
}
@Override
public void glUniformMatrix3x4fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix3x4fv(location, transpose, value);
}
@Override
public void glUniformMatrix4x3fv (int location, int count, boolean transpose, FloatBuffer value) {
GL21.glUniformMatrix4x3fv(location, transpose, value);
}
@Override
public void glBlitFramebuffer (int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1,
int mask, int filter) {
GL30.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
@Override
public void glBindFramebuffer (int target, int framebuffer) {
GL30.glBindFramebuffer(target, framebuffer);
}
@Override
public void glBindRenderbuffer (int target, int renderbuffer) {
GL30.glBindRenderbuffer(target, renderbuffer);
}
@Override
public int glCheckFramebufferStatus (int target) {
return GL30.glCheckFramebufferStatus(target);
}
@Override
public void glDeleteFramebuffers (int n, IntBuffer framebuffers) {
GL30.glDeleteFramebuffers(framebuffers);
}
@Override
public void glDeleteFramebuffer (int framebuffer) {
GL30.glDeleteFramebuffers(framebuffer);
}
@Override
public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) {
GL30.glDeleteRenderbuffers(renderbuffers);
}
@Override
public void glDeleteRenderbuffer (int renderbuffer) {
GL30.glDeleteRenderbuffers(renderbuffer);
}
@Override
public void glGenerateMipmap (int target) {
GL30.glGenerateMipmap(target);
}
@Override
public void glGenFramebuffers (int n, IntBuffer framebuffers) {
GL30.glGenFramebuffers(framebuffers);
}
@Override
public int glGenFramebuffer () {
return GL30.glGenFramebuffers();
}
@Override
public void glGenRenderbuffers (int n, IntBuffer renderbuffers) {
GL30.glGenRenderbuffers(renderbuffers);
}
@Override
public int glGenRenderbuffer () {
return GL30.glGenRenderbuffers();
}
@Override
public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) {
GL30.glGetRenderbufferParameteriv(target, pname, params);
}
@Override
public boolean glIsFramebuffer (int framebuffer) {
return GL30.glIsFramebuffer(framebuffer);
}
@Override
public boolean glIsRenderbuffer (int renderbuffer) {
return GL30.glIsRenderbuffer(renderbuffer);
}
@Override
public void glRenderbufferStorage (int target, int internalformat, int width, int height) {
GL30.glRenderbufferStorage(target, internalformat, width, height);
}
@Override
public void glRenderbufferStorageMultisample (int target, int samples, int internalformat, int width, int height) {
GL30.glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
}
@Override
public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) {
GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
@Override
public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) {
GL30.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}
@Override
public void glFramebufferTextureLayer (int target, int attachment, int texture, int level, int layer) {
GL30.glFramebufferTextureLayer(target, attachment, texture, level, layer);
}
@Override
public java.nio.Buffer glMapBufferRange (int target, int offset, int length, int access) {
return GL30.glMapBufferRange(target, offset, length, access, null);
}
@Override
public void glFlushMappedBufferRange (int target, int offset, int length) {
GL30.glFlushMappedBufferRange(target, offset, length);
}
@Override
public void glBindVertexArray (int array) {
GL30.glBindVertexArray(array);
}
@Override
public void glDeleteVertexArrays (int n, int[] arrays, int offset) {
for (int i = offset; i < offset + n; i++) {
GL30.glDeleteVertexArrays(arrays[i]);
}
}
@Override
public void glDeleteVertexArrays (int n, IntBuffer arrays) {
GL30.glDeleteVertexArrays(arrays);
}
@Override
public void glGenVertexArrays (int n, int[] arrays, int offset) {
for (int i = offset; i < offset + n; i++) {
arrays[i] = GL30.glGenVertexArrays();
}
}
@Override
public void glGenVertexArrays (int n, IntBuffer arrays) {
GL30.glGenVertexArrays(arrays);
}
@Override
public boolean glIsVertexArray (int array) {
return GL30.glIsVertexArray(array);
}
@Override
public void glBeginTransformFeedback (int primitiveMode) {
GL30.glBeginTransformFeedback(primitiveMode);
}
@Override
public void glEndTransformFeedback () {
GL30.glEndTransformFeedback();
}
@Override
public void glBindBufferRange (int target, int index, int buffer, int offset, int size) {
GL30.glBindBufferRange(target, index, buffer, offset, size);
}
@Override
public void glBindBufferBase (int target, int index, int buffer) {
GL30.glBindBufferBase(target, index, buffer);
}
@Override
public void glTransformFeedbackVaryings (int program, String[] varyings, int bufferMode) {
GL30.glTransformFeedbackVaryings(program, varyings, bufferMode);
}
@Override
public void glVertexAttribIPointer (int index, int size, int type, int stride, int offset) {
GL30.glVertexAttribIPointer(index, size, type, stride, offset);
}
@Override
public void glGetVertexAttribIiv (int index, int pname, IntBuffer params) {
GL30.glGetVertexAttribIiv(index, pname, params);
}
@Override
public void glGetVertexAttribIuiv (int index, int pname, IntBuffer params) {
GL30.glGetVertexAttribIuiv(index, pname, params);
}
@Override
public void glVertexAttribI4i (int index, int x, int y, int z, int w) {
GL30.glVertexAttribI4i(index, x, y, z, w);
}
@Override
public void glVertexAttribI4ui (int index, int x, int y, int z, int w) {
GL30.glVertexAttribI4ui(index, x, y, z, w);
}
@Override
public void glGetUniformuiv (int program, int location, IntBuffer params) {
GL30.glGetUniformuiv(program, location, params);
}
@Override
public int glGetFragDataLocation (int program, String name) {
return GL30.glGetFragDataLocation(program, name);
}
@Override
public void glUniform1uiv (int location, int count, IntBuffer value) {
GL30.glUniform1uiv(location, value);
}
@Override
public void glUniform3uiv (int location, int count, IntBuffer value) {
GL30.glUniform3uiv(location, value);
}
@Override
public void glUniform4uiv (int location, int count, IntBuffer value) {
GL30.glUniform4uiv(location, value);
}
@Override
public void glClearBufferiv (int buffer, int drawbuffer, IntBuffer value) {
GL30.glClearBufferiv(buffer, drawbuffer, value);
}
@Override
public void glClearBufferuiv (int buffer, int drawbuffer, IntBuffer value) {
GL30.glClearBufferuiv(buffer, drawbuffer, value);
}
@Override
public void glClearBufferfv (int buffer, int drawbuffer, FloatBuffer value) {
GL30.glClearBufferfv(buffer, drawbuffer, value);
}
@Override
public void glClearBufferfi (int buffer, int drawbuffer, float depth, int stencil) {
GL30.glClearBufferfi(buffer, drawbuffer, depth, stencil);
}
@Override
public String glGetStringi (int name, int index) {
return GL30.glGetStringi(name, index);
}
@Override
public void glCopyBufferSubData (int readTarget, int writeTarget, int readOffset, int writeOffset, int size) {
GL31.glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
}
@Override
public void glGetUniformIndices (int program, String[] uniformNames, IntBuffer uniformIndices) {
GL31.glGetUniformIndices(program, uniformNames, uniformIndices);
}
@Override
public void glGetActiveUniformsiv (int program, int uniformCount, IntBuffer uniformIndices, int pname, IntBuffer params) {
GL31.glGetActiveUniformsiv(program, uniformIndices, pname, params);
}
@Override
public int glGetUniformBlockIndex (int program, String uniformBlockName) {
return GL31.glGetUniformBlockIndex(program, uniformBlockName);
}
@Override
public void glGetActiveUniformBlockiv (int program, int uniformBlockIndex, int pname, IntBuffer params) {
GL31.glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
}
@Override
public void glGetActiveUniformBlockName (int program, int uniformBlockIndex, Buffer length, Buffer uniformBlockName) {
GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, (IntBuffer)length, (ByteBuffer)uniformBlockName);
}
@Override
public String glGetActiveUniformBlockName (int program, int uniformBlockIndex) {
return GL31.glGetActiveUniformBlockName(program, uniformBlockIndex, 1024);
}
@Override
public void glUniformBlockBinding (int program, int uniformBlockIndex, int uniformBlockBinding) {
GL31.glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
}
@Override
public void glDrawArraysInstanced (int mode, int first, int count, int instanceCount) {
GL31.glDrawArraysInstanced(mode, first, count, instanceCount);
}
@Override
public void glDrawElementsInstanced (int mode, int count, int type, int indicesOffset, int instanceCount) {
GL31.glDrawElementsInstanced(mode, count, type, indicesOffset, instanceCount);
}
@Override
public void glGetInteger64v (int pname, LongBuffer params) {
GL32.glGetInteger64v(pname, params);
}
@Override
public void glGetBufferParameteri64v (int target, int pname, LongBuffer params) {
params.put(GL32.glGetBufferParameteri64(target, pname));
}
@Override
public void glGenSamplers (int count, int[] samplers, int offset) {
for (int i = offset; i < offset + count; i++) {
samplers[i] = GL33.glGenSamplers();
}
}
@Override
public void glGenSamplers (int count, IntBuffer samplers) {
GL33.glGenSamplers(samplers);
}
@Override
public void glDeleteSamplers (int count, int[] samplers, int offset) {
for (int i = offset; i < offset + count; i++) {
GL33.glDeleteSamplers(samplers[i]);
}
}
@Override
public void glDeleteSamplers (int count, IntBuffer samplers) {
GL33.glDeleteSamplers(samplers);
}
@Override
public boolean glIsSampler (int sampler) {
return GL33.glIsSampler(sampler);
}
@Override
public void glBindSampler (int unit, int sampler) {
GL33.glBindSampler(unit, sampler);
}
@Override
public void glSamplerParameteri (int sampler, int pname, int param) {
GL33.glSamplerParameteri(sampler, pname, param);
}
@Override
public void glSamplerParameteriv (int sampler, int pname, IntBuffer param) {
GL33.glSamplerParameteriv(sampler, pname, param);
}
@Override
public void glSamplerParameterf (int sampler, int pname, float param) {
GL33.glSamplerParameterf(sampler, pname, param);
}
@Override
public void glSamplerParameterfv (int sampler, int pname, FloatBuffer param) {
GL33.glSamplerParameterfv(sampler, pname, param);
}
@Override
public void glGetSamplerParameteriv (int sampler, int pname, IntBuffer params) {
GL33.glGetSamplerParameterIiv(sampler, pname, params);
}
@Override
public void glGetSamplerParameterfv (int sampler, int pname, FloatBuffer params) {
GL33.glGetSamplerParameterfv(sampler, pname, params);
}
@Override
public void glVertexAttribDivisor (int index, int divisor) {
GL33.glVertexAttribDivisor(index, divisor);
}
@Override
public void glBindTransformFeedback (int target, int id) {
GL40.glBindTransformFeedback(target, id);
}
@Override
public void glDeleteTransformFeedbacks (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
GL40.glDeleteTransformFeedbacks(ids[i]);
}
}
@Override
public void glDeleteTransformFeedbacks (int n, IntBuffer ids) {
GL40.glDeleteTransformFeedbacks(ids);
}
@Override
public void glGenTransformFeedbacks (int n, int[] ids, int offset) {
for (int i = offset; i < offset + n; i++) {
ids[i] = GL40.glGenTransformFeedbacks();
}
}
@Override
public void glGenTransformFeedbacks (int n, IntBuffer ids) {
GL40.glGenTransformFeedbacks(ids);
}
@Override
public boolean glIsTransformFeedback (int id) {
return GL40.glIsTransformFeedback(id);
}
@Override
public void glPauseTransformFeedback () {
GL40.glPauseTransformFeedback();
}
@Override
public void glResumeTransformFeedback () {
GL40.glResumeTransformFeedback();
}
@Override
public void glProgramParameteri (int program, int pname, int value) {
GL41.glProgramParameteri(program, pname, value);
}
@Override
public void glInvalidateFramebuffer (int target, int numAttachments, IntBuffer attachments) {
GL43.glInvalidateFramebuffer(target, attachments);
}
@Override
public void glInvalidateSubFramebuffer (int target, int numAttachments, IntBuffer attachments, int x, int y, int width,
int height) {
GL43.glInvalidateSubFramebuffer(target, attachments, x, y, width, height);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/shadows/system/BaseShadowSystem.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.g3d.shadows.system;
import java.util.EnumSet;
import java.util.Set;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Cubemap;
import com.badlogic.gdx.graphics.Cubemap.CubemapSide;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g3d.RenderableProvider;
import com.badlogic.gdx.graphics.g3d.environment.BaseLight;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.environment.PointLight;
import com.badlogic.gdx.graphics.g3d.environment.SpotLight;
import com.badlogic.gdx.graphics.g3d.utils.ShaderProvider;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.tests.g3d.shadows.utils.AABBNearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.BoundingSphereDirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.DirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.FixedShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.FrustumLightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.LightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.NearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator.ShadowMapRegion;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectMap.Entries;
/** BaseShadowSystem allows to easily create custom shadow system.
* @author realitix */
public abstract class BaseShadowSystem implements ShadowSystem, Disposable {
/** This class handles camera and texture region.
* @author realitix */
public static class LightProperties {
public Camera camera;
public TextureRegion region = new TextureRegion();
public LightProperties (Camera camera) {
this.camera = camera;
}
}
/** This class handles LightProperties for each side of PointLight.
* @author realitix */
public static class PointLightProperties {
public ObjectMap<CubemapSide, LightProperties> properties = new ObjectMap<CubemapSide, LightProperties>(6);
}
/** Main camera */
protected Camera camera;
/** Renderable providers */
protected Iterable<RenderableProvider> renderableProviders;
/** Cameras linked with spot lights */
protected ObjectMap<SpotLight, LightProperties> spotCameras = new ObjectMap<SpotLight, LightProperties>();
/** Cameras linked with directional lights */
protected ObjectMap<DirectionalLight, LightProperties> dirCameras = new ObjectMap<DirectionalLight, LightProperties>();
/** Cameras linked with point lights */
protected ObjectMap<PointLight, PointLightProperties> pointCameras = new ObjectMap<PointLight, PointLightProperties>();
/** Analyzer of near and far for spot and point lights */
protected NearFarAnalyzer nearFarAnalyzer;
/** Allocator which choose where to render shadow map in texture */
protected ShadowMapAllocator allocator;
/** Analyzer which compute how to create the camera for directional light */
protected DirectionalAnalyzer directionalAnalyzer;
/** Filter that choose if light must be rendered */
protected LightFilter lightFilter;
/** Framebuffer used to render all the depth maps */
protected FrameBuffer[] frameBuffers;
/** Current pass in the depth process */
protected int currentPass = -1;
/** Iterators for cameras */
protected Entries<SpotLight, LightProperties> spotCameraIterator;
protected Entries<DirectionalLight, LightProperties> dirCameraIterator;
protected Entries<PointLight, PointLightProperties> pointCameraIterator;
/** Current side in the point light cubemap */
protected int currentPointSide;
protected PointLightProperties currentPointProperties;
/** Shader providers used by this system */
protected ShaderProvider[] passShaderProviders;
protected ShaderProvider mainShaderProvider;
/** Current light and properties during shadowmap generation */
protected LightProperties currentLightProperties;
protected BaseLight currentLight;
/** Construct the system with the needed params.
* @param nearFarAnalyzer Analyzer of near and far
* @param allocator Allocator of shadow maps
* @param directionalAnalyzer Analyze directional light to create orthographic camera
* @param lightFilter Filter light to render */
public BaseShadowSystem (NearFarAnalyzer nearFarAnalyzer, ShadowMapAllocator allocator,
DirectionalAnalyzer directionalAnalyzer, LightFilter lightFilter) {
this.nearFarAnalyzer = nearFarAnalyzer;
this.allocator = allocator;
this.directionalAnalyzer = directionalAnalyzer;
this.lightFilter = lightFilter;
}
/** Construct the system with default values */
public BaseShadowSystem () {
this(new AABBNearFarAnalyzer(),
new FixedShadowMapAllocator(FixedShadowMapAllocator.QUALITY_MED, FixedShadowMapAllocator.QUANTITY_MAP_MED),
new BoundingSphereDirectionalAnalyzer(), new FrustumLightFilter());
}
/** Initialize framebuffers and shader providers. You should call super.init() in subclass. */
@Override
public void init () {
frameBuffers = new FrameBuffer[getPassQuantity()];
passShaderProviders = new ShaderProvider[getPassQuantity()];
for (int i = 0; i < getPassQuantity(); i++) {
init(i);
}
};
/** Initialize pass n */
protected abstract void init (int n);
/** getPassQuantity should return at leat one. */
@Override
public abstract int getPassQuantity ();
@Override
public ShaderProvider getPassShaderProvider (int n) {
return passShaderProviders[n];
}
@Override
public ShaderProvider getShaderProvider () {
return mainShaderProvider;
}
@Override
public void addLight (SpotLight spot) {
PerspectiveCamera camera = new PerspectiveCamera(spot.cutoffAngle, 0, 0);
camera.position.set(spot.position);
camera.direction.set(spot.direction);
camera.near = 1;
camera.far = 100;
camera.up.set(camera.direction.y, camera.direction.z, camera.direction.x);
spotCameras.put(spot, new LightProperties(camera));
}
@Override
public void addLight (DirectionalLight dir) {
OrthographicCamera camera = new OrthographicCamera();
camera.direction.set(dir.direction);
camera.near = 1;
camera.far = 100;
dirCameras.put(dir, new LightProperties(camera));
}
@Override
public void addLight (PointLight point) {
addLight(point, EnumSet.of(CubemapSide.PositiveX, CubemapSide.NegativeX, CubemapSide.PositiveY, CubemapSide.NegativeY,
CubemapSide.PositiveZ, CubemapSide.NegativeZ));
}
@Override
public void addLight (PointLight point, Set<CubemapSide> sides) {
PointLightProperties plProperty = new PointLightProperties();
for (int i = 0; i < 6; i++) {
CubemapSide cubemapSide = Cubemap.CubemapSide.values()[i];
if (sides.contains(cubemapSide)) {
PerspectiveCamera camera = new PerspectiveCamera(90, 0, 0);
camera.position.set(point.position);
camera.direction.set(cubemapSide.direction);
camera.up.set(cubemapSide.up);
camera.near = 1;
camera.far = 100;
LightProperties p = new LightProperties(camera);
plProperty.properties.put(cubemapSide, p);
}
}
pointCameras.put(point, plProperty);
}
@Override
public void removeLight (SpotLight spot) {
spotCameras.remove(spot);
}
@Override
public void removeLight (DirectionalLight dir) {
dirCameras.remove(dir);
}
@Override
public void removeLight (PointLight point) {
pointCameras.remove(point);
}
@Override
public boolean hasLight (SpotLight spot) {
if (spotCameras.containsKey(spot)) return true;
return false;
}
@Override
public boolean hasLight (DirectionalLight dir) {
if (dirCameras.containsKey(dir)) return true;
return false;
}
@Override
public boolean hasLight (PointLight point) {
if (pointCameras.containsKey(point)) return true;
return false;
}
@Override
public void update () {
for (ObjectMap.Entry<SpotLight, LightProperties> e : spotCameras) {
e.value.camera.position.set(e.key.position);
e.value.camera.direction.set(e.key.direction);
nearFarAnalyzer.analyze(e.key, e.value.camera, renderableProviders);
}
for (ObjectMap.Entry<DirectionalLight, LightProperties> e : dirCameras) {
directionalAnalyzer.analyze(e.key, e.value.camera, camera).update();
}
for (ObjectMap.Entry<PointLight, PointLightProperties> e : pointCameras) {
for (ObjectMap.Entry<CubemapSide, LightProperties> c : e.value.properties) {
c.value.camera.position.set(e.key.position);
nearFarAnalyzer.analyze(e.key, c.value.camera, renderableProviders);
}
}
}
@Override
public <T extends RenderableProvider> void begin (Camera camera, final Iterable<T> renderableProviders) {
if (this.renderableProviders != null || this.camera != null) throw new GdxRuntimeException("Call end() first.");
this.camera = camera;
this.renderableProviders = (Iterable<RenderableProvider>)renderableProviders;
}
@Override
public void begin (int n) {
if (n >= passShaderProviders.length)
throw new GdxRuntimeException("Pass " + n + " doesn't exist in " + getClass().getName());
currentPass = n;
spotCameraIterator = spotCameras.iterator();
dirCameraIterator = dirCameras.iterator();
pointCameraIterator = pointCameras.iterator();
currentPointSide = 6;
beginPass(n);
}
/** Begin pass n.
* @param n Pass number */
protected void beginPass (int n) {
frameBuffers[n].begin();
};
@Override
public void end () {
this.camera = null;
this.renderableProviders = null;
currentPass = -1;
}
@Override
public void end (int n) {
if (currentPass != n) throw new GdxRuntimeException("Begin " + n + " must be called before end " + n);
endPass(n);
}
/** End pass n.
* @param n Pass number */
protected void endPass (int n) {
frameBuffers[n].end();
}
@Override
public Camera next () {
LightProperties lp = nextDirectional();
if (lp != null) return interceptCamera(lp);
lp = nextSpot();
if (lp != null) return interceptCamera(lp);
lp = nextPoint();
if (lp != null) return interceptCamera(lp);
return null;
}
/** Allows to return custom camera if needed.
* @param lp Returned LightProperties
* @return Camera */
protected Camera interceptCamera (LightProperties lp) {
return lp.camera;
}
protected LightProperties nextDirectional () {
if (!dirCameraIterator.hasNext()) return null;
ObjectMap.Entry<DirectionalLight, LightProperties> e = dirCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
processViewport(lp, false);
return lp;
}
protected LightProperties nextSpot () {
if (!spotCameraIterator.hasNext()) return null;
ObjectMap.Entry<SpotLight, LightProperties> e = spotCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
if (!lightFilter.filter(spotCameras.findKey(lp, true), lp.camera, this.camera)) {
return nextSpot();
}
processViewport(lp, true);
return lp;
}
protected LightProperties nextPoint () {
if (!pointCameraIterator.hasNext() && currentPointSide > 5) return null;
if (currentPointSide > 5) currentPointSide = 0;
if (currentPointSide == 0) {
ObjectMap.Entry<PointLight, PointLightProperties> e = pointCameraIterator.next();
currentLight = e.key;
currentPointProperties = e.value;
}
if (currentPointProperties.properties.containsKey(Cubemap.CubemapSide.values()[currentPointSide])) {
LightProperties lp = currentPointProperties.properties.get(Cubemap.CubemapSide.values()[currentPointSide]);
currentLightProperties = lp;
currentPointSide += 1;
if (!lightFilter.filter(pointCameras.findKey(currentPointProperties, true), lp.camera, this.camera)) {
return nextPoint();
}
processViewport(lp, true);
return lp;
}
currentPointSide += 1;
return nextPoint();
}
/** Set viewport according to allocator.
* @param lp LightProperties to process.
* @param cameraViewport Set camera viewport if true. */
protected void processViewport (LightProperties lp, boolean cameraViewport) {
Camera camera = lp.camera;
ShadowMapRegion r = allocator.nextResult(currentLight);
if (r == null) return;
TextureRegion region = lp.region;
region.setTexture(frameBuffers[currentPass].getColorBufferTexture());
// We don't use HdpiUtils
// gl commands related to shadow map size and not to screen size
Gdx.gl.glViewport(r.x, r.y, r.width, r.height);
Gdx.gl.glScissor(r.x + 1, r.y + 1, r.width - 2, r.height - 2);
region.setRegion(r.x, r.y, r.width, r.height);
if (cameraViewport) {
camera.viewportHeight = r.height;
camera.viewportWidth = r.width;
camera.update();
}
}
public ObjectMap<DirectionalLight, LightProperties> getDirectionalCameras () {
return dirCameras;
}
public ObjectMap<SpotLight, LightProperties> getSpotCameras () {
return spotCameras;
}
public ObjectMap<PointLight, PointLightProperties> getPointCameras () {
return pointCameras;
}
public Texture getTexture (int n) {
if (n >= getPassQuantity()) throw new GdxRuntimeException("Can't get texture " + n);
return frameBuffers[n].getColorBufferTexture();
}
public LightProperties getCurrentLightProperties () {
return currentLightProperties;
}
public BaseLight getCurrentLight () {
return currentLight;
}
public int getCurrentPass () {
return currentPass;
}
@Override
public void dispose () {
for (int i = 0; i < getPassQuantity(); i++) {
frameBuffers[i].dispose();
passShaderProviders[i].dispose();
}
mainShaderProvider.dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.g3d.shadows.system;
import java.util.EnumSet;
import java.util.Set;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Cubemap;
import com.badlogic.gdx.graphics.Cubemap.CubemapSide;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g3d.RenderableProvider;
import com.badlogic.gdx.graphics.g3d.environment.BaseLight;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.environment.PointLight;
import com.badlogic.gdx.graphics.g3d.environment.SpotLight;
import com.badlogic.gdx.graphics.g3d.utils.ShaderProvider;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.tests.g3d.shadows.utils.AABBNearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.BoundingSphereDirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.DirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.FixedShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.FrustumLightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.LightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.NearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator.ShadowMapRegion;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectMap.Entries;
/** BaseShadowSystem allows to easily create custom shadow system.
* @author realitix */
public abstract class BaseShadowSystem implements ShadowSystem, Disposable {
/** This class handles camera and texture region.
* @author realitix */
public static class LightProperties {
public Camera camera;
public TextureRegion region = new TextureRegion();
public LightProperties (Camera camera) {
this.camera = camera;
}
}
/** This class handles LightProperties for each side of PointLight.
* @author realitix */
public static class PointLightProperties {
public ObjectMap<CubemapSide, LightProperties> properties = new ObjectMap<CubemapSide, LightProperties>(6);
}
/** Main camera */
protected Camera camera;
/** Renderable providers */
protected Iterable<RenderableProvider> renderableProviders;
/** Cameras linked with spot lights */
protected ObjectMap<SpotLight, LightProperties> spotCameras = new ObjectMap<SpotLight, LightProperties>();
/** Cameras linked with directional lights */
protected ObjectMap<DirectionalLight, LightProperties> dirCameras = new ObjectMap<DirectionalLight, LightProperties>();
/** Cameras linked with point lights */
protected ObjectMap<PointLight, PointLightProperties> pointCameras = new ObjectMap<PointLight, PointLightProperties>();
/** Analyzer of near and far for spot and point lights */
protected NearFarAnalyzer nearFarAnalyzer;
/** Allocator which choose where to render shadow map in texture */
protected ShadowMapAllocator allocator;
/** Analyzer which compute how to create the camera for directional light */
protected DirectionalAnalyzer directionalAnalyzer;
/** Filter that choose if light must be rendered */
protected LightFilter lightFilter;
/** Framebuffer used to render all the depth maps */
protected FrameBuffer[] frameBuffers;
/** Current pass in the depth process */
protected int currentPass = -1;
/** Iterators for cameras */
protected Entries<SpotLight, LightProperties> spotCameraIterator;
protected Entries<DirectionalLight, LightProperties> dirCameraIterator;
protected Entries<PointLight, PointLightProperties> pointCameraIterator;
/** Current side in the point light cubemap */
protected int currentPointSide;
protected PointLightProperties currentPointProperties;
/** Shader providers used by this system */
protected ShaderProvider[] passShaderProviders;
protected ShaderProvider mainShaderProvider;
/** Current light and properties during shadowmap generation */
protected LightProperties currentLightProperties;
protected BaseLight currentLight;
/** Construct the system with the needed params.
* @param nearFarAnalyzer Analyzer of near and far
* @param allocator Allocator of shadow maps
* @param directionalAnalyzer Analyze directional light to create orthographic camera
* @param lightFilter Filter light to render */
public BaseShadowSystem (NearFarAnalyzer nearFarAnalyzer, ShadowMapAllocator allocator,
DirectionalAnalyzer directionalAnalyzer, LightFilter lightFilter) {
this.nearFarAnalyzer = nearFarAnalyzer;
this.allocator = allocator;
this.directionalAnalyzer = directionalAnalyzer;
this.lightFilter = lightFilter;
}
/** Construct the system with default values */
public BaseShadowSystem () {
this(new AABBNearFarAnalyzer(),
new FixedShadowMapAllocator(FixedShadowMapAllocator.QUALITY_MED, FixedShadowMapAllocator.QUANTITY_MAP_MED),
new BoundingSphereDirectionalAnalyzer(), new FrustumLightFilter());
}
/** Initialize framebuffers and shader providers. You should call super.init() in subclass. */
@Override
public void init () {
frameBuffers = new FrameBuffer[getPassQuantity()];
passShaderProviders = new ShaderProvider[getPassQuantity()];
for (int i = 0; i < getPassQuantity(); i++) {
init(i);
}
};
/** Initialize pass n */
protected abstract void init (int n);
/** getPassQuantity should return at leat one. */
@Override
public abstract int getPassQuantity ();
@Override
public ShaderProvider getPassShaderProvider (int n) {
return passShaderProviders[n];
}
@Override
public ShaderProvider getShaderProvider () {
return mainShaderProvider;
}
@Override
public void addLight (SpotLight spot) {
PerspectiveCamera camera = new PerspectiveCamera(spot.cutoffAngle, 0, 0);
camera.position.set(spot.position);
camera.direction.set(spot.direction);
camera.near = 1;
camera.far = 100;
camera.up.set(camera.direction.y, camera.direction.z, camera.direction.x);
spotCameras.put(spot, new LightProperties(camera));
}
@Override
public void addLight (DirectionalLight dir) {
OrthographicCamera camera = new OrthographicCamera();
camera.direction.set(dir.direction);
camera.near = 1;
camera.far = 100;
dirCameras.put(dir, new LightProperties(camera));
}
@Override
public void addLight (PointLight point) {
addLight(point, EnumSet.of(CubemapSide.PositiveX, CubemapSide.NegativeX, CubemapSide.PositiveY, CubemapSide.NegativeY,
CubemapSide.PositiveZ, CubemapSide.NegativeZ));
}
@Override
public void addLight (PointLight point, Set<CubemapSide> sides) {
PointLightProperties plProperty = new PointLightProperties();
for (int i = 0; i < 6; i++) {
CubemapSide cubemapSide = Cubemap.CubemapSide.values()[i];
if (sides.contains(cubemapSide)) {
PerspectiveCamera camera = new PerspectiveCamera(90, 0, 0);
camera.position.set(point.position);
camera.direction.set(cubemapSide.direction);
camera.up.set(cubemapSide.up);
camera.near = 1;
camera.far = 100;
LightProperties p = new LightProperties(camera);
plProperty.properties.put(cubemapSide, p);
}
}
pointCameras.put(point, plProperty);
}
@Override
public void removeLight (SpotLight spot) {
spotCameras.remove(spot);
}
@Override
public void removeLight (DirectionalLight dir) {
dirCameras.remove(dir);
}
@Override
public void removeLight (PointLight point) {
pointCameras.remove(point);
}
@Override
public boolean hasLight (SpotLight spot) {
if (spotCameras.containsKey(spot)) return true;
return false;
}
@Override
public boolean hasLight (DirectionalLight dir) {
if (dirCameras.containsKey(dir)) return true;
return false;
}
@Override
public boolean hasLight (PointLight point) {
if (pointCameras.containsKey(point)) return true;
return false;
}
@Override
public void update () {
for (ObjectMap.Entry<SpotLight, LightProperties> e : spotCameras) {
e.value.camera.position.set(e.key.position);
e.value.camera.direction.set(e.key.direction);
nearFarAnalyzer.analyze(e.key, e.value.camera, renderableProviders);
}
for (ObjectMap.Entry<DirectionalLight, LightProperties> e : dirCameras) {
directionalAnalyzer.analyze(e.key, e.value.camera, camera).update();
}
for (ObjectMap.Entry<PointLight, PointLightProperties> e : pointCameras) {
for (ObjectMap.Entry<CubemapSide, LightProperties> c : e.value.properties) {
c.value.camera.position.set(e.key.position);
nearFarAnalyzer.analyze(e.key, c.value.camera, renderableProviders);
}
}
}
@Override
public <T extends RenderableProvider> void begin (Camera camera, final Iterable<T> renderableProviders) {
if (this.renderableProviders != null || this.camera != null) throw new GdxRuntimeException("Call end() first.");
this.camera = camera;
this.renderableProviders = (Iterable<RenderableProvider>)renderableProviders;
}
@Override
public void begin (int n) {
if (n >= passShaderProviders.length)
throw new GdxRuntimeException("Pass " + n + " doesn't exist in " + getClass().getName());
currentPass = n;
spotCameraIterator = spotCameras.iterator();
dirCameraIterator = dirCameras.iterator();
pointCameraIterator = pointCameras.iterator();
currentPointSide = 6;
beginPass(n);
}
/** Begin pass n.
* @param n Pass number */
protected void beginPass (int n) {
frameBuffers[n].begin();
};
@Override
public void end () {
this.camera = null;
this.renderableProviders = null;
currentPass = -1;
}
@Override
public void end (int n) {
if (currentPass != n) throw new GdxRuntimeException("Begin " + n + " must be called before end " + n);
endPass(n);
}
/** End pass n.
* @param n Pass number */
protected void endPass (int n) {
frameBuffers[n].end();
}
@Override
public Camera next () {
LightProperties lp = nextDirectional();
if (lp != null) return interceptCamera(lp);
lp = nextSpot();
if (lp != null) return interceptCamera(lp);
lp = nextPoint();
if (lp != null) return interceptCamera(lp);
return null;
}
/** Allows to return custom camera if needed.
* @param lp Returned LightProperties
* @return Camera */
protected Camera interceptCamera (LightProperties lp) {
return lp.camera;
}
protected LightProperties nextDirectional () {
if (!dirCameraIterator.hasNext()) return null;
ObjectMap.Entry<DirectionalLight, LightProperties> e = dirCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
processViewport(lp, false);
return lp;
}
protected LightProperties nextSpot () {
if (!spotCameraIterator.hasNext()) return null;
ObjectMap.Entry<SpotLight, LightProperties> e = spotCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
if (!lightFilter.filter(spotCameras.findKey(lp, true), lp.camera, this.camera)) {
return nextSpot();
}
processViewport(lp, true);
return lp;
}
protected LightProperties nextPoint () {
if (!pointCameraIterator.hasNext() && currentPointSide > 5) return null;
if (currentPointSide > 5) currentPointSide = 0;
if (currentPointSide == 0) {
ObjectMap.Entry<PointLight, PointLightProperties> e = pointCameraIterator.next();
currentLight = e.key;
currentPointProperties = e.value;
}
if (currentPointProperties.properties.containsKey(Cubemap.CubemapSide.values()[currentPointSide])) {
LightProperties lp = currentPointProperties.properties.get(Cubemap.CubemapSide.values()[currentPointSide]);
currentLightProperties = lp;
currentPointSide += 1;
if (!lightFilter.filter(pointCameras.findKey(currentPointProperties, true), lp.camera, this.camera)) {
return nextPoint();
}
processViewport(lp, true);
return lp;
}
currentPointSide += 1;
return nextPoint();
}
/** Set viewport according to allocator.
* @param lp LightProperties to process.
* @param cameraViewport Set camera viewport if true. */
protected void processViewport (LightProperties lp, boolean cameraViewport) {
Camera camera = lp.camera;
ShadowMapRegion r = allocator.nextResult(currentLight);
if (r == null) return;
TextureRegion region = lp.region;
region.setTexture(frameBuffers[currentPass].getColorBufferTexture());
// We don't use HdpiUtils
// gl commands related to shadow map size and not to screen size
Gdx.gl.glViewport(r.x, r.y, r.width, r.height);
Gdx.gl.glScissor(r.x + 1, r.y + 1, r.width - 2, r.height - 2);
region.setRegion(r.x, r.y, r.width, r.height);
if (cameraViewport) {
camera.viewportHeight = r.height;
camera.viewportWidth = r.width;
camera.update();
}
}
public ObjectMap<DirectionalLight, LightProperties> getDirectionalCameras () {
return dirCameras;
}
public ObjectMap<SpotLight, LightProperties> getSpotCameras () {
return spotCameras;
}
public ObjectMap<PointLight, PointLightProperties> getPointCameras () {
return pointCameras;
}
public Texture getTexture (int n) {
if (n >= getPassQuantity()) throw new GdxRuntimeException("Can't get texture " + n);
return frameBuffers[n].getColorBufferTexture();
}
public LightProperties getCurrentLightProperties () {
return currentLightProperties;
}
public BaseLight getCurrentLight () {
return currentLight;
}
public int getCurrentPass () {
return currentPass;
}
@Override
public void dispose () {
for (int i = 0; i < getPassQuantity(); i++) {
frameBuffers[i].dispose();
passShaderProviders[i].dispose();
}
mainShaderProvider.dispose();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/box2d/BodyTypes.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
* Copyright 2010 Mario Zechner ([email protected]), Nathan Sweet ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.badlogic.gdx.tests.box2d;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.EdgeShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.joints.PrismaticJointDef;
import com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef;
public class BodyTypes extends Box2DTest {
Body m_attachment;
Body m_platform;
float m_speed;
@Override
protected void createWorld (World world) {
Body ground;
{
BodyDef bd = new BodyDef();
ground = world.createBody(bd);
EdgeShape shape = new EdgeShape();
shape.set(new Vector2(-20, 0), new Vector2(20, 0));
FixtureDef fd = new FixtureDef();
fd.shape = shape;
ground.createFixture(fd);
shape.dispose();
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 3.0f);
m_attachment = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(0.5f, 2.0f);
m_attachment.createFixture(shape, 2.0f);
shape.dispose();
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(-4.0f, 5.0f);
m_platform = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(0.5f, 4.0f, new Vector2(4.0f, 0), 0.5f * (float)Math.PI);
FixtureDef fd = new FixtureDef();
fd.shape = shape;
fd.friction = 0.6f;
fd.density = 2.0f;
m_platform.createFixture(fd);
shape.dispose();
RevoluteJointDef rjd = new RevoluteJointDef();
rjd.initialize(m_attachment, m_platform, new Vector2(0, 5.0f));
rjd.maxMotorTorque = 50.0f;
rjd.enableMotor = true;
world.createJoint(rjd);
PrismaticJointDef pjd = new PrismaticJointDef();
pjd.initialize(ground, m_platform, new Vector2(0, 5.0f), new Vector2(1, 0));
pjd.maxMotorForce = 1000.0f;
pjd.enableMotor = true;
pjd.lowerTranslation = -10f;
pjd.upperTranslation = 10.0f;
pjd.enableLimit = true;
world.createJoint(pjd);
m_speed = 3.0f;
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 8.0f);
Body body = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(0.75f, 0.75f);
FixtureDef fd = new FixtureDef();
fd.shape = shape;
fd.friction = 0.6f;
fd.density = 2.0f;
body.createFixture(fd);
shape.dispose();
}
}
private final Vector2 tmp = new Vector2();
@Override
public boolean keyDown (int keyCode) {
if (keyCode == Keys.D) m_platform.setType(BodyType.DynamicBody);
if (keyCode == Keys.S) m_platform.setType(BodyType.StaticBody);
if (keyCode == Keys.K) {
m_platform.setType(BodyType.KinematicBody);
m_platform.setLinearVelocity(tmp.set(-m_speed, 0));
m_platform.setAngularVelocity(0);
}
return false;
}
@Override
public void render () {
if (m_platform.getType() == BodyType.KinematicBody) {
Vector2 p = m_platform.getTransform().getPosition();
Vector2 v = m_platform.getLinearVelocity();
if ((p.x < -10 && v.x < 0) || (p.x > 10 && v.x > 0)) {
v.x = -v.x;
m_platform.setLinearVelocity(v);
}
}
super.render();
// if (renderer.batch != null) {
// renderer.batch.begin();
// // renderer.batch.drawText(renderer.font, "Keys: (d) dynamic, (s) static, (k) kinematic", 0, Gdx.app.getGraphics()
// // .getHeight(), Color.WHITE);
// renderer.batch.end();
// }
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
* Copyright 2010 Mario Zechner ([email protected]), Nathan Sweet ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.badlogic.gdx.tests.box2d;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.EdgeShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.joints.PrismaticJointDef;
import com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef;
public class BodyTypes extends Box2DTest {
Body m_attachment;
Body m_platform;
float m_speed;
@Override
protected void createWorld (World world) {
Body ground;
{
BodyDef bd = new BodyDef();
ground = world.createBody(bd);
EdgeShape shape = new EdgeShape();
shape.set(new Vector2(-20, 0), new Vector2(20, 0));
FixtureDef fd = new FixtureDef();
fd.shape = shape;
ground.createFixture(fd);
shape.dispose();
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 3.0f);
m_attachment = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(0.5f, 2.0f);
m_attachment.createFixture(shape, 2.0f);
shape.dispose();
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(-4.0f, 5.0f);
m_platform = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(0.5f, 4.0f, new Vector2(4.0f, 0), 0.5f * (float)Math.PI);
FixtureDef fd = new FixtureDef();
fd.shape = shape;
fd.friction = 0.6f;
fd.density = 2.0f;
m_platform.createFixture(fd);
shape.dispose();
RevoluteJointDef rjd = new RevoluteJointDef();
rjd.initialize(m_attachment, m_platform, new Vector2(0, 5.0f));
rjd.maxMotorTorque = 50.0f;
rjd.enableMotor = true;
world.createJoint(rjd);
PrismaticJointDef pjd = new PrismaticJointDef();
pjd.initialize(ground, m_platform, new Vector2(0, 5.0f), new Vector2(1, 0));
pjd.maxMotorForce = 1000.0f;
pjd.enableMotor = true;
pjd.lowerTranslation = -10f;
pjd.upperTranslation = 10.0f;
pjd.enableLimit = true;
world.createJoint(pjd);
m_speed = 3.0f;
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 8.0f);
Body body = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(0.75f, 0.75f);
FixtureDef fd = new FixtureDef();
fd.shape = shape;
fd.friction = 0.6f;
fd.density = 2.0f;
body.createFixture(fd);
shape.dispose();
}
}
private final Vector2 tmp = new Vector2();
@Override
public boolean keyDown (int keyCode) {
if (keyCode == Keys.D) m_platform.setType(BodyType.DynamicBody);
if (keyCode == Keys.S) m_platform.setType(BodyType.StaticBody);
if (keyCode == Keys.K) {
m_platform.setType(BodyType.KinematicBody);
m_platform.setLinearVelocity(tmp.set(-m_speed, 0));
m_platform.setAngularVelocity(0);
}
return false;
}
@Override
public void render () {
if (m_platform.getType() == BodyType.KinematicBody) {
Vector2 p = m_platform.getTransform().getPosition();
Vector2 v = m_platform.getLinearVelocity();
if ((p.x < -10 && v.x < 0) || (p.x > 10 && v.x > 0)) {
v.x = -v.x;
m_platform.setLinearVelocity(v);
}
}
super.render();
// if (renderer.batch != null) {
// renderer.batch.begin();
// // renderer.batch.drawText(renderer.font, "Keys: (d) dynamic, (s) static, (k) kinematic", 0, Gdx.app.getGraphics()
// // .getHeight(), Color.WHITE);
// renderer.batch.end();
// }
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btQuantizedBvhDoubleData.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btQuantizedBvhDoubleData extends BulletBase {
private long swigCPtr;
protected btQuantizedBvhDoubleData (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btQuantizedBvhDoubleData, normally you should not need this constructor it's intended for low-level
* usage. */
public btQuantizedBvhDoubleData (long cPtr, boolean cMemoryOwn) {
this("btQuantizedBvhDoubleData", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btQuantizedBvhDoubleData obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btQuantizedBvhDoubleData(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setBvhAabbMin (btVector3DoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMin_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getBvhAabbMin () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMin_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setBvhAabbMax (btVector3DoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMax_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getBvhAabbMax () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMax_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setBvhQuantization (btVector3DoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_bvhQuantization_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getBvhQuantization () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_bvhQuantization_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setCurNodeIndex (int value) {
CollisionJNI.btQuantizedBvhDoubleData_curNodeIndex_set(swigCPtr, this, value);
}
public int getCurNodeIndex () {
return CollisionJNI.btQuantizedBvhDoubleData_curNodeIndex_get(swigCPtr, this);
}
public void setUseQuantization (int value) {
CollisionJNI.btQuantizedBvhDoubleData_useQuantization_set(swigCPtr, this, value);
}
public int getUseQuantization () {
return CollisionJNI.btQuantizedBvhDoubleData_useQuantization_get(swigCPtr, this);
}
public void setNumContiguousLeafNodes (int value) {
CollisionJNI.btQuantizedBvhDoubleData_numContiguousLeafNodes_set(swigCPtr, this, value);
}
public int getNumContiguousLeafNodes () {
return CollisionJNI.btQuantizedBvhDoubleData_numContiguousLeafNodes_get(swigCPtr, this);
}
public void setNumQuantizedContiguousNodes (int value) {
CollisionJNI.btQuantizedBvhDoubleData_numQuantizedContiguousNodes_set(swigCPtr, this, value);
}
public int getNumQuantizedContiguousNodes () {
return CollisionJNI.btQuantizedBvhDoubleData_numQuantizedContiguousNodes_get(swigCPtr, this);
}
public void setContiguousNodesPtr (btOptimizedBvhNodeDoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_contiguousNodesPtr_set(swigCPtr, this, btOptimizedBvhNodeDoubleData.getCPtr(value),
value);
}
public btOptimizedBvhNodeDoubleData getContiguousNodesPtr () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_contiguousNodesPtr_get(swigCPtr, this);
return (cPtr == 0) ? null : new btOptimizedBvhNodeDoubleData(cPtr, false);
}
public void setQuantizedContiguousNodesPtr (btQuantizedBvhNodeData value) {
CollisionJNI.btQuantizedBvhDoubleData_quantizedContiguousNodesPtr_set(swigCPtr, this, btQuantizedBvhNodeData.getCPtr(value),
value);
}
public btQuantizedBvhNodeData getQuantizedContiguousNodesPtr () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_quantizedContiguousNodesPtr_get(swigCPtr, this);
return (cPtr == 0) ? null : new btQuantizedBvhNodeData(cPtr, false);
}
public void setTraversalMode (int value) {
CollisionJNI.btQuantizedBvhDoubleData_traversalMode_set(swigCPtr, this, value);
}
public int getTraversalMode () {
return CollisionJNI.btQuantizedBvhDoubleData_traversalMode_get(swigCPtr, this);
}
public void setNumSubtreeHeaders (int value) {
CollisionJNI.btQuantizedBvhDoubleData_numSubtreeHeaders_set(swigCPtr, this, value);
}
public int getNumSubtreeHeaders () {
return CollisionJNI.btQuantizedBvhDoubleData_numSubtreeHeaders_get(swigCPtr, this);
}
public void setSubTreeInfoPtr (btBvhSubtreeInfoData value) {
CollisionJNI.btQuantizedBvhDoubleData_subTreeInfoPtr_set(swigCPtr, this, btBvhSubtreeInfoData.getCPtr(value), value);
}
public btBvhSubtreeInfoData getSubTreeInfoPtr () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_subTreeInfoPtr_get(swigCPtr, this);
return (cPtr == 0) ? null : new btBvhSubtreeInfoData(cPtr, false);
}
public btQuantizedBvhDoubleData () {
this(CollisionJNI.new_btQuantizedBvhDoubleData(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btQuantizedBvhDoubleData extends BulletBase {
private long swigCPtr;
protected btQuantizedBvhDoubleData (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btQuantizedBvhDoubleData, normally you should not need this constructor it's intended for low-level
* usage. */
public btQuantizedBvhDoubleData (long cPtr, boolean cMemoryOwn) {
this("btQuantizedBvhDoubleData", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btQuantizedBvhDoubleData obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btQuantizedBvhDoubleData(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setBvhAabbMin (btVector3DoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMin_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getBvhAabbMin () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMin_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setBvhAabbMax (btVector3DoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMax_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getBvhAabbMax () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_bvhAabbMax_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setBvhQuantization (btVector3DoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_bvhQuantization_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getBvhQuantization () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_bvhQuantization_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setCurNodeIndex (int value) {
CollisionJNI.btQuantizedBvhDoubleData_curNodeIndex_set(swigCPtr, this, value);
}
public int getCurNodeIndex () {
return CollisionJNI.btQuantizedBvhDoubleData_curNodeIndex_get(swigCPtr, this);
}
public void setUseQuantization (int value) {
CollisionJNI.btQuantizedBvhDoubleData_useQuantization_set(swigCPtr, this, value);
}
public int getUseQuantization () {
return CollisionJNI.btQuantizedBvhDoubleData_useQuantization_get(swigCPtr, this);
}
public void setNumContiguousLeafNodes (int value) {
CollisionJNI.btQuantizedBvhDoubleData_numContiguousLeafNodes_set(swigCPtr, this, value);
}
public int getNumContiguousLeafNodes () {
return CollisionJNI.btQuantizedBvhDoubleData_numContiguousLeafNodes_get(swigCPtr, this);
}
public void setNumQuantizedContiguousNodes (int value) {
CollisionJNI.btQuantizedBvhDoubleData_numQuantizedContiguousNodes_set(swigCPtr, this, value);
}
public int getNumQuantizedContiguousNodes () {
return CollisionJNI.btQuantizedBvhDoubleData_numQuantizedContiguousNodes_get(swigCPtr, this);
}
public void setContiguousNodesPtr (btOptimizedBvhNodeDoubleData value) {
CollisionJNI.btQuantizedBvhDoubleData_contiguousNodesPtr_set(swigCPtr, this, btOptimizedBvhNodeDoubleData.getCPtr(value),
value);
}
public btOptimizedBvhNodeDoubleData getContiguousNodesPtr () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_contiguousNodesPtr_get(swigCPtr, this);
return (cPtr == 0) ? null : new btOptimizedBvhNodeDoubleData(cPtr, false);
}
public void setQuantizedContiguousNodesPtr (btQuantizedBvhNodeData value) {
CollisionJNI.btQuantizedBvhDoubleData_quantizedContiguousNodesPtr_set(swigCPtr, this, btQuantizedBvhNodeData.getCPtr(value),
value);
}
public btQuantizedBvhNodeData getQuantizedContiguousNodesPtr () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_quantizedContiguousNodesPtr_get(swigCPtr, this);
return (cPtr == 0) ? null : new btQuantizedBvhNodeData(cPtr, false);
}
public void setTraversalMode (int value) {
CollisionJNI.btQuantizedBvhDoubleData_traversalMode_set(swigCPtr, this, value);
}
public int getTraversalMode () {
return CollisionJNI.btQuantizedBvhDoubleData_traversalMode_get(swigCPtr, this);
}
public void setNumSubtreeHeaders (int value) {
CollisionJNI.btQuantizedBvhDoubleData_numSubtreeHeaders_set(swigCPtr, this, value);
}
public int getNumSubtreeHeaders () {
return CollisionJNI.btQuantizedBvhDoubleData_numSubtreeHeaders_get(swigCPtr, this);
}
public void setSubTreeInfoPtr (btBvhSubtreeInfoData value) {
CollisionJNI.btQuantizedBvhDoubleData_subTreeInfoPtr_set(swigCPtr, this, btBvhSubtreeInfoData.getCPtr(value), value);
}
public btBvhSubtreeInfoData getSubTreeInfoPtr () {
long cPtr = CollisionJNI.btQuantizedBvhDoubleData_subTreeInfoPtr_get(swigCPtr, this);
return (cPtr == 0) ? null : new btBvhSubtreeInfoData(cPtr, false);
}
public btQuantizedBvhDoubleData () {
this(CollisionJNI.new_btQuantizedBvhDoubleData(), true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/g3d/particles/ParticleSystem.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.RenderableProvider;
import com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
/** Singleton class which manages the particle effects. It's a utility class to ease particle batches management and particle
* effects update.
* @author inferno */
public final class ParticleSystem implements RenderableProvider {
private static ParticleSystem instance;
/** @deprecated Please directly use the constructor */
@Deprecated
public static ParticleSystem get () {
if (instance == null) instance = new ParticleSystem();
return instance;
}
private Array<ParticleBatch<?>> batches;
private Array<ParticleEffect> effects;
public ParticleSystem () {
batches = new Array<ParticleBatch<?>>();
effects = new Array<ParticleEffect>();
}
public void add (ParticleBatch<?> batch) {
batches.add(batch);
}
public void add (ParticleEffect effect) {
effects.add(effect);
}
public void remove (ParticleEffect effect) {
effects.removeValue(effect, true);
}
/** Removes all the effects added to the system */
public void removeAll () {
effects.clear();
}
/** Updates the simulation of all effects */
public void update () {
for (ParticleEffect effect : effects) {
effect.update();
}
}
public void updateAndDraw () {
for (ParticleEffect effect : effects) {
effect.update();
effect.draw();
}
}
public void update (float deltaTime) {
for (ParticleEffect effect : effects) {
effect.update(deltaTime);
}
}
public void updateAndDraw (float deltaTime) {
for (ParticleEffect effect : effects) {
effect.update(deltaTime);
effect.draw();
}
}
/** Must be called one time per frame before any particle effect drawing operation will occur. */
public void begin () {
for (ParticleBatch<?> batch : batches)
batch.begin();
}
/** Draws all the particle effects. Call {@link #begin()} before this method and {@link #end()} after. */
public void draw () {
for (ParticleEffect effect : effects) {
effect.draw();
}
}
/** Must be called one time per frame at the end of all drawing operations. */
public void end () {
for (ParticleBatch<?> batch : batches)
batch.end();
}
@Override
public void getRenderables (Array<Renderable> renderables, Pool<Renderable> pool) {
for (ParticleBatch<?> batch : batches)
batch.getRenderables(renderables, pool);
}
public Array<ParticleBatch<?>> getBatches () {
return batches;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.RenderableProvider;
import com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
/** Singleton class which manages the particle effects. It's a utility class to ease particle batches management and particle
* effects update.
* @author inferno */
public final class ParticleSystem implements RenderableProvider {
private static ParticleSystem instance;
/** @deprecated Please directly use the constructor */
@Deprecated
public static ParticleSystem get () {
if (instance == null) instance = new ParticleSystem();
return instance;
}
private Array<ParticleBatch<?>> batches;
private Array<ParticleEffect> effects;
public ParticleSystem () {
batches = new Array<ParticleBatch<?>>();
effects = new Array<ParticleEffect>();
}
public void add (ParticleBatch<?> batch) {
batches.add(batch);
}
public void add (ParticleEffect effect) {
effects.add(effect);
}
public void remove (ParticleEffect effect) {
effects.removeValue(effect, true);
}
/** Removes all the effects added to the system */
public void removeAll () {
effects.clear();
}
/** Updates the simulation of all effects */
public void update () {
for (ParticleEffect effect : effects) {
effect.update();
}
}
public void updateAndDraw () {
for (ParticleEffect effect : effects) {
effect.update();
effect.draw();
}
}
public void update (float deltaTime) {
for (ParticleEffect effect : effects) {
effect.update(deltaTime);
}
}
public void updateAndDraw (float deltaTime) {
for (ParticleEffect effect : effects) {
effect.update(deltaTime);
effect.draw();
}
}
/** Must be called one time per frame before any particle effect drawing operation will occur. */
public void begin () {
for (ParticleBatch<?> batch : batches)
batch.begin();
}
/** Draws all the particle effects. Call {@link #begin()} before this method and {@link #end()} after. */
public void draw () {
for (ParticleEffect effect : effects) {
effect.draw();
}
}
/** Must be called one time per frame at the end of all drawing operations. */
public void end () {
for (ParticleBatch<?> batch : batches)
batch.end();
}
@Override
public void getRenderables (Array<Renderable> renderables, Pool<Renderable> pool) {
for (ParticleBatch<?> batch : batches)
batch.getRenderables(renderables, pool);
}
public Array<ParticleBatch<?>> getBatches () {
return batches;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/gles2/VertexArrayTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.gles2;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Mesh.VertexDataType;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.GdxTestConfig;
import com.badlogic.gdx.utils.BufferUtils;
/** Touch the screen to cycle over 9 test case : (2 triangles, first triangle, second triangle) x (short buffer/short, byte
* buffer/short, byte buffer/byte). */
@GdxTestConfig(OnlyGL20 = true)
public class VertexArrayTest extends GdxTest {
ShaderProgram shader;
Mesh mesh;
int[][] testCases = {{0, 0, 6}, {0, 0, 3}, {0, 3, 3}, {1, 0, 6}, {1, 0, 3}, {1, 3, 3}, {2, 0, 6}, {2, 0, 3}, {2, 3, 3}};
int testCase = 0;
ByteBuffer byteBuffer;
ByteBuffer shortsAsByteBuffer;
@Override
public void create () {
String vertexShader = "attribute vec4 vPosition; \n" + "void main() \n"
+ "{ \n" + " gl_Position = vPosition; \n" + "} \n";
String fragmentShader = "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n"
+ "void main() \n" + "{ \n"
+ " gl_FragColor = vec4 ( 1.0, 1.0, 1.0, 1.0 );\n" + "}";
shader = new ShaderProgram(vertexShader, fragmentShader);
mesh = new Mesh(VertexDataType.VertexArray, true, 4, 6, new VertexAttribute(Usage.Position, 3, "vPosition"));
float[] vertices = {-0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f, -0.5f, 0.5f, 0.0f, 0.5f, 0.5f, 0.0f};
mesh.setVertices(vertices);
short[] indices = {0, 1, 2, 2, 1, 3};
mesh.setIndices(indices);
shortsAsByteBuffer = BufferUtils.newByteBuffer(12);
ShortBuffer sb = shortsAsByteBuffer.asShortBuffer();
sb.put(indices);
sb.flip();
byteBuffer = BufferUtils.newByteBuffer(6);
byteBuffer.put(new byte[] {0, 1, 2, 2, 1, 3});
byteBuffer.flip();
}
@Override
public void render () {
boolean log = false;
if (Gdx.input.justTouched()) {
testCase = (testCase + 1) % testCases.length;
log = true;
}
int mode = testCases[testCase][0];
int offset = testCases[testCase][1];
int count = testCases[testCase][2];
if (log) {
Gdx.app.log("VertexArrayTest", "mode: " + mode + ", offset: " + offset + ", count: " + count);
}
Gdx.gl20.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
shader.bind();
mesh.bind(shader);
Buffer buffer;
int type;
if (mode == 0) {
type = GL20.GL_UNSIGNED_SHORT;
buffer = mesh.getIndicesBuffer();
buffer.position(offset);
} else if (mode == 1) {
type = GL20.GL_UNSIGNED_SHORT;
buffer = shortsAsByteBuffer;
buffer.position(offset * 2);
} else {
type = GL20.GL_UNSIGNED_BYTE;
buffer = byteBuffer;
buffer.position(offset);
}
if (log) {
Gdx.app.log("VertexArrayTest", "position: " + buffer.position());
}
Gdx.gl20.glDrawElements(GL20.GL_TRIANGLES, count, type, buffer);
buffer.position(0);
mesh.unbind(shader);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.gles2;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Mesh.VertexDataType;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.GdxTestConfig;
import com.badlogic.gdx.utils.BufferUtils;
/** Touch the screen to cycle over 9 test case : (2 triangles, first triangle, second triangle) x (short buffer/short, byte
* buffer/short, byte buffer/byte). */
@GdxTestConfig(OnlyGL20 = true)
public class VertexArrayTest extends GdxTest {
ShaderProgram shader;
Mesh mesh;
int[][] testCases = {{0, 0, 6}, {0, 0, 3}, {0, 3, 3}, {1, 0, 6}, {1, 0, 3}, {1, 3, 3}, {2, 0, 6}, {2, 0, 3}, {2, 3, 3}};
int testCase = 0;
ByteBuffer byteBuffer;
ByteBuffer shortsAsByteBuffer;
@Override
public void create () {
String vertexShader = "attribute vec4 vPosition; \n" + "void main() \n"
+ "{ \n" + " gl_Position = vPosition; \n" + "} \n";
String fragmentShader = "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n"
+ "void main() \n" + "{ \n"
+ " gl_FragColor = vec4 ( 1.0, 1.0, 1.0, 1.0 );\n" + "}";
shader = new ShaderProgram(vertexShader, fragmentShader);
mesh = new Mesh(VertexDataType.VertexArray, true, 4, 6, new VertexAttribute(Usage.Position, 3, "vPosition"));
float[] vertices = {-0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f, -0.5f, 0.5f, 0.0f, 0.5f, 0.5f, 0.0f};
mesh.setVertices(vertices);
short[] indices = {0, 1, 2, 2, 1, 3};
mesh.setIndices(indices);
shortsAsByteBuffer = BufferUtils.newByteBuffer(12);
ShortBuffer sb = shortsAsByteBuffer.asShortBuffer();
sb.put(indices);
sb.flip();
byteBuffer = BufferUtils.newByteBuffer(6);
byteBuffer.put(new byte[] {0, 1, 2, 2, 1, 3});
byteBuffer.flip();
}
@Override
public void render () {
boolean log = false;
if (Gdx.input.justTouched()) {
testCase = (testCase + 1) % testCases.length;
log = true;
}
int mode = testCases[testCase][0];
int offset = testCases[testCase][1];
int count = testCases[testCase][2];
if (log) {
Gdx.app.log("VertexArrayTest", "mode: " + mode + ", offset: " + offset + ", count: " + count);
}
Gdx.gl20.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
shader.bind();
mesh.bind(shader);
Buffer buffer;
int type;
if (mode == 0) {
type = GL20.GL_UNSIGNED_SHORT;
buffer = mesh.getIndicesBuffer();
buffer.position(offset);
} else if (mode == 1) {
type = GL20.GL_UNSIGNED_SHORT;
buffer = shortsAsByteBuffer;
buffer.position(offset * 2);
} else {
type = GL20.GL_UNSIGNED_BYTE;
buffer = byteBuffer;
buffer.position(offset);
}
if (log) {
Gdx.app.log("VertexArrayTest", "position: " + buffer.position());
}
Gdx.gl20.glDrawElements(GL20.GL_TRIANGLES, count, type, buffer);
buffer.position(0);
mesh.unbind(shader);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/nio/BufferOverflowException.java | /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.nio;
/** A <code>BufferOverflowException</code> is thrown when elements are written to a buffer but there is not enough remaining space
* in the buffer.
*
* @since Android 1.0 */
public class BufferOverflowException extends RuntimeException {
private static final long serialVersionUID = -5484897634319144535L;
/** Constructs a <code>BufferOverflowException</code>.
*
* @since Android 1.0 */
public BufferOverflowException () {
super();
}
}
| /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.nio;
/** A <code>BufferOverflowException</code> is thrown when elements are written to a buffer but there is not enough remaining space
* in the buffer.
*
* @since Android 1.0 */
public class BufferOverflowException extends RuntimeException {
private static final long serialVersionUID = -5484897634319144535L;
/** Constructs a <code>BufferOverflowException</code>.
*
* @since Android 1.0 */
public BufferOverflowException () {
super();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/linearmath/com/badlogic/gdx/physics/bullet/linearmath/btSpatialTransformationMatrix.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class btSpatialTransformationMatrix extends BulletBase {
private long swigCPtr;
protected btSpatialTransformationMatrix (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btSpatialTransformationMatrix, normally you should not need this constructor it's intended for low-level
* usage. */
public btSpatialTransformationMatrix (long cPtr, boolean cMemoryOwn) {
this("btSpatialTransformationMatrix", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btSpatialTransformationMatrix obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_btSpatialTransformationMatrix(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setRotMat (btMatrix3x3 value) {
LinearMathJNI.btSpatialTransformationMatrix_rotMat_set(swigCPtr, this, btMatrix3x3.getCPtr(value), value);
}
public btMatrix3x3 getRotMat () {
long cPtr = LinearMathJNI.btSpatialTransformationMatrix_rotMat_get(swigCPtr, this);
return (cPtr == 0) ? null : new btMatrix3x3(cPtr, false);
}
public void setTrnVec (btVector3 value) {
LinearMathJNI.btSpatialTransformationMatrix_trnVec_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getTrnVec () {
long cPtr = LinearMathJNI.btSpatialTransformationMatrix_trnVec_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void transformInverse (btSymmetricSpatialDyad inMat, btSymmetricSpatialDyad outMat, int outOp) {
LinearMathJNI.btSpatialTransformationMatrix_transformInverse__SWIG_2(swigCPtr, this, btSymmetricSpatialDyad.getCPtr(inMat),
inMat, btSymmetricSpatialDyad.getCPtr(outMat), outMat, outOp);
}
public void transformInverse (btSymmetricSpatialDyad inMat, btSymmetricSpatialDyad outMat) {
LinearMathJNI.btSpatialTransformationMatrix_transformInverse__SWIG_3(swigCPtr, this, btSymmetricSpatialDyad.getCPtr(inMat),
inMat, btSymmetricSpatialDyad.getCPtr(outMat), outMat);
}
public btSpatialTransformationMatrix () {
this(LinearMathJNI.new_btSpatialTransformationMatrix(), true);
}
public final static class eOutputOperation {
public final static int None = 0;
public final static int Add = 1;
public final static int Subtract = 2;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class btSpatialTransformationMatrix extends BulletBase {
private long swigCPtr;
protected btSpatialTransformationMatrix (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btSpatialTransformationMatrix, normally you should not need this constructor it's intended for low-level
* usage. */
public btSpatialTransformationMatrix (long cPtr, boolean cMemoryOwn) {
this("btSpatialTransformationMatrix", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btSpatialTransformationMatrix obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_btSpatialTransformationMatrix(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setRotMat (btMatrix3x3 value) {
LinearMathJNI.btSpatialTransformationMatrix_rotMat_set(swigCPtr, this, btMatrix3x3.getCPtr(value), value);
}
public btMatrix3x3 getRotMat () {
long cPtr = LinearMathJNI.btSpatialTransformationMatrix_rotMat_get(swigCPtr, this);
return (cPtr == 0) ? null : new btMatrix3x3(cPtr, false);
}
public void setTrnVec (btVector3 value) {
LinearMathJNI.btSpatialTransformationMatrix_trnVec_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getTrnVec () {
long cPtr = LinearMathJNI.btSpatialTransformationMatrix_trnVec_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void transformInverse (btSymmetricSpatialDyad inMat, btSymmetricSpatialDyad outMat, int outOp) {
LinearMathJNI.btSpatialTransformationMatrix_transformInverse__SWIG_2(swigCPtr, this, btSymmetricSpatialDyad.getCPtr(inMat),
inMat, btSymmetricSpatialDyad.getCPtr(outMat), outMat, outOp);
}
public void transformInverse (btSymmetricSpatialDyad inMat, btSymmetricSpatialDyad outMat) {
LinearMathJNI.btSpatialTransformationMatrix_transformInverse__SWIG_3(swigCPtr, this, btSymmetricSpatialDyad.getCPtr(inMat),
inMat, btSymmetricSpatialDyad.getCPtr(outMat), outMat);
}
public btSpatialTransformationMatrix () {
this(LinearMathJNI.new_btSpatialTransformationMatrix(), true);
}
public final static class eOutputOperation {
public final static int None = 0;
public final static int Add = 1;
public final static int Subtract = 2;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backend-robovm-metalangle/src/com/badlogic/gdx/backends/iosrobovm/IOSGLES20.java | /*DO NOT EDIT THIS FILE - it is machine generated*/
package com.badlogic.gdx.backends.iosrobovm;
import java.nio.*;
import com.badlogic.gdx.graphics.GL20;
import org.robovm.apple.foundation.NSProcessInfo;
/** DO NOT EDIT THIS FILE - it is machine generated */
public class IOSGLES20 implements GL20 {
final boolean shouldConvert16bit = IOSApplication.IS_METALANGLE
&& NSProcessInfo.getSharedProcessInfo().getEnvironment().containsKey("SIMULATOR_DEVICE_NAME");
public IOSGLES20 () {
init();
}
/** last viewport set, needed because GLKView resets the viewport on each call to render... amazing * */
public static int x, y, width, height;
private static native void init ();
public native void glActiveTexture (int texture);
public native void glAttachShader (int program, int shader);
public native void glBindAttribLocation (int program, int index, String name);
public native void glBindBuffer (int target, int buffer);
public native void glBindFramebuffer (int target, int framebuffer);
public native void glBindRenderbuffer (int target, int renderbuffer);
public native void glBindTexture (int target, int texture);
public native void glBlendColor (float red, float green, float blue, float alpha);
public native void glBlendEquation (int mode);
public native void glBlendEquationSeparate (int modeRGB, int modeAlpha);
public native void glBlendFunc (int sfactor, int dfactor);
public native void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
public native void glBufferData (int target, int size, Buffer data, int usage);
public native void glBufferSubData (int target, int offset, int size, Buffer data);
public native int glCheckFramebufferStatus (int target);
public native void glClear (int mask);
public native void glClearColor (float red, float green, float blue, float alpha);
public native void glClearDepthf (float depth);
public native void glClearStencil (int s);
public native void glColorMask (boolean red, boolean green, boolean blue, boolean alpha);
public native void glCompileShader (int shader);
public native void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
int imageSize, Buffer data);
public native void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height,
int format, int imageSize, Buffer data);
public native void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height,
int border);
public native void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
public native int glCreateProgram ();
public native int glCreateShader (int type);
public native void glCullFace (int mode);
public native void glDeleteBuffers (int n, IntBuffer buffers);
public native void glDeleteBuffer (int buffer);
public native void glDeleteFramebuffers (int n, IntBuffer framebuffers);
public native void glDeleteFramebuffer (int framebuffer);
public native void glDeleteProgram (int program);
public native void glDeleteRenderbuffers (int n, IntBuffer renderbuffers);
public native void glDeleteRenderbuffer (int renderbuffer);
public native void glDeleteShader (int shader);
public native void glDeleteTextures (int n, IntBuffer textures);
public native void glDeleteTexture (int texture);
public native void glDepthFunc (int func);
public native void glDepthMask (boolean flag);
public native void glDepthRangef (float zNear, float zFar);
public native void glDetachShader (int program, int shader);
public native void glDisable (int cap);
public native void glDisableVertexAttribArray (int index);
public native void glDrawArrays (int mode, int first, int count);
public native void glDrawElements (int mode, int count, int type, Buffer indices);
public native void glDrawElements (int mode, int count, int type, int indices);
public native void glEnable (int cap);
public native void glEnableVertexAttribArray (int index);
public native void glFinish ();
public native void glFlush ();
public native void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer);
public native void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level);
public native void glFrontFace (int mode);
public native void glGenBuffers (int n, IntBuffer buffers);
public native int glGenBuffer ();
public native void glGenerateMipmap (int target);
public native void glGenFramebuffers (int n, IntBuffer framebuffers);
public native int glGenFramebuffer ();
public native void glGenRenderbuffers (int n, IntBuffer renderbuffers);
public native int glGenRenderbuffer ();
public native void glGenTextures (int n, IntBuffer textures);
public native int glGenTexture ();
public native String glGetActiveAttrib (int program, int index, IntBuffer size, IntBuffer type);
public native String glGetActiveUniform (int program, int index, IntBuffer size, IntBuffer type);
public native void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders);
public native int glGetAttribLocation (int program, String name);
public native void glGetBooleanv (int pname, Buffer params);
public native void glGetBufferParameteriv (int target, int pname, IntBuffer params);
public native int glGetError ();
public native void glGetFloatv (int pname, FloatBuffer params);
public native void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params);
public native void glGetIntegerv (int pname, IntBuffer params);
public native void glGetProgramiv (int program, int pname, IntBuffer params);
public native String glGetProgramInfoLog (int program);
public native void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params);
public native void glGetShaderiv (int shader, int pname, IntBuffer params);
public native String glGetShaderInfoLog (int shader);
public native void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision);
public native void glGetShaderSource (int shader, int bufsize, Buffer length, String source);
public native String glGetString (int name);
public native void glGetTexParameterfv (int target, int pname, FloatBuffer params);
public native void glGetTexParameteriv (int target, int pname, IntBuffer params);
public native void glGetUniformfv (int program, int location, FloatBuffer params);
public native void glGetUniformiv (int program, int location, IntBuffer params);
public native int glGetUniformLocation (int program, String name);
public native void glGetVertexAttribfv (int index, int pname, FloatBuffer params);
public native void glGetVertexAttribiv (int index, int pname, IntBuffer params);
public native void glGetVertexAttribPointerv (int index, int pname, Buffer pointer);
public native void glHint (int target, int mode);
public native boolean glIsBuffer (int buffer);
public native boolean glIsEnabled (int cap);
public native boolean glIsFramebuffer (int framebuffer);
public native boolean glIsProgram (int program);
public native boolean glIsRenderbuffer (int renderbuffer);
public native boolean glIsShader (int shader);
public native boolean glIsTexture (int texture);
public native void glLineWidth (float width);
public native void glLinkProgram (int program);
public native void glPixelStorei (int pname, int param);
public native void glPolygonOffset (float factor, float units);
public native void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels);
public native void glReleaseShaderCompiler ();
public native void glRenderbufferStorage (int target, int internalformat, int width, int height);
public native void glSampleCoverage (float value, boolean invert);
public native void glScissor (int x, int y, int width, int height);
public native void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);
public native void glShaderSource (int shader, String string);
public native void glStencilFunc (int func, int ref, int mask);
public native void glStencilFuncSeparate (int face, int func, int ref, int mask);
public native void glStencilMask (int mask);
public native void glStencilMaskSeparate (int face, int mask);
public native void glStencilOp (int fail, int zfail, int zpass);
public native void glStencilOpSeparate (int face, int fail, int zfail, int zpass);
static Buffer convert16bitBufferToRGBA8888 (Buffer buffer, int type) {
// TODO: 20.10.22 Can it be a different buffer type?
ByteBuffer byteBuffer = (ByteBuffer)buffer;
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
ByteBuffer converted = ByteBuffer.allocateDirect(byteBuffer.limit() * 2);
while (buffer.remaining() != 0) {
short color = byteBuffer.getShort();
int rgba8888;
if (type == GL_UNSIGNED_SHORT_4_4_4_4) {
byte r = (byte)((color >> 12) & 0x0F);
byte g = (byte)((color >> 8) & 0x0F);
byte b = (byte)((color >> 4) & 0x0F);
byte a = (byte)((color) & 0x0F);
rgba8888 = (r << 4 | r) << 24 | (g << 4 | g) << 16 | (b << 4 | b) << 8 | (a << 4 | a);
} else if (type == GL_UNSIGNED_SHORT_5_6_5) {
byte r = (byte)((color >> 11) & 0x1F);
byte g = (byte)((color >> 5) & 0x3F);
byte b = (byte)((color) & 0x1F);
rgba8888 = (r << 3 | r >> 2) << 24 | (g << 2 | g >> 4) << 16 | (b << 3 | b >> 2) << 8 | 0xFF;
} else {
byte r = (byte)((color >> 11) & 0x1F);
byte g = (byte)((color >> 6) & 0x1F);
byte b = (byte)((color >> 5) & 0x1F);
byte a = (byte)((color) & 0x1);
rgba8888 = (r << 3 | r >> 2) << 24 | (g << 3 | g >> 2) << 16 | (b << 3 | b >> 2) << 8 | a * 255;
}
converted.putInt(rgba8888);
}
converted.position(0);
return converted;
}
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
Buffer pixels) {
if (!shouldConvert16bit) {
glTexImage2DJNI(target, level, internalformat, width, height, border, format, type, pixels);
return;
}
if (type != GL_UNSIGNED_SHORT_5_6_5 && type != GL_UNSIGNED_SHORT_5_5_5_1 && type != GL_UNSIGNED_SHORT_4_4_4_4) {
glTexImage2DJNI(target, level, internalformat, width, height, border, format, type, pixels);
return;
}
Buffer converted = convert16bitBufferToRGBA8888(pixels, type);
glTexImage2DJNI(target, level, GL_RGBA, width, height, border, GL_RGBA, GL_UNSIGNED_BYTE, converted);
}
public native void glTexImage2DJNI (int target, int level, int internalformat, int width, int height, int border, int format,
int type, Buffer pixels);
public native void glTexParameterf (int target, int pname, float param);
public native void glTexParameterfv (int target, int pname, FloatBuffer params);
public native void glTexParameteri (int target, int pname, int param);
public native void glTexParameteriv (int target, int pname, IntBuffer params);
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
Buffer pixels) {
if (!shouldConvert16bit) {
glTexSubImage2DJNI(target, level, xoffset, yoffset, width, height, format, type, pixels);
return;
}
if (type != GL_UNSIGNED_SHORT_5_6_5 && type != GL_UNSIGNED_SHORT_5_5_5_1 && type != GL_UNSIGNED_SHORT_4_4_4_4) {
glTexSubImage2DJNI(target, level, xoffset, yoffset, width, height, format, type, pixels);
return;
}
Buffer converted = convert16bitBufferToRGBA8888(pixels, type);
glTexSubImage2DJNI(target, level, xoffset, yoffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, converted);
}
public native void glTexSubImage2DJNI (int target, int level, int xoffset, int yoffset, int width, int height, int format,
int type, Buffer pixels);
public native void glUniform1f (int location, float x);
public native void glUniform1fv (int location, int count, FloatBuffer v);
public native void glUniform1fv (int location, int count, float[] v, int offset);
public native void glUniform1i (int location, int x);
public native void glUniform1iv (int location, int count, IntBuffer v);
public native void glUniform1iv (int location, int count, int[] v, int offset);
public native void glUniform2f (int location, float x, float y);
public native void glUniform2fv (int location, int count, FloatBuffer v);
public native void glUniform2fv (int location, int count, float[] v, int offset);
public native void glUniform2i (int location, int x, int y);
public native void glUniform2iv (int location, int count, IntBuffer v);
public native void glUniform2iv (int location, int count, int[] v, int offset);
public native void glUniform3f (int location, float x, float y, float z);
public native void glUniform3fv (int location, int count, FloatBuffer v);
public native void glUniform3fv (int location, int count, float[] v, int offset);
public native void glUniform3i (int location, int x, int y, int z);
public native void glUniform3iv (int location, int count, IntBuffer v);
public native void glUniform3iv (int location, int count, int[] v, int offset);
public native void glUniform4f (int location, float x, float y, float z, float w);
public native void glUniform4fv (int location, int count, FloatBuffer v);
public native void glUniform4fv (int location, int count, float[] v, int offset);
public native void glUniform4i (int location, int x, int y, int z, int w);
public native void glUniform4iv (int location, int count, IntBuffer v);
public native void glUniform4iv (int location, int count, int[] v, int offset);
public native void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value);
public native void glUniformMatrix2fv (int location, int count, boolean transpose, float[] value, int offset);
public native void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value);
public native void glUniformMatrix3fv (int location, int count, boolean transpose, float[] value, int offset);
public native void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value);
public native void glUniformMatrix4fv (int location, int count, boolean transpose, float[] value, int offset);
public native void glUseProgram (int program);
public native void glValidateProgram (int program);
public native void glVertexAttrib1f (int indx, float x);
public native void glVertexAttrib1fv (int indx, FloatBuffer values);
public native void glVertexAttrib2f (int indx, float x, float y);
public native void glVertexAttrib2fv (int indx, FloatBuffer values);
public native void glVertexAttrib3f (int indx, float x, float y, float z);
public native void glVertexAttrib3fv (int indx, FloatBuffer values);
public native void glVertexAttrib4f (int indx, float x, float y, float z, float w);
public native void glVertexAttrib4fv (int indx, FloatBuffer values);
public native void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer ptr);
public native void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr);
public void glViewport (int x, int y, int width, int height) {
IOSGLES20.x = x;
IOSGLES20.y = y;
IOSGLES20.width = width;
IOSGLES20.height = height;
glViewportJni(x, y, width, height);
}
public native void glViewportJni (int x, int y, int width, int height);
}
| /*DO NOT EDIT THIS FILE - it is machine generated*/
package com.badlogic.gdx.backends.iosrobovm;
import java.nio.*;
import com.badlogic.gdx.graphics.GL20;
import org.robovm.apple.foundation.NSProcessInfo;
/** DO NOT EDIT THIS FILE - it is machine generated */
public class IOSGLES20 implements GL20 {
final boolean shouldConvert16bit = IOSApplication.IS_METALANGLE
&& NSProcessInfo.getSharedProcessInfo().getEnvironment().containsKey("SIMULATOR_DEVICE_NAME");
public IOSGLES20 () {
init();
}
/** last viewport set, needed because GLKView resets the viewport on each call to render... amazing * */
public static int x, y, width, height;
private static native void init ();
public native void glActiveTexture (int texture);
public native void glAttachShader (int program, int shader);
public native void glBindAttribLocation (int program, int index, String name);
public native void glBindBuffer (int target, int buffer);
public native void glBindFramebuffer (int target, int framebuffer);
public native void glBindRenderbuffer (int target, int renderbuffer);
public native void glBindTexture (int target, int texture);
public native void glBlendColor (float red, float green, float blue, float alpha);
public native void glBlendEquation (int mode);
public native void glBlendEquationSeparate (int modeRGB, int modeAlpha);
public native void glBlendFunc (int sfactor, int dfactor);
public native void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
public native void glBufferData (int target, int size, Buffer data, int usage);
public native void glBufferSubData (int target, int offset, int size, Buffer data);
public native int glCheckFramebufferStatus (int target);
public native void glClear (int mask);
public native void glClearColor (float red, float green, float blue, float alpha);
public native void glClearDepthf (float depth);
public native void glClearStencil (int s);
public native void glColorMask (boolean red, boolean green, boolean blue, boolean alpha);
public native void glCompileShader (int shader);
public native void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
int imageSize, Buffer data);
public native void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height,
int format, int imageSize, Buffer data);
public native void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height,
int border);
public native void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
public native int glCreateProgram ();
public native int glCreateShader (int type);
public native void glCullFace (int mode);
public native void glDeleteBuffers (int n, IntBuffer buffers);
public native void glDeleteBuffer (int buffer);
public native void glDeleteFramebuffers (int n, IntBuffer framebuffers);
public native void glDeleteFramebuffer (int framebuffer);
public native void glDeleteProgram (int program);
public native void glDeleteRenderbuffers (int n, IntBuffer renderbuffers);
public native void glDeleteRenderbuffer (int renderbuffer);
public native void glDeleteShader (int shader);
public native void glDeleteTextures (int n, IntBuffer textures);
public native void glDeleteTexture (int texture);
public native void glDepthFunc (int func);
public native void glDepthMask (boolean flag);
public native void glDepthRangef (float zNear, float zFar);
public native void glDetachShader (int program, int shader);
public native void glDisable (int cap);
public native void glDisableVertexAttribArray (int index);
public native void glDrawArrays (int mode, int first, int count);
public native void glDrawElements (int mode, int count, int type, Buffer indices);
public native void glDrawElements (int mode, int count, int type, int indices);
public native void glEnable (int cap);
public native void glEnableVertexAttribArray (int index);
public native void glFinish ();
public native void glFlush ();
public native void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer);
public native void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level);
public native void glFrontFace (int mode);
public native void glGenBuffers (int n, IntBuffer buffers);
public native int glGenBuffer ();
public native void glGenerateMipmap (int target);
public native void glGenFramebuffers (int n, IntBuffer framebuffers);
public native int glGenFramebuffer ();
public native void glGenRenderbuffers (int n, IntBuffer renderbuffers);
public native int glGenRenderbuffer ();
public native void glGenTextures (int n, IntBuffer textures);
public native int glGenTexture ();
public native String glGetActiveAttrib (int program, int index, IntBuffer size, IntBuffer type);
public native String glGetActiveUniform (int program, int index, IntBuffer size, IntBuffer type);
public native void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders);
public native int glGetAttribLocation (int program, String name);
public native void glGetBooleanv (int pname, Buffer params);
public native void glGetBufferParameteriv (int target, int pname, IntBuffer params);
public native int glGetError ();
public native void glGetFloatv (int pname, FloatBuffer params);
public native void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params);
public native void glGetIntegerv (int pname, IntBuffer params);
public native void glGetProgramiv (int program, int pname, IntBuffer params);
public native String glGetProgramInfoLog (int program);
public native void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params);
public native void glGetShaderiv (int shader, int pname, IntBuffer params);
public native String glGetShaderInfoLog (int shader);
public native void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision);
public native void glGetShaderSource (int shader, int bufsize, Buffer length, String source);
public native String glGetString (int name);
public native void glGetTexParameterfv (int target, int pname, FloatBuffer params);
public native void glGetTexParameteriv (int target, int pname, IntBuffer params);
public native void glGetUniformfv (int program, int location, FloatBuffer params);
public native void glGetUniformiv (int program, int location, IntBuffer params);
public native int glGetUniformLocation (int program, String name);
public native void glGetVertexAttribfv (int index, int pname, FloatBuffer params);
public native void glGetVertexAttribiv (int index, int pname, IntBuffer params);
public native void glGetVertexAttribPointerv (int index, int pname, Buffer pointer);
public native void glHint (int target, int mode);
public native boolean glIsBuffer (int buffer);
public native boolean glIsEnabled (int cap);
public native boolean glIsFramebuffer (int framebuffer);
public native boolean glIsProgram (int program);
public native boolean glIsRenderbuffer (int renderbuffer);
public native boolean glIsShader (int shader);
public native boolean glIsTexture (int texture);
public native void glLineWidth (float width);
public native void glLinkProgram (int program);
public native void glPixelStorei (int pname, int param);
public native void glPolygonOffset (float factor, float units);
public native void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels);
public native void glReleaseShaderCompiler ();
public native void glRenderbufferStorage (int target, int internalformat, int width, int height);
public native void glSampleCoverage (float value, boolean invert);
public native void glScissor (int x, int y, int width, int height);
public native void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);
public native void glShaderSource (int shader, String string);
public native void glStencilFunc (int func, int ref, int mask);
public native void glStencilFuncSeparate (int face, int func, int ref, int mask);
public native void glStencilMask (int mask);
public native void glStencilMaskSeparate (int face, int mask);
public native void glStencilOp (int fail, int zfail, int zpass);
public native void glStencilOpSeparate (int face, int fail, int zfail, int zpass);
static Buffer convert16bitBufferToRGBA8888 (Buffer buffer, int type) {
// TODO: 20.10.22 Can it be a different buffer type?
ByteBuffer byteBuffer = (ByteBuffer)buffer;
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
ByteBuffer converted = ByteBuffer.allocateDirect(byteBuffer.limit() * 2);
while (buffer.remaining() != 0) {
short color = byteBuffer.getShort();
int rgba8888;
if (type == GL_UNSIGNED_SHORT_4_4_4_4) {
byte r = (byte)((color >> 12) & 0x0F);
byte g = (byte)((color >> 8) & 0x0F);
byte b = (byte)((color >> 4) & 0x0F);
byte a = (byte)((color) & 0x0F);
rgba8888 = (r << 4 | r) << 24 | (g << 4 | g) << 16 | (b << 4 | b) << 8 | (a << 4 | a);
} else if (type == GL_UNSIGNED_SHORT_5_6_5) {
byte r = (byte)((color >> 11) & 0x1F);
byte g = (byte)((color >> 5) & 0x3F);
byte b = (byte)((color) & 0x1F);
rgba8888 = (r << 3 | r >> 2) << 24 | (g << 2 | g >> 4) << 16 | (b << 3 | b >> 2) << 8 | 0xFF;
} else {
byte r = (byte)((color >> 11) & 0x1F);
byte g = (byte)((color >> 6) & 0x1F);
byte b = (byte)((color >> 5) & 0x1F);
byte a = (byte)((color) & 0x1);
rgba8888 = (r << 3 | r >> 2) << 24 | (g << 3 | g >> 2) << 16 | (b << 3 | b >> 2) << 8 | a * 255;
}
converted.putInt(rgba8888);
}
converted.position(0);
return converted;
}
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
Buffer pixels) {
if (!shouldConvert16bit) {
glTexImage2DJNI(target, level, internalformat, width, height, border, format, type, pixels);
return;
}
if (type != GL_UNSIGNED_SHORT_5_6_5 && type != GL_UNSIGNED_SHORT_5_5_5_1 && type != GL_UNSIGNED_SHORT_4_4_4_4) {
glTexImage2DJNI(target, level, internalformat, width, height, border, format, type, pixels);
return;
}
Buffer converted = convert16bitBufferToRGBA8888(pixels, type);
glTexImage2DJNI(target, level, GL_RGBA, width, height, border, GL_RGBA, GL_UNSIGNED_BYTE, converted);
}
public native void glTexImage2DJNI (int target, int level, int internalformat, int width, int height, int border, int format,
int type, Buffer pixels);
public native void glTexParameterf (int target, int pname, float param);
public native void glTexParameterfv (int target, int pname, FloatBuffer params);
public native void glTexParameteri (int target, int pname, int param);
public native void glTexParameteriv (int target, int pname, IntBuffer params);
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
Buffer pixels) {
if (!shouldConvert16bit) {
glTexSubImage2DJNI(target, level, xoffset, yoffset, width, height, format, type, pixels);
return;
}
if (type != GL_UNSIGNED_SHORT_5_6_5 && type != GL_UNSIGNED_SHORT_5_5_5_1 && type != GL_UNSIGNED_SHORT_4_4_4_4) {
glTexSubImage2DJNI(target, level, xoffset, yoffset, width, height, format, type, pixels);
return;
}
Buffer converted = convert16bitBufferToRGBA8888(pixels, type);
glTexSubImage2DJNI(target, level, xoffset, yoffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, converted);
}
public native void glTexSubImage2DJNI (int target, int level, int xoffset, int yoffset, int width, int height, int format,
int type, Buffer pixels);
public native void glUniform1f (int location, float x);
public native void glUniform1fv (int location, int count, FloatBuffer v);
public native void glUniform1fv (int location, int count, float[] v, int offset);
public native void glUniform1i (int location, int x);
public native void glUniform1iv (int location, int count, IntBuffer v);
public native void glUniform1iv (int location, int count, int[] v, int offset);
public native void glUniform2f (int location, float x, float y);
public native void glUniform2fv (int location, int count, FloatBuffer v);
public native void glUniform2fv (int location, int count, float[] v, int offset);
public native void glUniform2i (int location, int x, int y);
public native void glUniform2iv (int location, int count, IntBuffer v);
public native void glUniform2iv (int location, int count, int[] v, int offset);
public native void glUniform3f (int location, float x, float y, float z);
public native void glUniform3fv (int location, int count, FloatBuffer v);
public native void glUniform3fv (int location, int count, float[] v, int offset);
public native void glUniform3i (int location, int x, int y, int z);
public native void glUniform3iv (int location, int count, IntBuffer v);
public native void glUniform3iv (int location, int count, int[] v, int offset);
public native void glUniform4f (int location, float x, float y, float z, float w);
public native void glUniform4fv (int location, int count, FloatBuffer v);
public native void glUniform4fv (int location, int count, float[] v, int offset);
public native void glUniform4i (int location, int x, int y, int z, int w);
public native void glUniform4iv (int location, int count, IntBuffer v);
public native void glUniform4iv (int location, int count, int[] v, int offset);
public native void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value);
public native void glUniformMatrix2fv (int location, int count, boolean transpose, float[] value, int offset);
public native void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value);
public native void glUniformMatrix3fv (int location, int count, boolean transpose, float[] value, int offset);
public native void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value);
public native void glUniformMatrix4fv (int location, int count, boolean transpose, float[] value, int offset);
public native void glUseProgram (int program);
public native void glValidateProgram (int program);
public native void glVertexAttrib1f (int indx, float x);
public native void glVertexAttrib1fv (int indx, FloatBuffer values);
public native void glVertexAttrib2f (int indx, float x, float y);
public native void glVertexAttrib2fv (int indx, FloatBuffer values);
public native void glVertexAttrib3f (int indx, float x, float y, float z);
public native void glVertexAttrib3fv (int indx, FloatBuffer values);
public native void glVertexAttrib4f (int indx, float x, float y, float z, float w);
public native void glVertexAttrib4fv (int indx, FloatBuffer values);
public native void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer ptr);
public native void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr);
public void glViewport (int x, int y, int width, int height) {
IOSGLES20.x = x;
IOSGLES20.y = y;
IOSGLES20.width = width;
IOSGLES20.height = height;
glViewportJni(x, y, width, height);
}
public native void glViewportJni (int x, int y, int width, int height);
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/linearmath/com/badlogic/gdx/physics/bullet/linearmath/HullResult.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class HullResult extends BulletBase {
private long swigCPtr;
protected HullResult (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new HullResult, normally you should not need this constructor it's intended for low-level usage. */
public HullResult (long cPtr, boolean cMemoryOwn) {
this("HullResult", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (HullResult obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_HullResult(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public HullResult () {
this(LinearMathJNI.new_HullResult(), true);
}
public void setMPolygons (boolean value) {
LinearMathJNI.HullResult_mPolygons_set(swigCPtr, this, value);
}
public boolean getMPolygons () {
return LinearMathJNI.HullResult_mPolygons_get(swigCPtr, this);
}
public void setMNumOutputVertices (long value) {
LinearMathJNI.HullResult_mNumOutputVertices_set(swigCPtr, this, value);
}
public long getMNumOutputVertices () {
return LinearMathJNI.HullResult_mNumOutputVertices_get(swigCPtr, this);
}
public void setOutputVertices (btVector3Array value) {
LinearMathJNI.HullResult_OutputVertices_set(swigCPtr, this, btVector3Array.getCPtr(value), value);
}
public btVector3Array getOutputVertices () {
long cPtr = LinearMathJNI.HullResult_OutputVertices_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3Array(cPtr, false);
}
public void setMNumFaces (long value) {
LinearMathJNI.HullResult_mNumFaces_set(swigCPtr, this, value);
}
public long getMNumFaces () {
return LinearMathJNI.HullResult_mNumFaces_get(swigCPtr, this);
}
public void setMNumIndices (long value) {
LinearMathJNI.HullResult_mNumIndices_set(swigCPtr, this, value);
}
public long getMNumIndices () {
return LinearMathJNI.HullResult_mNumIndices_get(swigCPtr, this);
}
public void setIndices (SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t value) {
LinearMathJNI.HullResult_Indices_set(swigCPtr, this, SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t.getCPtr(value));
}
public SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t getIndices () {
long cPtr = LinearMathJNI.HullResult_Indices_get(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t(cPtr, false);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class HullResult extends BulletBase {
private long swigCPtr;
protected HullResult (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new HullResult, normally you should not need this constructor it's intended for low-level usage. */
public HullResult (long cPtr, boolean cMemoryOwn) {
this("HullResult", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (HullResult obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_HullResult(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public HullResult () {
this(LinearMathJNI.new_HullResult(), true);
}
public void setMPolygons (boolean value) {
LinearMathJNI.HullResult_mPolygons_set(swigCPtr, this, value);
}
public boolean getMPolygons () {
return LinearMathJNI.HullResult_mPolygons_get(swigCPtr, this);
}
public void setMNumOutputVertices (long value) {
LinearMathJNI.HullResult_mNumOutputVertices_set(swigCPtr, this, value);
}
public long getMNumOutputVertices () {
return LinearMathJNI.HullResult_mNumOutputVertices_get(swigCPtr, this);
}
public void setOutputVertices (btVector3Array value) {
LinearMathJNI.HullResult_OutputVertices_set(swigCPtr, this, btVector3Array.getCPtr(value), value);
}
public btVector3Array getOutputVertices () {
long cPtr = LinearMathJNI.HullResult_OutputVertices_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3Array(cPtr, false);
}
public void setMNumFaces (long value) {
LinearMathJNI.HullResult_mNumFaces_set(swigCPtr, this, value);
}
public long getMNumFaces () {
return LinearMathJNI.HullResult_mNumFaces_get(swigCPtr, this);
}
public void setMNumIndices (long value) {
LinearMathJNI.HullResult_mNumIndices_set(swigCPtr, this, value);
}
public long getMNumIndices () {
return LinearMathJNI.HullResult_mNumIndices_get(swigCPtr, this);
}
public void setIndices (SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t value) {
LinearMathJNI.HullResult_Indices_set(swigCPtr, this, SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t.getCPtr(value));
}
public SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t getIndices () {
long cPtr = LinearMathJNI.HullResult_Indices_get(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_btAlignedObjectArrayT_unsigned_int_t(cPtr, false);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/ScrollPaneWithDynamicScrolling.java | /*******************************************************************************
* Copyright 2019 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.tests.utils.GdxTest;
public class ScrollPaneWithDynamicScrolling extends GdxTest {
private Stage stage;
private Table container;
Label dynamicLabel;
ScrollPane scrollPane;
int count;
public void create () {
stage = new Stage();
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
Gdx.input.setInputProcessor(stage);
dynamicLabel = new Label("Chat box begin here", skin);
float chatWidth = 200;
float controlHeight = 300;
scrollPane = new ScrollPane(dynamicLabel, skin);
Table main = new Table();
main.setFillParent(true);
TextButton btAdd = new TextButton("Add text and scroll down", skin);
main.add(btAdd).row();
main.add(scrollPane).size(200, 100);
stage.addActor(main);
stage.setDebugAll(true);
btAdd.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
dynamicLabel.setText(dynamicLabel.getText() + "\nline " + count++);
scrollPane.scrollTo(0, 0, 0, 0);
}
});
}
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
public void dispose () {
stage.dispose();
}
public boolean needsGL20 () {
return false;
}
}
| /*******************************************************************************
* Copyright 2019 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.tests.utils.GdxTest;
public class ScrollPaneWithDynamicScrolling extends GdxTest {
private Stage stage;
private Table container;
Label dynamicLabel;
ScrollPane scrollPane;
int count;
public void create () {
stage = new Stage();
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
Gdx.input.setInputProcessor(stage);
dynamicLabel = new Label("Chat box begin here", skin);
float chatWidth = 200;
float controlHeight = 300;
scrollPane = new ScrollPane(dynamicLabel, skin);
Table main = new Table();
main.setFillParent(true);
TextButton btAdd = new TextButton("Add text and scroll down", skin);
main.add(btAdd).row();
main.add(scrollPane).size(200, 100);
stage.addActor(main);
stage.setDebugAll(true);
btAdd.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
dynamicLabel.setText(dynamicLabel.getText() + "\nline " + count++);
scrollPane.scrollTo(0, 0, 0, 0);
}
});
}
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
public void dispose () {
stage.dispose();
}
public boolean needsGL20 () {
return false;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/btTranslationalLimitMotor2.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class btTranslationalLimitMotor2 extends BulletBase {
private long swigCPtr;
protected btTranslationalLimitMotor2 (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTranslationalLimitMotor2, normally you should not need this constructor it's intended for low-level
* usage. */
public btTranslationalLimitMotor2 (long cPtr, boolean cMemoryOwn) {
this("btTranslationalLimitMotor2", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btTranslationalLimitMotor2 obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btTranslationalLimitMotor2(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setLowerLimit (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_lowerLimit_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getLowerLimit () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_lowerLimit_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setUpperLimit (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_upperLimit_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getUpperLimit () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_upperLimit_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setBounce (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_bounce_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getBounce () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_bounce_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setStopERP (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_stopERP_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getStopERP () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_stopERP_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setStopCFM (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_stopCFM_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getStopCFM () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_stopCFM_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setMotorERP (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_motorERP_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getMotorERP () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_motorERP_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setMotorCFM (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_motorCFM_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getMotorCFM () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_motorCFM_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setEnableMotor (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_enableMotor_set(swigCPtr, this, value);
}
public boolean[] getEnableMotor () {
return DynamicsJNI.btTranslationalLimitMotor2_enableMotor_get(swigCPtr, this);
}
public void setServoMotor (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_servoMotor_set(swigCPtr, this, value);
}
public boolean[] getServoMotor () {
return DynamicsJNI.btTranslationalLimitMotor2_servoMotor_get(swigCPtr, this);
}
public void setEnableSpring (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_enableSpring_set(swigCPtr, this, value);
}
public boolean[] getEnableSpring () {
return DynamicsJNI.btTranslationalLimitMotor2_enableSpring_get(swigCPtr, this);
}
public void setServoTarget (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_servoTarget_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getServoTarget () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_servoTarget_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSpringStiffness (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_springStiffness_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getSpringStiffness () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_springStiffness_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSpringStiffnessLimited (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_springStiffnessLimited_set(swigCPtr, this, value);
}
public boolean[] getSpringStiffnessLimited () {
return DynamicsJNI.btTranslationalLimitMotor2_springStiffnessLimited_get(swigCPtr, this);
}
public void setSpringDamping (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_springDamping_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getSpringDamping () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_springDamping_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSpringDampingLimited (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_springDampingLimited_set(swigCPtr, this, value);
}
public boolean[] getSpringDampingLimited () {
return DynamicsJNI.btTranslationalLimitMotor2_springDampingLimited_get(swigCPtr, this);
}
public void setEquilibriumPoint (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_equilibriumPoint_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getEquilibriumPoint () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_equilibriumPoint_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setTargetVelocity (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_targetVelocity_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getTargetVelocity () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_targetVelocity_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setMaxMotorForce (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_maxMotorForce_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getMaxMotorForce () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_maxMotorForce_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLimitError (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLimitError_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getCurrentLimitError () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_currentLimitError_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLimitErrorHi (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLimitErrorHi_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getCurrentLimitErrorHi () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_currentLimitErrorHi_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLinearDiff (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLinearDiff_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getCurrentLinearDiff () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_currentLinearDiff_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLimit (int[] value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLimit_set(swigCPtr, this, value);
}
public int[] getCurrentLimit () {
return DynamicsJNI.btTranslationalLimitMotor2_currentLimit_get(swigCPtr, this);
}
public btTranslationalLimitMotor2 () {
this(DynamicsJNI.new_btTranslationalLimitMotor2__SWIG_0(), true);
}
public btTranslationalLimitMotor2 (btTranslationalLimitMotor2 other) {
this(DynamicsJNI.new_btTranslationalLimitMotor2__SWIG_1(btTranslationalLimitMotor2.getCPtr(other), other), true);
}
public boolean isLimited (int limitIndex) {
return DynamicsJNI.btTranslationalLimitMotor2_isLimited(swigCPtr, this, limitIndex);
}
public void testLimitValue (int limitIndex, float test_value) {
DynamicsJNI.btTranslationalLimitMotor2_testLimitValue(swigCPtr, this, limitIndex, test_value);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class btTranslationalLimitMotor2 extends BulletBase {
private long swigCPtr;
protected btTranslationalLimitMotor2 (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTranslationalLimitMotor2, normally you should not need this constructor it's intended for low-level
* usage. */
public btTranslationalLimitMotor2 (long cPtr, boolean cMemoryOwn) {
this("btTranslationalLimitMotor2", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btTranslationalLimitMotor2 obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btTranslationalLimitMotor2(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setLowerLimit (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_lowerLimit_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getLowerLimit () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_lowerLimit_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setUpperLimit (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_upperLimit_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getUpperLimit () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_upperLimit_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setBounce (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_bounce_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getBounce () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_bounce_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setStopERP (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_stopERP_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getStopERP () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_stopERP_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setStopCFM (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_stopCFM_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getStopCFM () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_stopCFM_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setMotorERP (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_motorERP_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getMotorERP () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_motorERP_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setMotorCFM (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_motorCFM_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getMotorCFM () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_motorCFM_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setEnableMotor (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_enableMotor_set(swigCPtr, this, value);
}
public boolean[] getEnableMotor () {
return DynamicsJNI.btTranslationalLimitMotor2_enableMotor_get(swigCPtr, this);
}
public void setServoMotor (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_servoMotor_set(swigCPtr, this, value);
}
public boolean[] getServoMotor () {
return DynamicsJNI.btTranslationalLimitMotor2_servoMotor_get(swigCPtr, this);
}
public void setEnableSpring (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_enableSpring_set(swigCPtr, this, value);
}
public boolean[] getEnableSpring () {
return DynamicsJNI.btTranslationalLimitMotor2_enableSpring_get(swigCPtr, this);
}
public void setServoTarget (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_servoTarget_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getServoTarget () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_servoTarget_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSpringStiffness (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_springStiffness_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getSpringStiffness () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_springStiffness_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSpringStiffnessLimited (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_springStiffnessLimited_set(swigCPtr, this, value);
}
public boolean[] getSpringStiffnessLimited () {
return DynamicsJNI.btTranslationalLimitMotor2_springStiffnessLimited_get(swigCPtr, this);
}
public void setSpringDamping (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_springDamping_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getSpringDamping () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_springDamping_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSpringDampingLimited (boolean[] value) {
DynamicsJNI.btTranslationalLimitMotor2_springDampingLimited_set(swigCPtr, this, value);
}
public boolean[] getSpringDampingLimited () {
return DynamicsJNI.btTranslationalLimitMotor2_springDampingLimited_get(swigCPtr, this);
}
public void setEquilibriumPoint (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_equilibriumPoint_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getEquilibriumPoint () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_equilibriumPoint_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setTargetVelocity (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_targetVelocity_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getTargetVelocity () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_targetVelocity_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setMaxMotorForce (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_maxMotorForce_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getMaxMotorForce () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_maxMotorForce_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLimitError (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLimitError_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getCurrentLimitError () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_currentLimitError_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLimitErrorHi (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLimitErrorHi_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getCurrentLimitErrorHi () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_currentLimitErrorHi_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLinearDiff (btVector3 value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLinearDiff_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getCurrentLinearDiff () {
long cPtr = DynamicsJNI.btTranslationalLimitMotor2_currentLinearDiff_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setCurrentLimit (int[] value) {
DynamicsJNI.btTranslationalLimitMotor2_currentLimit_set(swigCPtr, this, value);
}
public int[] getCurrentLimit () {
return DynamicsJNI.btTranslationalLimitMotor2_currentLimit_get(swigCPtr, this);
}
public btTranslationalLimitMotor2 () {
this(DynamicsJNI.new_btTranslationalLimitMotor2__SWIG_0(), true);
}
public btTranslationalLimitMotor2 (btTranslationalLimitMotor2 other) {
this(DynamicsJNI.new_btTranslationalLimitMotor2__SWIG_1(btTranslationalLimitMotor2.getCPtr(other), other), true);
}
public boolean isLimited (int limitIndex) {
return DynamicsJNI.btTranslationalLimitMotor2_isLimited(swigCPtr, this, limitIndex);
}
public void testLimitValue (int limitIndex, float test_value) {
DynamicsJNI.btTranslationalLimitMotor2_testLimitValue(swigCPtr, this, limitIndex, test_value);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/scenes/scene2d/actions/SizeToAction.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.actions;
/** Moves an actor from its current size to a specific size.
* @author Nathan Sweet */
public class SizeToAction extends TemporalAction {
private float startWidth, startHeight;
private float endWidth, endHeight;
protected void begin () {
startWidth = target.getWidth();
startHeight = target.getHeight();
}
protected void update (float percent) {
float width, height;
if (percent == 0) {
width = startWidth;
height = startHeight;
} else if (percent == 1) {
width = endWidth;
height = endHeight;
} else {
width = startWidth + (endWidth - startWidth) * percent;
height = startHeight + (endHeight - startHeight) * percent;
}
target.setSize(width, height);
}
public void setSize (float width, float height) {
endWidth = width;
endHeight = height;
}
public float getWidth () {
return endWidth;
}
public void setWidth (float width) {
endWidth = width;
}
public float getHeight () {
return endHeight;
}
public void setHeight (float height) {
endHeight = height;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.actions;
/** Moves an actor from its current size to a specific size.
* @author Nathan Sweet */
public class SizeToAction extends TemporalAction {
private float startWidth, startHeight;
private float endWidth, endHeight;
protected void begin () {
startWidth = target.getWidth();
startHeight = target.getHeight();
}
protected void update (float percent) {
float width, height;
if (percent == 0) {
width = startWidth;
height = startHeight;
} else if (percent == 1) {
width = endWidth;
height = endHeight;
} else {
width = startWidth + (endWidth - startWidth) * percent;
height = startHeight + (endHeight - startHeight) * percent;
}
target.setSize(width, height);
}
public void setSize (float width, float height) {
endWidth = width;
endHeight = height;
}
public float getWidth () {
return endWidth;
}
public void setWidth (float width) {
endWidth = width;
}
public float getHeight () {
return endHeight;
}
public void setHeight (float height) {
endHeight = height;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btTriangleShapeEx.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Matrix4;
public class btTriangleShapeEx extends btTriangleShape {
private long swigCPtr;
protected btTriangleShapeEx (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btTriangleShapeEx_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTriangleShapeEx, normally you should not need this constructor it's intended for low-level usage. */
public btTriangleShapeEx (long cPtr, boolean cMemoryOwn) {
this("btTriangleShapeEx", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btTriangleShapeEx_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btTriangleShapeEx obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btTriangleShapeEx(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btTriangleShapeEx () {
this(CollisionJNI.new_btTriangleShapeEx__SWIG_0(), true);
}
public btTriangleShapeEx (Vector3 p0, Vector3 p1, Vector3 p2) {
this(CollisionJNI.new_btTriangleShapeEx__SWIG_1(p0, p1, p2), true);
}
public btTriangleShapeEx (btTriangleShapeEx other) {
this(CollisionJNI.new_btTriangleShapeEx__SWIG_2(btTriangleShapeEx.getCPtr(other), other), true);
}
public void applyTransform (Matrix4 t) {
CollisionJNI.btTriangleShapeEx_applyTransform(swigCPtr, this, t);
}
public void buildTriPlane (btVector4 plane) {
CollisionJNI.btTriangleShapeEx_buildTriPlane(swigCPtr, this, btVector4.getCPtr(plane), plane);
}
public boolean overlap_test_conservative (btTriangleShapeEx other) {
return CollisionJNI.btTriangleShapeEx_overlap_test_conservative(swigCPtr, this, btTriangleShapeEx.getCPtr(other), other);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Matrix4;
public class btTriangleShapeEx extends btTriangleShape {
private long swigCPtr;
protected btTriangleShapeEx (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btTriangleShapeEx_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTriangleShapeEx, normally you should not need this constructor it's intended for low-level usage. */
public btTriangleShapeEx (long cPtr, boolean cMemoryOwn) {
this("btTriangleShapeEx", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btTriangleShapeEx_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btTriangleShapeEx obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btTriangleShapeEx(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btTriangleShapeEx () {
this(CollisionJNI.new_btTriangleShapeEx__SWIG_0(), true);
}
public btTriangleShapeEx (Vector3 p0, Vector3 p1, Vector3 p2) {
this(CollisionJNI.new_btTriangleShapeEx__SWIG_1(p0, p1, p2), true);
}
public btTriangleShapeEx (btTriangleShapeEx other) {
this(CollisionJNI.new_btTriangleShapeEx__SWIG_2(btTriangleShapeEx.getCPtr(other), other), true);
}
public void applyTransform (Matrix4 t) {
CollisionJNI.btTriangleShapeEx_applyTransform(swigCPtr, this, t);
}
public void buildTriPlane (btVector4 plane) {
CollisionJNI.btTriangleShapeEx_buildTriPlane(swigCPtr, this, btVector4.getCPtr(plane), plane);
}
public boolean overlap_test_conservative (btTriangleShapeEx other) {
return CollisionJNI.btTriangleShapeEx_overlap_test_conservative(swigCPtr, this, btTriangleShapeEx.getCPtr(other), other);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/org/jbox2d/dynamics/contacts/CircleContact.java | /*******************************************************************************
* Copyright (c) 2013, Daniel Murphy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
package org.jbox2d.dynamics.contacts;
import org.jbox2d.collision.Manifold;
import org.jbox2d.collision.shapes.CircleShape;
import org.jbox2d.collision.shapes.ShapeType;
import org.jbox2d.common.Transform;
import org.jbox2d.dynamics.Fixture;
import org.jbox2d.pooling.IWorldPool;
public class CircleContact extends Contact {
public CircleContact (IWorldPool argPool) {
super(argPool);
}
public void init (Fixture fixtureA, Fixture fixtureB) {
super.init(fixtureA, 0, fixtureB, 0);
assert (m_fixtureA.getType() == ShapeType.CIRCLE);
assert (m_fixtureB.getType() == ShapeType.CIRCLE);
}
@Override
public void evaluate (Manifold manifold, Transform xfA, Transform xfB) {
pool.getCollision().collideCircles(manifold, (CircleShape)m_fixtureA.getShape(), xfA, (CircleShape)m_fixtureB.getShape(),
xfB);
}
}
| /*******************************************************************************
* Copyright (c) 2013, Daniel Murphy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
package org.jbox2d.dynamics.contacts;
import org.jbox2d.collision.Manifold;
import org.jbox2d.collision.shapes.CircleShape;
import org.jbox2d.collision.shapes.ShapeType;
import org.jbox2d.common.Transform;
import org.jbox2d.dynamics.Fixture;
import org.jbox2d.pooling.IWorldPool;
public class CircleContact extends Contact {
public CircleContact (IWorldPool argPool) {
super(argPool);
}
public void init (Fixture fixtureA, Fixture fixtureB) {
super.init(fixtureA, 0, fixtureB, 0);
assert (m_fixtureA.getType() == ShapeType.CIRCLE);
assert (m_fixtureB.getType() == ShapeType.CIRCLE);
}
@Override
public void evaluate (Manifold manifold, Transform xfA, Transform xfB) {
pool.getCollision().collideCircles(manifold, (CircleShape)m_fixtureA.getShape(), xfA, (CircleShape)m_fixtureB.getShape(),
xfB);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/StageTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
public class StageTest extends GdxTest implements InputProcessor {
private static final int NUM_GROUPS = 4;
private static final int NUM_SPRITES = (int)Math.sqrt(150 / NUM_GROUPS);
private static final float SPACING = 5;
ShapeRenderer renderer;
Stage stage;
Stage ui;
Texture texture;
Texture uiTexture;
BitmapFont font;
boolean rotateSprites = false;
boolean scaleSprites = false;
float angle;
Array<Actor> sprites = new Array();
float scale = 1;
float vScale = 1;
Label fps;
@Override
public void create () {
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/lsans-15.fnt"), false);
stage = new Stage(new ScreenViewport());
float loc = (NUM_SPRITES * (32 + SPACING) - SPACING) / 2;
for (int i = 0; i < NUM_GROUPS; i++) {
Group group = new Group();
group.setX((float)Math.random() * (stage.getWidth() - NUM_SPRITES * (32 + SPACING)));
group.setY((float)Math.random() * (stage.getHeight() - NUM_SPRITES * (32 + SPACING)));
group.setOrigin(loc, loc);
fillGroup(group, texture);
stage.addActor(group);
}
uiTexture = new Texture(Gdx.files.internal("data/ui.png"));
uiTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
ui = new Stage(new ScreenViewport());
Image blend = new Image(new TextureRegion(uiTexture, 0, 0, 64, 32));
blend.setAlign(Align.center);
blend.setScaling(Scaling.none);
blend.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (stage.getBatch().isBlendingEnabled())
stage.getBatch().disableBlending();
else
stage.getBatch().enableBlending();
return true;
}
});
blend.setY(ui.getHeight() - 64);
Image rotate = new Image(new TextureRegion(uiTexture, 64, 0, 64, 32));
rotate.setAlign(Align.center);
rotate.setScaling(Scaling.none);
rotate.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
rotateSprites = !rotateSprites;
return true;
}
});
rotate.setPosition(64, blend.getY());
Image scale = new Image(new TextureRegion(uiTexture, 64, 32, 64, 32));
scale.setAlign(Align.center);
scale.setScaling(Scaling.none);
scale.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
scaleSprites = !scaleSprites;
return true;
}
});
scale.setPosition(128, blend.getY());
{
Actor shapeActor = new Actor() {
public void drawDebug (ShapeRenderer shapes) {
shapes.set(ShapeType.Filled);
shapes.setColor(getColor());
shapes.rect(getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(),
getRotation());
}
};
shapeActor.setBounds(0, 0, 100, 150);
shapeActor.setOrigin(50, 75);
shapeActor.debug();
sprites.add(shapeActor);
Group shapeGroup = new Group();
shapeGroup.setBounds(300, 300, 300, 300);
shapeGroup.setOrigin(50, 75);
shapeGroup.setTouchable(Touchable.childrenOnly);
shapeGroup.addActor(shapeActor);
stage.addActor(shapeGroup);
}
ui.addActor(blend);
ui.addActor(rotate);
ui.addActor(scale);
fps = new Label("fps: 0", new Label.LabelStyle(font, Color.WHITE));
fps.setPosition(10, 30);
fps.setColor(0, 1, 0, 1);
ui.addActor(fps);
renderer = new ShapeRenderer();
Gdx.input.setInputProcessor(this);
}
private void fillGroup (Group group, Texture texture) {
float advance = 32 + SPACING;
for (int y = 0; y < NUM_SPRITES * advance; y += advance)
for (int x = 0; x < NUM_SPRITES * advance; x += advance) {
Image img = new Image(new TextureRegion(texture));
img.setAlign(Align.center);
img.setScaling(Scaling.none);
img.setBounds(x, y, 32, 32);
img.setOrigin(16, 16);
group.addActor(img);
sprites.add(img);
}
}
private final Vector2 stageCoords = new Vector2();
@Override
public void render () {
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
ScreenUtils.clear(0.2f, 0.2f, 0.2f, 1);
if (Gdx.input.isTouched()) {
stage.screenToStageCoordinates(stageCoords.set(Gdx.input.getX(), Gdx.input.getY()));
Actor actor = stage.hit(stageCoords.x, stageCoords.y, true);
if (actor != null)
actor.setColor((float)Math.random(), (float)Math.random(), (float)Math.random(), 0.5f + 0.5f * (float)Math.random());
}
Array<Actor> actors = stage.getActors();
int len = actors.size;
if (rotateSprites) {
for (int i = 0; i < len; i++)
actors.get(i).rotateBy(Gdx.graphics.getDeltaTime() * 10);
}
scale += vScale * Gdx.graphics.getDeltaTime();
if (scale > 1) {
scale = 1;
vScale = -vScale;
}
if (scale < 0.5f) {
scale = 0.5f;
vScale = -vScale;
}
len = sprites.size;
for (int i = 0; i < len; i++) {
Actor sprite = sprites.get(i);
if (rotateSprites)
sprite.rotateBy(-40 * Gdx.graphics.getDeltaTime());
else
sprite.setRotation(0);
if (scaleSprites) {
sprite.setScale(scale);
} else {
sprite.setScale(1);
}
}
stage.draw();
renderer.begin(ShapeType.Point);
renderer.setColor(1, 0, 0, 1);
len = actors.size;
for (int i = 0; i < len; i++) {
Group group = (Group)actors.get(i);
renderer.point(group.getX() + group.getOriginX(), group.getY() + group.getOriginY(), 0);
}
renderer.end();
fps.setText("fps: " + Gdx.graphics.getFramesPerSecond() + ", actors " + sprites.size + ", groups " + sprites.size);
ui.draw();
}
@Override
public boolean touchDown (int x, int y, int pointer, int button) {
return ui.touchDown(x, y, pointer, button);
}
public void resize (int width, int height) {
ui.getViewport().update(width, height, true);
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
ui.dispose();
renderer.dispose();
texture.dispose();
uiTexture.dispose();
font.dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
public class StageTest extends GdxTest implements InputProcessor {
private static final int NUM_GROUPS = 4;
private static final int NUM_SPRITES = (int)Math.sqrt(150 / NUM_GROUPS);
private static final float SPACING = 5;
ShapeRenderer renderer;
Stage stage;
Stage ui;
Texture texture;
Texture uiTexture;
BitmapFont font;
boolean rotateSprites = false;
boolean scaleSprites = false;
float angle;
Array<Actor> sprites = new Array();
float scale = 1;
float vScale = 1;
Label fps;
@Override
public void create () {
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/lsans-15.fnt"), false);
stage = new Stage(new ScreenViewport());
float loc = (NUM_SPRITES * (32 + SPACING) - SPACING) / 2;
for (int i = 0; i < NUM_GROUPS; i++) {
Group group = new Group();
group.setX((float)Math.random() * (stage.getWidth() - NUM_SPRITES * (32 + SPACING)));
group.setY((float)Math.random() * (stage.getHeight() - NUM_SPRITES * (32 + SPACING)));
group.setOrigin(loc, loc);
fillGroup(group, texture);
stage.addActor(group);
}
uiTexture = new Texture(Gdx.files.internal("data/ui.png"));
uiTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
ui = new Stage(new ScreenViewport());
Image blend = new Image(new TextureRegion(uiTexture, 0, 0, 64, 32));
blend.setAlign(Align.center);
blend.setScaling(Scaling.none);
blend.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (stage.getBatch().isBlendingEnabled())
stage.getBatch().disableBlending();
else
stage.getBatch().enableBlending();
return true;
}
});
blend.setY(ui.getHeight() - 64);
Image rotate = new Image(new TextureRegion(uiTexture, 64, 0, 64, 32));
rotate.setAlign(Align.center);
rotate.setScaling(Scaling.none);
rotate.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
rotateSprites = !rotateSprites;
return true;
}
});
rotate.setPosition(64, blend.getY());
Image scale = new Image(new TextureRegion(uiTexture, 64, 32, 64, 32));
scale.setAlign(Align.center);
scale.setScaling(Scaling.none);
scale.addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
scaleSprites = !scaleSprites;
return true;
}
});
scale.setPosition(128, blend.getY());
{
Actor shapeActor = new Actor() {
public void drawDebug (ShapeRenderer shapes) {
shapes.set(ShapeType.Filled);
shapes.setColor(getColor());
shapes.rect(getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(),
getRotation());
}
};
shapeActor.setBounds(0, 0, 100, 150);
shapeActor.setOrigin(50, 75);
shapeActor.debug();
sprites.add(shapeActor);
Group shapeGroup = new Group();
shapeGroup.setBounds(300, 300, 300, 300);
shapeGroup.setOrigin(50, 75);
shapeGroup.setTouchable(Touchable.childrenOnly);
shapeGroup.addActor(shapeActor);
stage.addActor(shapeGroup);
}
ui.addActor(blend);
ui.addActor(rotate);
ui.addActor(scale);
fps = new Label("fps: 0", new Label.LabelStyle(font, Color.WHITE));
fps.setPosition(10, 30);
fps.setColor(0, 1, 0, 1);
ui.addActor(fps);
renderer = new ShapeRenderer();
Gdx.input.setInputProcessor(this);
}
private void fillGroup (Group group, Texture texture) {
float advance = 32 + SPACING;
for (int y = 0; y < NUM_SPRITES * advance; y += advance)
for (int x = 0; x < NUM_SPRITES * advance; x += advance) {
Image img = new Image(new TextureRegion(texture));
img.setAlign(Align.center);
img.setScaling(Scaling.none);
img.setBounds(x, y, 32, 32);
img.setOrigin(16, 16);
group.addActor(img);
sprites.add(img);
}
}
private final Vector2 stageCoords = new Vector2();
@Override
public void render () {
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
ScreenUtils.clear(0.2f, 0.2f, 0.2f, 1);
if (Gdx.input.isTouched()) {
stage.screenToStageCoordinates(stageCoords.set(Gdx.input.getX(), Gdx.input.getY()));
Actor actor = stage.hit(stageCoords.x, stageCoords.y, true);
if (actor != null)
actor.setColor((float)Math.random(), (float)Math.random(), (float)Math.random(), 0.5f + 0.5f * (float)Math.random());
}
Array<Actor> actors = stage.getActors();
int len = actors.size;
if (rotateSprites) {
for (int i = 0; i < len; i++)
actors.get(i).rotateBy(Gdx.graphics.getDeltaTime() * 10);
}
scale += vScale * Gdx.graphics.getDeltaTime();
if (scale > 1) {
scale = 1;
vScale = -vScale;
}
if (scale < 0.5f) {
scale = 0.5f;
vScale = -vScale;
}
len = sprites.size;
for (int i = 0; i < len; i++) {
Actor sprite = sprites.get(i);
if (rotateSprites)
sprite.rotateBy(-40 * Gdx.graphics.getDeltaTime());
else
sprite.setRotation(0);
if (scaleSprites) {
sprite.setScale(scale);
} else {
sprite.setScale(1);
}
}
stage.draw();
renderer.begin(ShapeType.Point);
renderer.setColor(1, 0, 0, 1);
len = actors.size;
for (int i = 0; i < len; i++) {
Group group = (Group)actors.get(i);
renderer.point(group.getX() + group.getOriginX(), group.getY() + group.getOriginY(), 0);
}
renderer.end();
fps.setText("fps: " + Gdx.graphics.getFramesPerSecond() + ", actors " + sprites.size + ", groups " + sprites.size);
ui.draw();
}
@Override
public boolean touchDown (int x, int y, int pointer, int button) {
return ui.touchDown(x, y, pointer, button);
}
public void resize (int width, int height) {
ui.getViewport().update(width, height, true);
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
ui.dispose();
renderer.dispose();
texture.dispose();
uiTexture.dispose();
font.dispose();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/shadows/system/classical/Pass1Shader.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.g3d.shadows.system.classical;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
/** This shader pack the depth data into the texture
* @author realitix */
public class Pass1Shader extends DefaultShader {
private static String defaultVertexShader = null;
public static String getDefaultVertexShader () {
if (defaultVertexShader == null) defaultVertexShader = Gdx.files
.classpath("com/badlogic/gdx/tests/g3d/shadows/system/classical/pass1.vertex.glsl").readString();
return defaultVertexShader;
}
private static String defaultFragmentShader = null;
public static String getDefaultFragmentShader () {
if (defaultFragmentShader == null) defaultFragmentShader = Gdx.files
.classpath("com/badlogic/gdx/tests/g3d/shadows/system/classical/pass1.fragment.glsl").readString();
return defaultFragmentShader;
}
public Pass1Shader (final Renderable renderable) {
this(renderable, new Config());
}
public Pass1Shader (final Renderable renderable, final Config config) {
this(renderable, config, createPrefix(renderable, config));
}
public Pass1Shader (final Renderable renderable, final Config config, final String prefix) {
this(renderable, config, prefix, config.vertexShader != null ? config.vertexShader : getDefaultVertexShader(),
config.fragmentShader != null ? config.fragmentShader : getDefaultFragmentShader());
}
public Pass1Shader (final Renderable renderable, final Config config, final String prefix, final String vertexShader,
final String fragmentShader) {
this(renderable, config, new ShaderProgram(prefix + vertexShader, prefix + fragmentShader));
}
public Pass1Shader (final Renderable renderable, final Config config, final ShaderProgram shaderProgram) {
super(renderable, config, shaderProgram);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.g3d.shadows.system.classical;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
/** This shader pack the depth data into the texture
* @author realitix */
public class Pass1Shader extends DefaultShader {
private static String defaultVertexShader = null;
public static String getDefaultVertexShader () {
if (defaultVertexShader == null) defaultVertexShader = Gdx.files
.classpath("com/badlogic/gdx/tests/g3d/shadows/system/classical/pass1.vertex.glsl").readString();
return defaultVertexShader;
}
private static String defaultFragmentShader = null;
public static String getDefaultFragmentShader () {
if (defaultFragmentShader == null) defaultFragmentShader = Gdx.files
.classpath("com/badlogic/gdx/tests/g3d/shadows/system/classical/pass1.fragment.glsl").readString();
return defaultFragmentShader;
}
public Pass1Shader (final Renderable renderable) {
this(renderable, new Config());
}
public Pass1Shader (final Renderable renderable, final Config config) {
this(renderable, config, createPrefix(renderable, config));
}
public Pass1Shader (final Renderable renderable, final Config config, final String prefix) {
this(renderable, config, prefix, config.vertexShader != null ? config.vertexShader : getDefaultVertexShader(),
config.fragmentShader != null ? config.fragmentShader : getDefaultFragmentShader());
}
public Pass1Shader (final Renderable renderable, final Config config, final String prefix, final String vertexShader,
final String fragmentShader) {
this(renderable, config, new ShaderProgram(prefix + vertexShader, prefix + fragmentShader));
}
public Pass1Shader (final Renderable renderable, final Config config, final ShaderProgram shaderProgram) {
super(renderable, config, shaderProgram);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/scenes/scene2d/actions/RunnableAction.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.actions;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.utils.Pool;
/** An action that runs a {@link Runnable}. Alternatively, the {@link #run()} method can be overridden instead of setting a
* runnable.
* @author Nathan Sweet */
public class RunnableAction extends Action {
private Runnable runnable;
private boolean ran;
public boolean act (float delta) {
if (!ran) {
ran = true;
run();
}
return true;
}
/** Called to run the runnable. */
public void run () {
Pool pool = getPool();
setPool(null); // Ensure this action can't be returned to the pool inside the runnable.
try {
runnable.run();
} finally {
setPool(pool);
}
}
public void restart () {
ran = false;
}
public void reset () {
super.reset();
runnable = null;
}
public Runnable getRunnable () {
return runnable;
}
public void setRunnable (Runnable runnable) {
this.runnable = runnable;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.actions;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.utils.Pool;
/** An action that runs a {@link Runnable}. Alternatively, the {@link #run()} method can be overridden instead of setting a
* runnable.
* @author Nathan Sweet */
public class RunnableAction extends Action {
private Runnable runnable;
private boolean ran;
public boolean act (float delta) {
if (!ran) {
ran = true;
run();
}
return true;
}
/** Called to run the runnable. */
public void run () {
Pool pool = getPool();
setPool(null); // Ensure this action can't be returned to the pool inside the runnable.
try {
runnable.run();
} finally {
setPool(pool);
}
}
public void restart () {
ran = false;
}
public void reset () {
super.reset();
runnable = null;
}
public Runnable getRunnable () {
return runnable;
}
public void setRunnable (Runnable runnable) {
this.runnable = runnable;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/ShootTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
/** @author Xoppa */
public class ShootTest extends BaseBulletTest {
final int BOXCOUNT_X = 5;
final int BOXCOUNT_Y = 5;
final int BOXCOUNT_Z = 1;
final float BOXOFFSET_X = -2.5f;
final float BOXOFFSET_Y = 0.5f;
final float BOXOFFSET_Z = 0f;
BulletEntity ground;
@Override
public void create () {
super.create();
// Create the entities
(ground = world.add("ground", 0f, 0f, 0f)).setColor(0.25f + 0.5f * (float)Math.random(),
0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f);
for (int x = 0; x < BOXCOUNT_X; x++) {
for (int y = 0; y < BOXCOUNT_Y; y++) {
for (int z = 0; z < BOXCOUNT_Z; z++) {
world.add("box", BOXOFFSET_X + x, BOXOFFSET_Y + y, BOXOFFSET_Z + z).setColor(0.5f + 0.5f * (float)Math.random(),
0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.random(), 1f);
}
}
}
}
@Override
public boolean tap (float x, float y, int count, int button) {
shoot(x, y);
return true;
}
@Override
public void dispose () {
super.dispose();
ground = null;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
/** @author Xoppa */
public class ShootTest extends BaseBulletTest {
final int BOXCOUNT_X = 5;
final int BOXCOUNT_Y = 5;
final int BOXCOUNT_Z = 1;
final float BOXOFFSET_X = -2.5f;
final float BOXOFFSET_Y = 0.5f;
final float BOXOFFSET_Z = 0f;
BulletEntity ground;
@Override
public void create () {
super.create();
// Create the entities
(ground = world.add("ground", 0f, 0f, 0f)).setColor(0.25f + 0.5f * (float)Math.random(),
0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f);
for (int x = 0; x < BOXCOUNT_X; x++) {
for (int y = 0; y < BOXCOUNT_Y; y++) {
for (int z = 0; z < BOXCOUNT_Z; z++) {
world.add("box", BOXOFFSET_X + x, BOXOFFSET_Y + y, BOXOFFSET_Z + z).setColor(0.5f + 0.5f * (float)Math.random(),
0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.random(), 1f);
}
}
}
}
@Override
public boolean tap (float x, float y, int count, int button) {
shoot(x, y);
return true;
}
@Override
public void dispose () {
super.dispose();
ground = null;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/nio/ByteOrder.java | /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.nio;
//import org.apache.harmony.luni.platform.Platform;
/** Defines byte order constants.
*
* @since Android 1.0 */
public final class ByteOrder {
/** This constant represents big endian.
*
* @since Android 1.0 */
public static final ByteOrder BIG_ENDIAN = new ByteOrder("BIG_ENDIAN"); //$NON-NLS-1$
/** This constant represents little endian.
*
* @since Android 1.0 */
public static final ByteOrder LITTLE_ENDIAN = new ByteOrder("LITTLE_ENDIAN"); //$NON-NLS-1$
private static final ByteOrder NATIVE_ORDER;
static {
// if (Platform.getMemorySystem().isLittleEndian()) {
NATIVE_ORDER = LITTLE_ENDIAN;
// } else {
// NATIVE_ORDER = BIG_ENDIAN;
// }
}
/** Returns the current platform byte order.
*
* @return the byte order object, which is either LITTLE_ENDIAN or BIG_ENDIAN.
* @since Android 1.0 */
public static ByteOrder nativeOrder () {
return NATIVE_ORDER;
}
private final String name;
private ByteOrder (String name) {
super();
this.name = name;
}
/** Returns a string that describes this object.
*
* @return "BIG_ENDIAN" for {@link #BIG_ENDIAN ByteOrder.BIG_ENDIAN} objects, "LITTLE_ENDIAN" for {@link #LITTLE_ENDIAN
* ByteOrder.LITTLE_ENDIAN} objects.
* @since Android 1.0 */
public String toString () {
return name;
}
}
| /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.nio;
//import org.apache.harmony.luni.platform.Platform;
/** Defines byte order constants.
*
* @since Android 1.0 */
public final class ByteOrder {
/** This constant represents big endian.
*
* @since Android 1.0 */
public static final ByteOrder BIG_ENDIAN = new ByteOrder("BIG_ENDIAN"); //$NON-NLS-1$
/** This constant represents little endian.
*
* @since Android 1.0 */
public static final ByteOrder LITTLE_ENDIAN = new ByteOrder("LITTLE_ENDIAN"); //$NON-NLS-1$
private static final ByteOrder NATIVE_ORDER;
static {
// if (Platform.getMemorySystem().isLittleEndian()) {
NATIVE_ORDER = LITTLE_ENDIAN;
// } else {
// NATIVE_ORDER = BIG_ENDIAN;
// }
}
/** Returns the current platform byte order.
*
* @return the byte order object, which is either LITTLE_ENDIAN or BIG_ENDIAN.
* @since Android 1.0 */
public static ByteOrder nativeOrder () {
return NATIVE_ORDER;
}
private final String name;
private ByteOrder (String name) {
super();
this.name = name;
}
/** Returns a string that describes this object.
*
* @return "BIG_ENDIAN" for {@link #BIG_ENDIAN ByteOrder.BIG_ENDIAN} objects, "LITTLE_ENDIAN" for {@link #LITTLE_ENDIAN
* ByteOrder.LITTLE_ENDIAN} objects.
* @since Android 1.0 */
public String toString () {
return name;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/InputAdapter.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx;
/** An adapter class for {@link InputProcessor}. You can derive from this and only override what you are interested in.
*
* @author mzechner */
public class InputAdapter implements InputProcessor {
public boolean keyDown (int keycode) {
return false;
}
public boolean keyUp (int keycode) {
return false;
}
public boolean keyTyped (char character) {
return false;
}
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchUp (int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchCancelled (int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchDragged (int screenX, int screenY, int pointer) {
return false;
}
@Override
public boolean mouseMoved (int screenX, int screenY) {
return false;
}
@Override
public boolean scrolled (float amountX, float amountY) {
return false;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx;
/** An adapter class for {@link InputProcessor}. You can derive from this and only override what you are interested in.
*
* @author mzechner */
public class InputAdapter implements InputProcessor {
public boolean keyDown (int keycode) {
return false;
}
public boolean keyUp (int keycode) {
return false;
}
public boolean keyTyped (char character) {
return false;
}
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchUp (int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchCancelled (int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchDragged (int screenX, int screenY, int pointer) {
return false;
}
@Override
public boolean mouseMoved (int screenX, int screenY) {
return false;
}
@Override
public boolean scrolled (float amountX, float amountY) {
return false;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/TextAreaTest3.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.StringBuilder;
// test for TextField#textHeight calculation change
public class TextAreaTest3 extends GdxTest {
private Stage stage;
private Skin skin;
TextField textField;
TextArea textArea;
private TextField.TextFieldStyle styleDefault;
private TextField.TextFieldStyle styleLSans15;
private TextField.TextFieldStyle styleLSans32;
private TextField.TextFieldStyle styleFont;
@Override
public void create () {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
// default font in the skin has line height == text height, so its impossible to see updated selection/cursor rendering
styleDefault = skin.get(TextField.TextFieldStyle.class);
// nearest so its easier to see whats going on
styleDefault.font.getRegion().getTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
styleDefault.font.getData().setLineHeight(styleDefault.font.getData().lineHeight * 2);
printMetrics("default", styleDefault.font);
styleLSans15 = new TextField.TextFieldStyle(styleDefault);
styleLSans15.font = new BitmapFont(Gdx.files.internal("data/lsans-15.fnt"), Gdx.files.internal("data/lsans-15_00.png"),
false);
printMetrics("lsans15", styleLSans15.font);
styleLSans32 = new TextField.TextFieldStyle(styleDefault);
styleLSans32.font = new BitmapFont(Gdx.files.internal("data/lsans-32.fnt"), Gdx.files.internal("data/lsans-32.png"), false);
printMetrics("lsans32", styleLSans32.font);
styleFont = new TextField.TextFieldStyle(styleDefault);
styleFont.font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);
printMetrics("font", styleFont.font);
stage = new Stage();
Gdx.input.setInputProcessor(stage);
// easier to test this with proper layout
Table root = new Table();
root.setFillParent(true);
stage.addActor(root);
Table styleSelector = new Table();
styleSelector.defaults().pad(10);
root.add(styleSelector).row();
// | is the tallest char
textField = new TextField("| Text field", styleDefault);
root.add(textField).growX().pad(20, 100, 20, 100).row();
StringBuilder sb = new StringBuilder("| Text Area\nEssentially, a text field\nwith\nmultiple\nlines.\n");
// we need a bunch of lines to demonstrate that prefHeight is way too large
for (int i = 0; i < 30; i++) {
sb.append(
"It can even handle very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong lines.\n");
}
textArea = new TextArea(sb.toString(), styleLSans32);
// we need a container that will allow the TextArea to be as tall as it wants
// without the fix, text area height wont match text height depending on the fonts line height
ScrollPane pane = new ScrollPane(textArea, skin);
pane.setScrollingDisabled(true, false);
pane.setScrollbarsVisible(true);
pane.setFadeScrollBars(false);
root.add(pane).grow().pad(20, 100, 20, 100);
// after we init widgets
ButtonGroup<TextButton> group = new ButtonGroup<>();
styleSelector.add(newStyleButton("Default", styleDefault, group));
styleSelector.add(newStyleButton("LSans 15", styleLSans15, group));
styleSelector.add(newStyleButton("LSans 32", styleLSans32, group));
styleSelector.add(newStyleButton("Font", styleFont, group));
group.setMaxCheckCount(1);
group.setMinCheckCount(1);
group.setChecked("LSans 32");
}
private void printMetrics (String name, BitmapFont font) {
BitmapFont.BitmapFontData data = font.getData();
float textHeight = data.capHeight - data.descent;
float textFieldHeight = data.capHeight - data.descent * 2;
Gdx.app.log(name, "line height = " + data.lineHeight + ", text height = " + textHeight + ", text field height = "
+ textFieldHeight + ", cap height = " + data.capHeight + ", descent = " + data.descent);
}
private Button newStyleButton (final String label, final TextField.TextFieldStyle style, ButtonGroup<TextButton> group) {
TextButton button = new TextButton(label, skin, "toggle");
button.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
textField.setStyle(style);
textArea.setStyle(style);
}
});
group.add(button);
return button;
}
@Override
public void render () {
ScreenUtils.clear(0.2f, 0.2f, 0.2f, 1);
stage.act();
stage.draw();
// getLines() does not return correct count before first draw happens and there is no other way to trigger update
textArea.setPrefRows(textArea.getLines());
// change does not propagate on its own, number of lines does not change so calling this each frame is not necessary
textArea.invalidateHierarchy();
}
@Override
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
stage.dispose();
skin.dispose();
styleLSans15.font.getRegion().getTexture().dispose();
styleLSans32.font.getRegion().getTexture().dispose();
styleFont.font.getRegion().getTexture().dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.StringBuilder;
// test for TextField#textHeight calculation change
public class TextAreaTest3 extends GdxTest {
private Stage stage;
private Skin skin;
TextField textField;
TextArea textArea;
private TextField.TextFieldStyle styleDefault;
private TextField.TextFieldStyle styleLSans15;
private TextField.TextFieldStyle styleLSans32;
private TextField.TextFieldStyle styleFont;
@Override
public void create () {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
// default font in the skin has line height == text height, so its impossible to see updated selection/cursor rendering
styleDefault = skin.get(TextField.TextFieldStyle.class);
// nearest so its easier to see whats going on
styleDefault.font.getRegion().getTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
styleDefault.font.getData().setLineHeight(styleDefault.font.getData().lineHeight * 2);
printMetrics("default", styleDefault.font);
styleLSans15 = new TextField.TextFieldStyle(styleDefault);
styleLSans15.font = new BitmapFont(Gdx.files.internal("data/lsans-15.fnt"), Gdx.files.internal("data/lsans-15_00.png"),
false);
printMetrics("lsans15", styleLSans15.font);
styleLSans32 = new TextField.TextFieldStyle(styleDefault);
styleLSans32.font = new BitmapFont(Gdx.files.internal("data/lsans-32.fnt"), Gdx.files.internal("data/lsans-32.png"), false);
printMetrics("lsans32", styleLSans32.font);
styleFont = new TextField.TextFieldStyle(styleDefault);
styleFont.font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);
printMetrics("font", styleFont.font);
stage = new Stage();
Gdx.input.setInputProcessor(stage);
// easier to test this with proper layout
Table root = new Table();
root.setFillParent(true);
stage.addActor(root);
Table styleSelector = new Table();
styleSelector.defaults().pad(10);
root.add(styleSelector).row();
// | is the tallest char
textField = new TextField("| Text field", styleDefault);
root.add(textField).growX().pad(20, 100, 20, 100).row();
StringBuilder sb = new StringBuilder("| Text Area\nEssentially, a text field\nwith\nmultiple\nlines.\n");
// we need a bunch of lines to demonstrate that prefHeight is way too large
for (int i = 0; i < 30; i++) {
sb.append(
"It can even handle very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong lines.\n");
}
textArea = new TextArea(sb.toString(), styleLSans32);
// we need a container that will allow the TextArea to be as tall as it wants
// without the fix, text area height wont match text height depending on the fonts line height
ScrollPane pane = new ScrollPane(textArea, skin);
pane.setScrollingDisabled(true, false);
pane.setScrollbarsVisible(true);
pane.setFadeScrollBars(false);
root.add(pane).grow().pad(20, 100, 20, 100);
// after we init widgets
ButtonGroup<TextButton> group = new ButtonGroup<>();
styleSelector.add(newStyleButton("Default", styleDefault, group));
styleSelector.add(newStyleButton("LSans 15", styleLSans15, group));
styleSelector.add(newStyleButton("LSans 32", styleLSans32, group));
styleSelector.add(newStyleButton("Font", styleFont, group));
group.setMaxCheckCount(1);
group.setMinCheckCount(1);
group.setChecked("LSans 32");
}
private void printMetrics (String name, BitmapFont font) {
BitmapFont.BitmapFontData data = font.getData();
float textHeight = data.capHeight - data.descent;
float textFieldHeight = data.capHeight - data.descent * 2;
Gdx.app.log(name, "line height = " + data.lineHeight + ", text height = " + textHeight + ", text field height = "
+ textFieldHeight + ", cap height = " + data.capHeight + ", descent = " + data.descent);
}
private Button newStyleButton (final String label, final TextField.TextFieldStyle style, ButtonGroup<TextButton> group) {
TextButton button = new TextButton(label, skin, "toggle");
button.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
textField.setStyle(style);
textArea.setStyle(style);
}
});
group.add(button);
return button;
}
@Override
public void render () {
ScreenUtils.clear(0.2f, 0.2f, 0.2f, 1);
stage.act();
stage.draw();
// getLines() does not return correct count before first draw happens and there is no other way to trigger update
textArea.setPrefRows(textArea.getLines());
// change does not propagate on its own, number of lines does not change so calling this each frame is not necessary
textArea.invalidateHierarchy();
}
@Override
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
stage.dispose();
skin.dispose();
styleLSans15.font.getRegion().getTexture().dispose();
styleLSans32.font.getRegion().getTexture().dispose();
styleFont.font.getRegion().getTexture().dispose();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/g3d/particles/values/ParticleValue.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles.values;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonValue;
/** It's a class which represents a value bound to the particles. Generally used by a particle controller component to find the
* current value of a particle property during the simulation.
* @author Inferno */
public class ParticleValue implements Json.Serializable {
public boolean active;
public ParticleValue () {
}
public ParticleValue (ParticleValue value) {
this.active = value.active;
}
public boolean isActive () {
return active;
}
public void setActive (boolean active) {
this.active = active;
}
public void load (ParticleValue value) {
active = value.active;
}
@Override
public void write (Json json) {
json.writeValue("active", active);
}
@Override
public void read (Json json, JsonValue jsonData) {
active = json.readValue("active", Boolean.class, jsonData);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles.values;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonValue;
/** It's a class which represents a value bound to the particles. Generally used by a particle controller component to find the
* current value of a particle property during the simulation.
* @author Inferno */
public class ParticleValue implements Json.Serializable {
public boolean active;
public ParticleValue () {
}
public ParticleValue (ParticleValue value) {
this.active = value.active;
}
public boolean isActive () {
return active;
}
public void setActive (boolean active) {
this.active = active;
}
public void load (ParticleValue value) {
active = value.active;
}
@Override
public void write (Json json) {
json.writeValue("active", active);
}
@Override
public void read (Json json, JsonValue jsonData) {
active = json.readValue("active", Boolean.class, jsonData);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/QuadTreeFloatNearestTest.java |
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.FloatArray;
import com.badlogic.gdx.utils.QuadTreeFloat;
public class QuadTreeFloatNearestTest extends GdxTest {
QuadTreeFloat q = new QuadTreeFloat();
FloatArray points = new FloatArray(100 * 2);
ShapeRenderer shapes;
FloatArray results = new FloatArray(false, 16);
public void create () {
shapes = new ShapeRenderer();
q.setBounds(10, 10, 400, 400);
for (int i = 0; i < 30; i++) {
float x = MathUtils.random(10, 400);
float y = MathUtils.random(10, 400);
points.add(x, y);
q.add(i, x, y);
}
}
public void render () {
float x = Gdx.input.getX(), y = Gdx.graphics.getHeight() - Gdx.input.getY();
results.clear();
boolean found = q.nearest(x, y, results);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
shapes.begin(ShapeType.Line);
draw(q);
shapes.setColor(Color.GREEN);
if (found) {
float radius = (float)Math.sqrt(results.get(QuadTreeFloat.DISTSQR));
shapes.circle(x, y, radius);
float foundX = results.get(QuadTreeFloat.X), foundY = results.get(QuadTreeFloat.Y);
shapes.circle(foundX, foundY, 10);
}
shapes.end();
}
void draw (QuadTreeFloat q) {
shapes.setColor(Color.WHITE);
shapes.rect(q.x, q.y, q.width, q.height);
if (q.values != null) {
for (int i = 0, n = q.count; i < n; i += 3) {
shapes.setColor(!results.isEmpty() && q.values[i] == results.get(QuadTreeFloat.VALUE) ? Color.YELLOW : Color.RED);
shapes.x(q.values[i + 1], q.values[i + 2], 7);
}
}
if (q.nw != null) draw(q.nw);
if (q.sw != null) draw(q.sw);
if (q.ne != null) draw(q.ne);
if (q.se != null) draw(q.se);
}
}
|
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.FloatArray;
import com.badlogic.gdx.utils.QuadTreeFloat;
public class QuadTreeFloatNearestTest extends GdxTest {
QuadTreeFloat q = new QuadTreeFloat();
FloatArray points = new FloatArray(100 * 2);
ShapeRenderer shapes;
FloatArray results = new FloatArray(false, 16);
public void create () {
shapes = new ShapeRenderer();
q.setBounds(10, 10, 400, 400);
for (int i = 0; i < 30; i++) {
float x = MathUtils.random(10, 400);
float y = MathUtils.random(10, 400);
points.add(x, y);
q.add(i, x, y);
}
}
public void render () {
float x = Gdx.input.getX(), y = Gdx.graphics.getHeight() - Gdx.input.getY();
results.clear();
boolean found = q.nearest(x, y, results);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
shapes.begin(ShapeType.Line);
draw(q);
shapes.setColor(Color.GREEN);
if (found) {
float radius = (float)Math.sqrt(results.get(QuadTreeFloat.DISTSQR));
shapes.circle(x, y, radius);
float foundX = results.get(QuadTreeFloat.X), foundY = results.get(QuadTreeFloat.Y);
shapes.circle(foundX, foundY, 10);
}
shapes.end();
}
void draw (QuadTreeFloat q) {
shapes.setColor(Color.WHITE);
shapes.rect(q.x, q.y, q.width, q.height);
if (q.values != null) {
for (int i = 0, n = q.count; i < n; i += 3) {
shapes.setColor(!results.isEmpty() && q.values[i] == results.get(QuadTreeFloat.VALUE) ? Color.YELLOW : Color.RED);
shapes.x(q.values[i + 1], q.values[i + 2], 7);
}
}
if (q.nw != null) draw(q.nw);
if (q.sw != null) draw(q.sw);
if (q.ne != null) draw(q.ne);
if (q.se != null) draw(q.se);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/btMultiBodyPoint2Point.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.math.Vector3;
public class btMultiBodyPoint2Point extends btMultiBodyConstraint {
private long swigCPtr;
protected btMultiBodyPoint2Point (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btMultiBodyPoint2Point, normally you should not need this constructor it's intended for low-level usage. */
public btMultiBodyPoint2Point (long cPtr, boolean cMemoryOwn) {
this("btMultiBodyPoint2Point", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btMultiBodyPoint2Point obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btMultiBodyPoint2Point(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public btMultiBodyPoint2Point (btMultiBody body, int link, btRigidBody bodyB, Vector3 pivotInA, Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_0(btMultiBody.getCPtr(body), body, link, btRigidBody.getCPtr(bodyB),
bodyB, pivotInA, pivotInB), true);
}
public btMultiBodyPoint2Point (btMultiBody bodyA, int linkA, btMultiBody bodyB, int linkB, Vector3 pivotInA,
Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_1(btMultiBody.getCPtr(bodyA), bodyA, linkA, btMultiBody.getCPtr(bodyB),
bodyB, linkB, pivotInA, pivotInB), true);
}
public Vector3 getPivotInB () {
return DynamicsJNI.btMultiBodyPoint2Point_getPivotInB(swigCPtr, this);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.math.Vector3;
public class btMultiBodyPoint2Point extends btMultiBodyConstraint {
private long swigCPtr;
protected btMultiBodyPoint2Point (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btMultiBodyPoint2Point, normally you should not need this constructor it's intended for low-level usage. */
public btMultiBodyPoint2Point (long cPtr, boolean cMemoryOwn) {
this("btMultiBodyPoint2Point", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btMultiBodyPoint2Point obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btMultiBodyPoint2Point(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public btMultiBodyPoint2Point (btMultiBody body, int link, btRigidBody bodyB, Vector3 pivotInA, Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_0(btMultiBody.getCPtr(body), body, link, btRigidBody.getCPtr(bodyB),
bodyB, pivotInA, pivotInB), true);
}
public btMultiBodyPoint2Point (btMultiBody bodyA, int linkA, btMultiBody bodyB, int linkB, Vector3 pivotInA,
Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_1(btMultiBody.getCPtr(bodyA), bodyA, linkA, btMultiBody.getCPtr(bodyB),
bodyB, linkB, pivotInA, pivotInB), true);
}
public Vector3 getPivotInB () {
return DynamicsJNI.btMultiBodyPoint2Point_getPivotInB(swigCPtr, this);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/TextureDataTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.FileTextureData;
import com.badlogic.gdx.tests.utils.GdxTest;
public class TextureDataTest extends GdxTest {
private SpriteBatch spriteBatch;
private Texture texture;
public void create () {
spriteBatch = new SpriteBatch();
// texture = new Texture(new PixmapTextureData(new Pixmap(Gdx.files.internal("data/t8890.png")), null, false, true));
texture = new Texture(new FileTextureData(Gdx.files.internal("data/t8890.png"), null, null, false));
}
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
spriteBatch.begin();
spriteBatch.draw(texture, 100, 100);
spriteBatch.end();
}
public boolean needsGL20 () {
return false;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.FileTextureData;
import com.badlogic.gdx.tests.utils.GdxTest;
public class TextureDataTest extends GdxTest {
private SpriteBatch spriteBatch;
private Texture texture;
public void create () {
spriteBatch = new SpriteBatch();
// texture = new Texture(new PixmapTextureData(new Pixmap(Gdx.files.internal("data/t8890.png")), null, false, true));
texture = new Texture(new FileTextureData(Gdx.files.internal("data/t8890.png"), null, null, false));
}
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
spriteBatch.begin();
spriteBatch.draw(texture, 100, 100);
spriteBatch.end();
}
public boolean needsGL20 () {
return false;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/ebtDispatcherQueryType.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
public final class ebtDispatcherQueryType {
public final static int BT_CONTACT_POINT_ALGORITHMS = 1;
public final static int BT_CLOSEST_POINT_ALGORITHMS = 2;
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
public final class ebtDispatcherQueryType {
public final static int BT_CONTACT_POINT_ALGORITHMS = 1;
public final static int BT_CLOSEST_POINT_ALGORITHMS = 2;
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/GIM_SCALAR_TYPES.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
public final class GIM_SCALAR_TYPES {
public final static int G_STYPE_REAL = 0;
public final static int G_STYPE_REAL2 = G_STYPE_REAL + 1;
public final static int G_STYPE_SHORT = G_STYPE_REAL2 + 1;
public final static int G_STYPE_USHORT = G_STYPE_SHORT + 1;
public final static int G_STYPE_INT = G_STYPE_USHORT + 1;
public final static int G_STYPE_UINT = G_STYPE_INT + 1;
public final static int G_STYPE_INT64 = G_STYPE_UINT + 1;
public final static int G_STYPE_UINT64 = G_STYPE_INT64 + 1;
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
public final class GIM_SCALAR_TYPES {
public final static int G_STYPE_REAL = 0;
public final static int G_STYPE_REAL2 = G_STYPE_REAL + 1;
public final static int G_STYPE_SHORT = G_STYPE_REAL2 + 1;
public final static int G_STYPE_USHORT = G_STYPE_SHORT + 1;
public final static int G_STYPE_INT = G_STYPE_USHORT + 1;
public final static int G_STYPE_UINT = G_STYPE_INT + 1;
public final static int G_STYPE_INT64 = G_STYPE_UINT + 1;
public final static int G_STYPE_UINT64 = G_STYPE_INT64 + 1;
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-lwjgl3-angle/src/com/badlogic/gdx/backends/lwjgl3/angle/Lwjgl3GLES20.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.lwjgl3.angle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.utils.GdxRuntimeException;
import org.lwjgl.opengles.GLES20;
import java.nio.*;
public class Lwjgl3GLES20 implements GL20 {
private ByteBuffer buffer = null;
private FloatBuffer floatBuffer = null;
private IntBuffer intBuffer = null;
private void ensureBufferCapacity (int numBytes) {
if (buffer == null || buffer.capacity() < numBytes) {
buffer = com.badlogic.gdx.utils.BufferUtils.newByteBuffer(numBytes);
floatBuffer = buffer.asFloatBuffer();
intBuffer = buffer.asIntBuffer();
}
}
private FloatBuffer toFloatBuffer (float v[], int offset, int count) {
ensureBufferCapacity(count << 2);
((Buffer)floatBuffer).clear();
((Buffer)floatBuffer).limit(count);
floatBuffer.put(v, offset, count);
((Buffer)floatBuffer).position(0);
return floatBuffer;
}
private IntBuffer toIntBuffer (int v[], int offset, int count) {
ensureBufferCapacity(count << 2);
((Buffer)intBuffer).clear();
((Buffer)intBuffer).limit(count);
intBuffer.put(v, offset, count);
((Buffer)intBuffer).position(0);
return intBuffer;
}
public void glActiveTexture (int texture) {
GLES20.glActiveTexture(texture);
}
public void glAttachShader (int program, int shader) {
GLES20.glAttachShader(program, shader);
}
public void glBindAttribLocation (int program, int index, String name) {
GLES20.glBindAttribLocation(program, index, name);
}
public void glBindBuffer (int target, int buffer) {
GLES20.glBindBuffer(target, buffer);
}
public void glBindFramebuffer (int target, int framebuffer) {
GLES20.glBindFramebuffer(target, framebuffer);
}
public void glBindRenderbuffer (int target, int renderbuffer) {
GLES20.glBindRenderbuffer(target, renderbuffer);
}
public void glBindTexture (int target, int texture) {
GLES20.glBindTexture(target, texture);
}
public void glBlendColor (float red, float green, float blue, float alpha) {
GLES20.glBlendColor(red, green, blue, alpha);
}
public void glBlendEquation (int mode) {
GLES20.glBlendEquation(mode);
}
public void glBlendEquationSeparate (int modeRGB, int modeAlpha) {
GLES20.glBlendEquationSeparate(modeRGB, modeAlpha);
}
public void glBlendFunc (int sfactor, int dfactor) {
GLES20.glBlendFunc(sfactor, dfactor);
}
public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
GLES20.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
public void glBufferData (int target, int size, Buffer data, int usage) {
if (data == null)
GLES20.glBufferData(target, size, usage);
else if (data instanceof ByteBuffer)
GLES20.glBufferData(target, (ByteBuffer)data, usage);
else if (data instanceof IntBuffer)
GLES20.glBufferData(target, (IntBuffer)data, usage);
else if (data instanceof FloatBuffer)
GLES20.glBufferData(target, (FloatBuffer)data, usage);
else if (data instanceof ShortBuffer) //
GLES20.glBufferData(target, (ShortBuffer)data, usage);
else
throw new GdxRuntimeException("Buffer data of type " + data.getClass().getName() + " not supported in GLES20.");
}
public void glBufferSubData (int target, int offset, int size, Buffer data) {
if (data == null)
throw new GdxRuntimeException("Using null for the data not possible, ");
else if (data instanceof ByteBuffer)
GLES20.glBufferSubData(target, offset, (ByteBuffer)data);
else if (data instanceof IntBuffer)
GLES20.glBufferSubData(target, offset, (IntBuffer)data);
else if (data instanceof FloatBuffer)
GLES20.glBufferSubData(target, offset, (FloatBuffer)data);
else if (data instanceof ShortBuffer) //
GLES20.glBufferSubData(target, offset, (ShortBuffer)data);
else
throw new GdxRuntimeException("Buffer data of type " + data.getClass().getName() + " not supported in GLES20.");
}
public int glCheckFramebufferStatus (int target) {
return GLES20.glCheckFramebufferStatus(target);
}
public void glClear (int mask) {
GLES20.glClear(mask);
}
public void glClearColor (float red, float green, float blue, float alpha) {
GLES20.glClearColor(red, green, blue, alpha);
}
public void glClearDepthf (float depth) {
GLES20.glClearDepthf(depth);
}
public void glClearStencil (int s) {
GLES20.glClearStencil(s);
}
public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha) {
GLES20.glColorMask(red, green, blue, alpha);
}
public void glCompileShader (int shader) {
GLES20.glCompileShader(shader);
}
public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
int imageSize, Buffer data) {
if (data instanceof ByteBuffer) {
GLES20.glCompressedTexImage2D(target, level, internalformat, width, height, border, (ByteBuffer)data);
} else {
throw new GdxRuntimeException("Can't use " + data.getClass().getName() + " with this method. Use ByteBuffer instead.");
}
}
public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format,
int imageSize, Buffer data) {
throw new GdxRuntimeException("not implemented");
}
public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) {
GLES20.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}
public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
GLES20.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
public int glCreateProgram () {
return GLES20.glCreateProgram();
}
public int glCreateShader (int type) {
return GLES20.glCreateShader(type);
}
public void glCullFace (int mode) {
GLES20.glCullFace(mode);
}
public void glDeleteBuffers (int n, IntBuffer buffers) {
GLES20.glDeleteBuffers(buffers);
}
@Override
public void glDeleteBuffer (int buffer) {
GLES20.glDeleteBuffers(buffer);
}
public void glDeleteFramebuffers (int n, IntBuffer framebuffers) {
GLES20.glDeleteFramebuffers(framebuffers);
}
@Override
public void glDeleteFramebuffer (int framebuffer) {
GLES20.glDeleteFramebuffers(framebuffer);
}
public void glDeleteProgram (int program) {
GLES20.glDeleteProgram(program);
}
public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) {
GLES20.glDeleteRenderbuffers(renderbuffers);
}
public void glDeleteRenderbuffer (int renderbuffer) {
GLES20.glDeleteRenderbuffers(renderbuffer);
}
public void glDeleteShader (int shader) {
GLES20.glDeleteShader(shader);
}
public void glDeleteTextures (int n, IntBuffer textures) {
GLES20.glDeleteTextures(textures);
}
@Override
public void glDeleteTexture (int texture) {
GLES20.glDeleteTextures(texture);
}
public void glDepthFunc (int func) {
GLES20.glDepthFunc(func);
}
public void glDepthMask (boolean flag) {
GLES20.glDepthMask(flag);
}
public void glDepthRangef (float zNear, float zFar) {
GLES20.glDepthRangef(zNear, zFar);
}
public void glDetachShader (int program, int shader) {
GLES20.glDetachShader(program, shader);
}
public void glDisable (int cap) {
GLES20.glDisable(cap);
}
public void glDisableVertexAttribArray (int index) {
GLES20.glDisableVertexAttribArray(index);
}
public void glDrawArrays (int mode, int first, int count) {
GLES20.glDrawArrays(mode, first, count);
}
public void glDrawElements (int mode, int count, int type, Buffer indices) {
if (indices instanceof ShortBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_SHORT) {
ShortBuffer sb = (ShortBuffer)indices;
int position = sb.position();
int oldLimit = sb.limit();
sb.limit(position + count);
GLES20.glDrawElements(mode, sb);
sb.limit(oldLimit);
} else if (indices instanceof ByteBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_SHORT) {
ShortBuffer sb = ((ByteBuffer)indices).asShortBuffer();
int position = sb.position();
int oldLimit = sb.limit();
sb.limit(position + count);
GLES20.glDrawElements(mode, sb);
sb.limit(oldLimit);
} else if (indices instanceof ByteBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_BYTE) {
ByteBuffer bb = (ByteBuffer)indices;
int position = bb.position();
int oldLimit = bb.limit();
bb.limit(position + count);
GLES20.glDrawElements(mode, bb);
bb.limit(oldLimit);
} else
throw new GdxRuntimeException("Can't use " + indices.getClass().getName()
+ " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL");
}
public void glEnable (int cap) {
GLES20.glEnable(cap);
}
public void glEnableVertexAttribArray (int index) {
GLES20.glEnableVertexAttribArray(index);
}
public void glFinish () {
GLES20.glFinish();
}
public void glFlush () {
GLES20.glFlush();
}
public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) {
GLES20.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}
public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) {
GLES20.glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
public void glFrontFace (int mode) {
GLES20.glFrontFace(mode);
}
public void glGenBuffers (int n, IntBuffer buffers) {
GLES20.glGenBuffers(buffers);
}
public int glGenBuffer () {
return GLES20.glGenBuffers();
}
public void glGenFramebuffers (int n, IntBuffer framebuffers) {
GLES20.glGenFramebuffers(framebuffers);
}
public int glGenFramebuffer () {
return GLES20.glGenFramebuffers();
}
public void glGenRenderbuffers (int n, IntBuffer renderbuffers) {
GLES20.glGenRenderbuffers(renderbuffers);
}
public int glGenRenderbuffer () {
return GLES20.glGenRenderbuffers();
}
public void glGenTextures (int n, IntBuffer textures) {
GLES20.glGenTextures(textures);
}
public int glGenTexture () {
return GLES20.glGenTextures();
}
public void glGenerateMipmap (int target) {
GLES20.glGenerateMipmap(target);
}
public String glGetActiveAttrib (int program, int index, IntBuffer size, IntBuffer type) {
return GLES20.glGetActiveAttrib(program, index, 256, size, type);
}
public String glGetActiveUniform (int program, int index, IntBuffer size, IntBuffer type) {
return GLES20.glGetActiveUniform(program, index, 256, size, type);
}
public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders) {
GLES20.glGetAttachedShaders(program, (IntBuffer)count, shaders);
}
public int glGetAttribLocation (int program, String name) {
return GLES20.glGetAttribLocation(program, name);
}
public void glGetBooleanv (int pname, Buffer params) {
GLES20.glGetBooleanv(pname, (ByteBuffer)params);
}
public void glGetBufferParameteriv (int target, int pname, IntBuffer params) {
GLES20.glGetBufferParameteriv(target, pname, params);
}
public int glGetError () {
return GLES20.glGetError();
}
public void glGetFloatv (int pname, FloatBuffer params) {
GLES20.glGetFloatv(pname, params);
}
public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params) {
GLES20.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
}
public void glGetIntegerv (int pname, IntBuffer params) {
GLES20.glGetIntegerv(pname, params);
}
public String glGetProgramInfoLog (int program) {
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
buffer.order(ByteOrder.nativeOrder());
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
tmp.order(ByteOrder.nativeOrder());
IntBuffer intBuffer = tmp.asIntBuffer();
GLES20.glGetProgramInfoLog(program, intBuffer, buffer);
int numBytes = intBuffer.get(0);
byte[] bytes = new byte[numBytes];
buffer.get(bytes);
return new String(bytes);
}
public void glGetProgramiv (int program, int pname, IntBuffer params) {
GLES20.glGetProgramiv(program, pname, params);
}
public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) {
GLES20.glGetRenderbufferParameteriv(target, pname, params);
}
public String glGetShaderInfoLog (int shader) {
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
buffer.order(ByteOrder.nativeOrder());
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
tmp.order(ByteOrder.nativeOrder());
IntBuffer intBuffer = tmp.asIntBuffer();
GLES20.glGetShaderInfoLog(shader, intBuffer, buffer);
int numBytes = intBuffer.get(0);
byte[] bytes = new byte[numBytes];
buffer.get(bytes);
return new String(bytes);
}
public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision) {
throw new UnsupportedOperationException("unsupported, won't implement");
}
public void glGetShaderiv (int shader, int pname, IntBuffer params) {
GLES20.glGetShaderiv(shader, pname, params);
}
public String glGetString (int name) {
return GLES20.glGetString(name);
}
public void glGetTexParameterfv (int target, int pname, FloatBuffer params) {
GLES20.glGetTexParameterfv(target, pname, params);
}
public void glGetTexParameteriv (int target, int pname, IntBuffer params) {
GLES20.glGetTexParameteriv(target, pname, params);
}
public int glGetUniformLocation (int program, String name) {
return GLES20.glGetUniformLocation(program, name);
}
public void glGetUniformfv (int program, int location, FloatBuffer params) {
GLES20.glGetUniformfv(program, location, params);
}
public void glGetUniformiv (int program, int location, IntBuffer params) {
GLES20.glGetUniformiv(program, location, params);
}
public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer) {
throw new UnsupportedOperationException("unsupported, won't implement");
}
public void glGetVertexAttribfv (int index, int pname, FloatBuffer params) {
GLES20.glGetVertexAttribfv(index, pname, params);
}
public void glGetVertexAttribiv (int index, int pname, IntBuffer params) {
GLES20.glGetVertexAttribiv(index, pname, params);
}
public void glHint (int target, int mode) {
GLES20.glHint(target, mode);
}
public boolean glIsBuffer (int buffer) {
return GLES20.glIsBuffer(buffer);
}
public boolean glIsEnabled (int cap) {
return GLES20.glIsEnabled(cap);
}
public boolean glIsFramebuffer (int framebuffer) {
return GLES20.glIsFramebuffer(framebuffer);
}
public boolean glIsProgram (int program) {
return GLES20.glIsProgram(program);
}
public boolean glIsRenderbuffer (int renderbuffer) {
return GLES20.glIsRenderbuffer(renderbuffer);
}
public boolean glIsShader (int shader) {
return GLES20.glIsShader(shader);
}
public boolean glIsTexture (int texture) {
return GLES20.glIsTexture(texture);
}
public void glLineWidth (float width) {
GLES20.glLineWidth(width);
}
public void glLinkProgram (int program) {
GLES20.glLinkProgram(program);
}
public void glPixelStorei (int pname, int param) {
GLES20.glPixelStorei(pname, param);
}
public void glPolygonOffset (float factor, float units) {
GLES20.glPolygonOffset(factor, units);
}
public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) {
if (pixels instanceof ByteBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (FloatBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead.");
}
public void glReleaseShaderCompiler () {
// nothing to do here
}
public void glRenderbufferStorage (int target, int internalformat, int width, int height) {
GLES20.glRenderbufferStorage(target, internalformat, width, height);
}
public void glSampleCoverage (float value, boolean invert) {
GLES20.glSampleCoverage(value, invert);
}
public void glScissor (int x, int y, int width, int height) {
GLES20.glScissor(x, y, width, height);
}
public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
throw new UnsupportedOperationException("unsupported, won't implement");
}
public void glShaderSource (int shader, String string) {
GLES20.glShaderSource(shader, string);
}
public void glStencilFunc (int func, int ref, int mask) {
GLES20.glStencilFunc(func, ref, mask);
}
public void glStencilFuncSeparate (int face, int func, int ref, int mask) {
GLES20.glStencilFuncSeparate(face, func, ref, mask);
}
public void glStencilMask (int mask) {
GLES20.glStencilMask(mask);
}
public void glStencilMaskSeparate (int face, int mask) {
GLES20.glStencilMaskSeparate(face, mask);
}
public void glStencilOp (int fail, int zfail, int zpass) {
GLES20.glStencilOp(fail, zfail, zpass);
}
public void glStencilOpSeparate (int face, int fail, int zfail, int zpass) {
GLES20.glStencilOpSeparate(face, fail, zfail, zpass);
}
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
Buffer pixels) {
if (pixels == null)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)null);
else if (pixels instanceof ByteBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (FloatBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead.");
}
public void glTexParameterf (int target, int pname, float param) {
GLES20.glTexParameterf(target, pname, param);
}
public void glTexParameterfv (int target, int pname, FloatBuffer params) {
GLES20.glTexParameterfv(target, pname, params);
}
public void glTexParameteri (int target, int pname, int param) {
GLES20.glTexParameteri(target, pname, param);
}
public void glTexParameteriv (int target, int pname, IntBuffer params) {
GLES20.glTexParameteriv(target, pname, params);
}
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
Buffer pixels) {
if (pixels instanceof ByteBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (FloatBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead.");
}
public void glUniform1f (int location, float x) {
GLES20.glUniform1f(location, x);
}
public void glUniform1fv (int location, int count, FloatBuffer v) {
GLES20.glUniform1fv(location, v);
}
public void glUniform1fv (int location, int count, float[] v, int offset) {
GLES20.glUniform1fv(location, toFloatBuffer(v, offset, count));
}
public void glUniform1i (int location, int x) {
GLES20.glUniform1i(location, x);
}
public void glUniform1iv (int location, int count, IntBuffer v) {
GLES20.glUniform1iv(location, v);
}
@Override
public void glUniform1iv (int location, int count, int[] v, int offset) {
GLES20.glUniform1iv(location, toIntBuffer(v, offset, count));
}
public void glUniform2f (int location, float x, float y) {
GLES20.glUniform2f(location, x, y);
}
public void glUniform2fv (int location, int count, FloatBuffer v) {
GLES20.glUniform2fv(location, v);
}
public void glUniform2fv (int location, int count, float[] v, int offset) {
GLES20.glUniform2fv(location, toFloatBuffer(v, offset, count << 1));
}
public void glUniform2i (int location, int x, int y) {
GLES20.glUniform2i(location, x, y);
}
public void glUniform2iv (int location, int count, IntBuffer v) {
GLES20.glUniform2iv(location, v);
}
public void glUniform2iv (int location, int count, int[] v, int offset) {
GLES20.glUniform2iv(location, toIntBuffer(v, offset, count << 1));
}
public void glUniform3f (int location, float x, float y, float z) {
GLES20.glUniform3f(location, x, y, z);
}
public void glUniform3fv (int location, int count, FloatBuffer v) {
GLES20.glUniform3fv(location, v);
}
public void glUniform3fv (int location, int count, float[] v, int offset) {
GLES20.glUniform3fv(location, toFloatBuffer(v, offset, count * 3));
}
public void glUniform3i (int location, int x, int y, int z) {
GLES20.glUniform3i(location, x, y, z);
}
public void glUniform3iv (int location, int count, IntBuffer v) {
GLES20.glUniform3iv(location, v);
}
public void glUniform3iv (int location, int count, int[] v, int offset) {
GLES20.glUniform3iv(location, toIntBuffer(v, offset, count * 3));
}
public void glUniform4f (int location, float x, float y, float z, float w) {
GLES20.glUniform4f(location, x, y, z, w);
}
public void glUniform4fv (int location, int count, FloatBuffer v) {
GLES20.glUniform4fv(location, v);
}
public void glUniform4fv (int location, int count, float[] v, int offset) {
GLES20.glUniform4fv(location, toFloatBuffer(v, offset, count << 2));
}
public void glUniform4i (int location, int x, int y, int z, int w) {
GLES20.glUniform4i(location, x, y, z, w);
}
public void glUniform4iv (int location, int count, IntBuffer v) {
GLES20.glUniform4iv(location, v);
}
public void glUniform4iv (int location, int count, int[] v, int offset) {
GLES20.glUniform4iv(location, toIntBuffer(v, offset, count << 2));
}
public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix2fv(location, transpose, value);
}
public void glUniformMatrix2fv (int location, int count, boolean transpose, float[] value, int offset) {
GLES20.glUniformMatrix2fv(location, transpose, toFloatBuffer(value, offset, count << 2));
}
public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix3fv(location, transpose, value);
}
public void glUniformMatrix3fv (int location, int count, boolean transpose, float[] value, int offset) {
GLES20.glUniformMatrix3fv(location, transpose, toFloatBuffer(value, offset, count * 9));
}
public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix4fv(location, transpose, value);
}
public void glUniformMatrix4fv (int location, int count, boolean transpose, float[] value, int offset) {
GLES20.glUniformMatrix4fv(location, transpose, toFloatBuffer(value, offset, count << 4));
}
public void glUseProgram (int program) {
GLES20.glUseProgram(program);
}
public void glValidateProgram (int program) {
GLES20.glValidateProgram(program);
}
public void glVertexAttrib1f (int indx, float x) {
GLES20.glVertexAttrib1f(indx, x);
}
public void glVertexAttrib1fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib1f(indx, values.get());
}
public void glVertexAttrib2f (int indx, float x, float y) {
GLES20.glVertexAttrib2f(indx, x, y);
}
public void glVertexAttrib2fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib2f(indx, values.get(), values.get());
}
public void glVertexAttrib3f (int indx, float x, float y, float z) {
GLES20.glVertexAttrib3f(indx, x, y, z);
}
public void glVertexAttrib3fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib3f(indx, values.get(), values.get(), values.get());
}
public void glVertexAttrib4f (int indx, float x, float y, float z, float w) {
GLES20.glVertexAttrib4f(indx, x, y, z, w);
}
public void glVertexAttrib4fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get());
}
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer buffer) {
if (buffer instanceof ByteBuffer) {
if (type == GL_BYTE)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, (ByteBuffer)buffer);
else if (type == GL_UNSIGNED_BYTE)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, (ByteBuffer)buffer);
else if (type == GL_SHORT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
else if (type == GL_UNSIGNED_SHORT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
else if (type == GL_FLOAT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer)buffer).asFloatBuffer());
else
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() + " with type " + type
+ " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type.");
} else if (buffer instanceof FloatBuffer) {
if (type == GL_FLOAT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, (FloatBuffer)buffer);
else
throw new GdxRuntimeException(
"Can't use " + buffer.getClass().getName() + " with type " + type + " with this method.");
} else
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() + " with this method. Use ByteBuffer instead.");
}
public void glViewport (int x, int y, int width, int height) {
GLES20.glViewport(x, y, width, height);
}
public void glDrawElements (int mode, int count, int type, int indices) {
GLES20.glDrawElements(mode, count, type, indices);
}
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr) {
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.lwjgl3.angle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.utils.GdxRuntimeException;
import org.lwjgl.opengles.GLES20;
import java.nio.*;
public class Lwjgl3GLES20 implements GL20 {
private ByteBuffer buffer = null;
private FloatBuffer floatBuffer = null;
private IntBuffer intBuffer = null;
private void ensureBufferCapacity (int numBytes) {
if (buffer == null || buffer.capacity() < numBytes) {
buffer = com.badlogic.gdx.utils.BufferUtils.newByteBuffer(numBytes);
floatBuffer = buffer.asFloatBuffer();
intBuffer = buffer.asIntBuffer();
}
}
private FloatBuffer toFloatBuffer (float v[], int offset, int count) {
ensureBufferCapacity(count << 2);
((Buffer)floatBuffer).clear();
((Buffer)floatBuffer).limit(count);
floatBuffer.put(v, offset, count);
((Buffer)floatBuffer).position(0);
return floatBuffer;
}
private IntBuffer toIntBuffer (int v[], int offset, int count) {
ensureBufferCapacity(count << 2);
((Buffer)intBuffer).clear();
((Buffer)intBuffer).limit(count);
intBuffer.put(v, offset, count);
((Buffer)intBuffer).position(0);
return intBuffer;
}
public void glActiveTexture (int texture) {
GLES20.glActiveTexture(texture);
}
public void glAttachShader (int program, int shader) {
GLES20.glAttachShader(program, shader);
}
public void glBindAttribLocation (int program, int index, String name) {
GLES20.glBindAttribLocation(program, index, name);
}
public void glBindBuffer (int target, int buffer) {
GLES20.glBindBuffer(target, buffer);
}
public void glBindFramebuffer (int target, int framebuffer) {
GLES20.glBindFramebuffer(target, framebuffer);
}
public void glBindRenderbuffer (int target, int renderbuffer) {
GLES20.glBindRenderbuffer(target, renderbuffer);
}
public void glBindTexture (int target, int texture) {
GLES20.glBindTexture(target, texture);
}
public void glBlendColor (float red, float green, float blue, float alpha) {
GLES20.glBlendColor(red, green, blue, alpha);
}
public void glBlendEquation (int mode) {
GLES20.glBlendEquation(mode);
}
public void glBlendEquationSeparate (int modeRGB, int modeAlpha) {
GLES20.glBlendEquationSeparate(modeRGB, modeAlpha);
}
public void glBlendFunc (int sfactor, int dfactor) {
GLES20.glBlendFunc(sfactor, dfactor);
}
public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
GLES20.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
public void glBufferData (int target, int size, Buffer data, int usage) {
if (data == null)
GLES20.glBufferData(target, size, usage);
else if (data instanceof ByteBuffer)
GLES20.glBufferData(target, (ByteBuffer)data, usage);
else if (data instanceof IntBuffer)
GLES20.glBufferData(target, (IntBuffer)data, usage);
else if (data instanceof FloatBuffer)
GLES20.glBufferData(target, (FloatBuffer)data, usage);
else if (data instanceof ShortBuffer) //
GLES20.glBufferData(target, (ShortBuffer)data, usage);
else
throw new GdxRuntimeException("Buffer data of type " + data.getClass().getName() + " not supported in GLES20.");
}
public void glBufferSubData (int target, int offset, int size, Buffer data) {
if (data == null)
throw new GdxRuntimeException("Using null for the data not possible, ");
else if (data instanceof ByteBuffer)
GLES20.glBufferSubData(target, offset, (ByteBuffer)data);
else if (data instanceof IntBuffer)
GLES20.glBufferSubData(target, offset, (IntBuffer)data);
else if (data instanceof FloatBuffer)
GLES20.glBufferSubData(target, offset, (FloatBuffer)data);
else if (data instanceof ShortBuffer) //
GLES20.glBufferSubData(target, offset, (ShortBuffer)data);
else
throw new GdxRuntimeException("Buffer data of type " + data.getClass().getName() + " not supported in GLES20.");
}
public int glCheckFramebufferStatus (int target) {
return GLES20.glCheckFramebufferStatus(target);
}
public void glClear (int mask) {
GLES20.glClear(mask);
}
public void glClearColor (float red, float green, float blue, float alpha) {
GLES20.glClearColor(red, green, blue, alpha);
}
public void glClearDepthf (float depth) {
GLES20.glClearDepthf(depth);
}
public void glClearStencil (int s) {
GLES20.glClearStencil(s);
}
public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha) {
GLES20.glColorMask(red, green, blue, alpha);
}
public void glCompileShader (int shader) {
GLES20.glCompileShader(shader);
}
public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
int imageSize, Buffer data) {
if (data instanceof ByteBuffer) {
GLES20.glCompressedTexImage2D(target, level, internalformat, width, height, border, (ByteBuffer)data);
} else {
throw new GdxRuntimeException("Can't use " + data.getClass().getName() + " with this method. Use ByteBuffer instead.");
}
}
public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format,
int imageSize, Buffer data) {
throw new GdxRuntimeException("not implemented");
}
public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) {
GLES20.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}
public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
GLES20.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
public int glCreateProgram () {
return GLES20.glCreateProgram();
}
public int glCreateShader (int type) {
return GLES20.glCreateShader(type);
}
public void glCullFace (int mode) {
GLES20.glCullFace(mode);
}
public void glDeleteBuffers (int n, IntBuffer buffers) {
GLES20.glDeleteBuffers(buffers);
}
@Override
public void glDeleteBuffer (int buffer) {
GLES20.glDeleteBuffers(buffer);
}
public void glDeleteFramebuffers (int n, IntBuffer framebuffers) {
GLES20.glDeleteFramebuffers(framebuffers);
}
@Override
public void glDeleteFramebuffer (int framebuffer) {
GLES20.glDeleteFramebuffers(framebuffer);
}
public void glDeleteProgram (int program) {
GLES20.glDeleteProgram(program);
}
public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) {
GLES20.glDeleteRenderbuffers(renderbuffers);
}
public void glDeleteRenderbuffer (int renderbuffer) {
GLES20.glDeleteRenderbuffers(renderbuffer);
}
public void glDeleteShader (int shader) {
GLES20.glDeleteShader(shader);
}
public void glDeleteTextures (int n, IntBuffer textures) {
GLES20.glDeleteTextures(textures);
}
@Override
public void glDeleteTexture (int texture) {
GLES20.glDeleteTextures(texture);
}
public void glDepthFunc (int func) {
GLES20.glDepthFunc(func);
}
public void glDepthMask (boolean flag) {
GLES20.glDepthMask(flag);
}
public void glDepthRangef (float zNear, float zFar) {
GLES20.glDepthRangef(zNear, zFar);
}
public void glDetachShader (int program, int shader) {
GLES20.glDetachShader(program, shader);
}
public void glDisable (int cap) {
GLES20.glDisable(cap);
}
public void glDisableVertexAttribArray (int index) {
GLES20.glDisableVertexAttribArray(index);
}
public void glDrawArrays (int mode, int first, int count) {
GLES20.glDrawArrays(mode, first, count);
}
public void glDrawElements (int mode, int count, int type, Buffer indices) {
if (indices instanceof ShortBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_SHORT) {
ShortBuffer sb = (ShortBuffer)indices;
int position = sb.position();
int oldLimit = sb.limit();
sb.limit(position + count);
GLES20.glDrawElements(mode, sb);
sb.limit(oldLimit);
} else if (indices instanceof ByteBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_SHORT) {
ShortBuffer sb = ((ByteBuffer)indices).asShortBuffer();
int position = sb.position();
int oldLimit = sb.limit();
sb.limit(position + count);
GLES20.glDrawElements(mode, sb);
sb.limit(oldLimit);
} else if (indices instanceof ByteBuffer && type == com.badlogic.gdx.graphics.GL20.GL_UNSIGNED_BYTE) {
ByteBuffer bb = (ByteBuffer)indices;
int position = bb.position();
int oldLimit = bb.limit();
bb.limit(position + count);
GLES20.glDrawElements(mode, bb);
bb.limit(oldLimit);
} else
throw new GdxRuntimeException("Can't use " + indices.getClass().getName()
+ " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL");
}
public void glEnable (int cap) {
GLES20.glEnable(cap);
}
public void glEnableVertexAttribArray (int index) {
GLES20.glEnableVertexAttribArray(index);
}
public void glFinish () {
GLES20.glFinish();
}
public void glFlush () {
GLES20.glFlush();
}
public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) {
GLES20.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}
public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) {
GLES20.glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
public void glFrontFace (int mode) {
GLES20.glFrontFace(mode);
}
public void glGenBuffers (int n, IntBuffer buffers) {
GLES20.glGenBuffers(buffers);
}
public int glGenBuffer () {
return GLES20.glGenBuffers();
}
public void glGenFramebuffers (int n, IntBuffer framebuffers) {
GLES20.glGenFramebuffers(framebuffers);
}
public int glGenFramebuffer () {
return GLES20.glGenFramebuffers();
}
public void glGenRenderbuffers (int n, IntBuffer renderbuffers) {
GLES20.glGenRenderbuffers(renderbuffers);
}
public int glGenRenderbuffer () {
return GLES20.glGenRenderbuffers();
}
public void glGenTextures (int n, IntBuffer textures) {
GLES20.glGenTextures(textures);
}
public int glGenTexture () {
return GLES20.glGenTextures();
}
public void glGenerateMipmap (int target) {
GLES20.glGenerateMipmap(target);
}
public String glGetActiveAttrib (int program, int index, IntBuffer size, IntBuffer type) {
return GLES20.glGetActiveAttrib(program, index, 256, size, type);
}
public String glGetActiveUniform (int program, int index, IntBuffer size, IntBuffer type) {
return GLES20.glGetActiveUniform(program, index, 256, size, type);
}
public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders) {
GLES20.glGetAttachedShaders(program, (IntBuffer)count, shaders);
}
public int glGetAttribLocation (int program, String name) {
return GLES20.glGetAttribLocation(program, name);
}
public void glGetBooleanv (int pname, Buffer params) {
GLES20.glGetBooleanv(pname, (ByteBuffer)params);
}
public void glGetBufferParameteriv (int target, int pname, IntBuffer params) {
GLES20.glGetBufferParameteriv(target, pname, params);
}
public int glGetError () {
return GLES20.glGetError();
}
public void glGetFloatv (int pname, FloatBuffer params) {
GLES20.glGetFloatv(pname, params);
}
public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params) {
GLES20.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
}
public void glGetIntegerv (int pname, IntBuffer params) {
GLES20.glGetIntegerv(pname, params);
}
public String glGetProgramInfoLog (int program) {
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
buffer.order(ByteOrder.nativeOrder());
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
tmp.order(ByteOrder.nativeOrder());
IntBuffer intBuffer = tmp.asIntBuffer();
GLES20.glGetProgramInfoLog(program, intBuffer, buffer);
int numBytes = intBuffer.get(0);
byte[] bytes = new byte[numBytes];
buffer.get(bytes);
return new String(bytes);
}
public void glGetProgramiv (int program, int pname, IntBuffer params) {
GLES20.glGetProgramiv(program, pname, params);
}
public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) {
GLES20.glGetRenderbufferParameteriv(target, pname, params);
}
public String glGetShaderInfoLog (int shader) {
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
buffer.order(ByteOrder.nativeOrder());
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
tmp.order(ByteOrder.nativeOrder());
IntBuffer intBuffer = tmp.asIntBuffer();
GLES20.glGetShaderInfoLog(shader, intBuffer, buffer);
int numBytes = intBuffer.get(0);
byte[] bytes = new byte[numBytes];
buffer.get(bytes);
return new String(bytes);
}
public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision) {
throw new UnsupportedOperationException("unsupported, won't implement");
}
public void glGetShaderiv (int shader, int pname, IntBuffer params) {
GLES20.glGetShaderiv(shader, pname, params);
}
public String glGetString (int name) {
return GLES20.glGetString(name);
}
public void glGetTexParameterfv (int target, int pname, FloatBuffer params) {
GLES20.glGetTexParameterfv(target, pname, params);
}
public void glGetTexParameteriv (int target, int pname, IntBuffer params) {
GLES20.glGetTexParameteriv(target, pname, params);
}
public int glGetUniformLocation (int program, String name) {
return GLES20.glGetUniformLocation(program, name);
}
public void glGetUniformfv (int program, int location, FloatBuffer params) {
GLES20.glGetUniformfv(program, location, params);
}
public void glGetUniformiv (int program, int location, IntBuffer params) {
GLES20.glGetUniformiv(program, location, params);
}
public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer) {
throw new UnsupportedOperationException("unsupported, won't implement");
}
public void glGetVertexAttribfv (int index, int pname, FloatBuffer params) {
GLES20.glGetVertexAttribfv(index, pname, params);
}
public void glGetVertexAttribiv (int index, int pname, IntBuffer params) {
GLES20.glGetVertexAttribiv(index, pname, params);
}
public void glHint (int target, int mode) {
GLES20.glHint(target, mode);
}
public boolean glIsBuffer (int buffer) {
return GLES20.glIsBuffer(buffer);
}
public boolean glIsEnabled (int cap) {
return GLES20.glIsEnabled(cap);
}
public boolean glIsFramebuffer (int framebuffer) {
return GLES20.glIsFramebuffer(framebuffer);
}
public boolean glIsProgram (int program) {
return GLES20.glIsProgram(program);
}
public boolean glIsRenderbuffer (int renderbuffer) {
return GLES20.glIsRenderbuffer(renderbuffer);
}
public boolean glIsShader (int shader) {
return GLES20.glIsShader(shader);
}
public boolean glIsTexture (int texture) {
return GLES20.glIsTexture(texture);
}
public void glLineWidth (float width) {
GLES20.glLineWidth(width);
}
public void glLinkProgram (int program) {
GLES20.glLinkProgram(program);
}
public void glPixelStorei (int pname, int param) {
GLES20.glPixelStorei(pname, param);
}
public void glPolygonOffset (float factor, float units) {
GLES20.glPolygonOffset(factor, units);
}
public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) {
if (pixels instanceof ByteBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GLES20.glReadPixels(x, y, width, height, format, type, (FloatBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead.");
}
public void glReleaseShaderCompiler () {
// nothing to do here
}
public void glRenderbufferStorage (int target, int internalformat, int width, int height) {
GLES20.glRenderbufferStorage(target, internalformat, width, height);
}
public void glSampleCoverage (float value, boolean invert) {
GLES20.glSampleCoverage(value, invert);
}
public void glScissor (int x, int y, int width, int height) {
GLES20.glScissor(x, y, width, height);
}
public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
throw new UnsupportedOperationException("unsupported, won't implement");
}
public void glShaderSource (int shader, String string) {
GLES20.glShaderSource(shader, string);
}
public void glStencilFunc (int func, int ref, int mask) {
GLES20.glStencilFunc(func, ref, mask);
}
public void glStencilFuncSeparate (int face, int func, int ref, int mask) {
GLES20.glStencilFuncSeparate(face, func, ref, mask);
}
public void glStencilMask (int mask) {
GLES20.glStencilMask(mask);
}
public void glStencilMaskSeparate (int face, int mask) {
GLES20.glStencilMaskSeparate(face, mask);
}
public void glStencilOp (int fail, int zfail, int zpass) {
GLES20.glStencilOp(fail, zfail, zpass);
}
public void glStencilOpSeparate (int face, int fail, int zfail, int zpass) {
GLES20.glStencilOpSeparate(face, fail, zfail, zpass);
}
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
Buffer pixels) {
if (pixels == null)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)null);
else if (pixels instanceof ByteBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, (FloatBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead.");
}
public void glTexParameterf (int target, int pname, float param) {
GLES20.glTexParameterf(target, pname, param);
}
public void glTexParameterfv (int target, int pname, FloatBuffer params) {
GLES20.glTexParameterfv(target, pname, params);
}
public void glTexParameteri (int target, int pname, int param) {
GLES20.glTexParameteri(target, pname, param);
}
public void glTexParameteriv (int target, int pname, IntBuffer params) {
GLES20.glTexParameteriv(target, pname, params);
}
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
Buffer pixels) {
if (pixels instanceof ByteBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ByteBuffer)pixels);
else if (pixels instanceof ShortBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ShortBuffer)pixels);
else if (pixels instanceof IntBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntBuffer)pixels);
else if (pixels instanceof FloatBuffer)
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (FloatBuffer)pixels);
else
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead.");
}
public void glUniform1f (int location, float x) {
GLES20.glUniform1f(location, x);
}
public void glUniform1fv (int location, int count, FloatBuffer v) {
GLES20.glUniform1fv(location, v);
}
public void glUniform1fv (int location, int count, float[] v, int offset) {
GLES20.glUniform1fv(location, toFloatBuffer(v, offset, count));
}
public void glUniform1i (int location, int x) {
GLES20.glUniform1i(location, x);
}
public void glUniform1iv (int location, int count, IntBuffer v) {
GLES20.glUniform1iv(location, v);
}
@Override
public void glUniform1iv (int location, int count, int[] v, int offset) {
GLES20.glUniform1iv(location, toIntBuffer(v, offset, count));
}
public void glUniform2f (int location, float x, float y) {
GLES20.glUniform2f(location, x, y);
}
public void glUniform2fv (int location, int count, FloatBuffer v) {
GLES20.glUniform2fv(location, v);
}
public void glUniform2fv (int location, int count, float[] v, int offset) {
GLES20.glUniform2fv(location, toFloatBuffer(v, offset, count << 1));
}
public void glUniform2i (int location, int x, int y) {
GLES20.glUniform2i(location, x, y);
}
public void glUniform2iv (int location, int count, IntBuffer v) {
GLES20.glUniform2iv(location, v);
}
public void glUniform2iv (int location, int count, int[] v, int offset) {
GLES20.glUniform2iv(location, toIntBuffer(v, offset, count << 1));
}
public void glUniform3f (int location, float x, float y, float z) {
GLES20.glUniform3f(location, x, y, z);
}
public void glUniform3fv (int location, int count, FloatBuffer v) {
GLES20.glUniform3fv(location, v);
}
public void glUniform3fv (int location, int count, float[] v, int offset) {
GLES20.glUniform3fv(location, toFloatBuffer(v, offset, count * 3));
}
public void glUniform3i (int location, int x, int y, int z) {
GLES20.glUniform3i(location, x, y, z);
}
public void glUniform3iv (int location, int count, IntBuffer v) {
GLES20.glUniform3iv(location, v);
}
public void glUniform3iv (int location, int count, int[] v, int offset) {
GLES20.glUniform3iv(location, toIntBuffer(v, offset, count * 3));
}
public void glUniform4f (int location, float x, float y, float z, float w) {
GLES20.glUniform4f(location, x, y, z, w);
}
public void glUniform4fv (int location, int count, FloatBuffer v) {
GLES20.glUniform4fv(location, v);
}
public void glUniform4fv (int location, int count, float[] v, int offset) {
GLES20.glUniform4fv(location, toFloatBuffer(v, offset, count << 2));
}
public void glUniform4i (int location, int x, int y, int z, int w) {
GLES20.glUniform4i(location, x, y, z, w);
}
public void glUniform4iv (int location, int count, IntBuffer v) {
GLES20.glUniform4iv(location, v);
}
public void glUniform4iv (int location, int count, int[] v, int offset) {
GLES20.glUniform4iv(location, toIntBuffer(v, offset, count << 2));
}
public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix2fv(location, transpose, value);
}
public void glUniformMatrix2fv (int location, int count, boolean transpose, float[] value, int offset) {
GLES20.glUniformMatrix2fv(location, transpose, toFloatBuffer(value, offset, count << 2));
}
public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix3fv(location, transpose, value);
}
public void glUniformMatrix3fv (int location, int count, boolean transpose, float[] value, int offset) {
GLES20.glUniformMatrix3fv(location, transpose, toFloatBuffer(value, offset, count * 9));
}
public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value) {
GLES20.glUniformMatrix4fv(location, transpose, value);
}
public void glUniformMatrix4fv (int location, int count, boolean transpose, float[] value, int offset) {
GLES20.glUniformMatrix4fv(location, transpose, toFloatBuffer(value, offset, count << 4));
}
public void glUseProgram (int program) {
GLES20.glUseProgram(program);
}
public void glValidateProgram (int program) {
GLES20.glValidateProgram(program);
}
public void glVertexAttrib1f (int indx, float x) {
GLES20.glVertexAttrib1f(indx, x);
}
public void glVertexAttrib1fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib1f(indx, values.get());
}
public void glVertexAttrib2f (int indx, float x, float y) {
GLES20.glVertexAttrib2f(indx, x, y);
}
public void glVertexAttrib2fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib2f(indx, values.get(), values.get());
}
public void glVertexAttrib3f (int indx, float x, float y, float z) {
GLES20.glVertexAttrib3f(indx, x, y, z);
}
public void glVertexAttrib3fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib3f(indx, values.get(), values.get(), values.get());
}
public void glVertexAttrib4f (int indx, float x, float y, float z, float w) {
GLES20.glVertexAttrib4f(indx, x, y, z, w);
}
public void glVertexAttrib4fv (int indx, FloatBuffer values) {
GLES20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get());
}
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer buffer) {
if (buffer instanceof ByteBuffer) {
if (type == GL_BYTE)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, (ByteBuffer)buffer);
else if (type == GL_UNSIGNED_BYTE)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, (ByteBuffer)buffer);
else if (type == GL_SHORT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
else if (type == GL_UNSIGNED_SHORT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
else if (type == GL_FLOAT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ((ByteBuffer)buffer).asFloatBuffer());
else
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() + " with type " + type
+ " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type.");
} else if (buffer instanceof FloatBuffer) {
if (type == GL_FLOAT)
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, (FloatBuffer)buffer);
else
throw new GdxRuntimeException(
"Can't use " + buffer.getClass().getName() + " with type " + type + " with this method.");
} else
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() + " with this method. Use ByteBuffer instead.");
}
public void glViewport (int x, int y, int width, int height) {
GLES20.glViewport(x, y, width, height);
}
public void glDrawElements (int mode, int count, int type, int indices) {
GLES20.glDrawElements(mode, count, type, indices);
}
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr) {
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/assets/loaders/ModelLoader.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.assets.loaders;
import java.util.Iterator;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetLoaderParameters;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.model.data.ModelData;
import com.badlogic.gdx.graphics.g3d.model.data.ModelMaterial;
import com.badlogic.gdx.graphics.g3d.model.data.ModelTexture;
import com.badlogic.gdx.graphics.g3d.utils.TextureProvider;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.ObjectMap;
public abstract class ModelLoader<P extends ModelLoader.ModelParameters> extends AsynchronousAssetLoader<Model, P> {
public ModelLoader (FileHandleResolver resolver) {
super(resolver);
}
protected Array<ObjectMap.Entry<String, ModelData>> items = new Array<ObjectMap.Entry<String, ModelData>>();
protected ModelParameters defaultParameters = new ModelParameters();
/** Directly load the raw model data on the calling thread. */
public abstract ModelData loadModelData (final FileHandle fileHandle, P parameters);
/** Directly load the raw model data on the calling thread. */
public ModelData loadModelData (final FileHandle fileHandle) {
return loadModelData(fileHandle, null);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle, TextureProvider textureProvider, P parameters) {
final ModelData data = loadModelData(fileHandle, parameters);
return data == null ? null : new Model(data, textureProvider);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle, P parameters) {
return loadModel(fileHandle, new TextureProvider.FileTextureProvider(), parameters);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle, TextureProvider textureProvider) {
return loadModel(fileHandle, textureProvider, null);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle) {
return loadModel(fileHandle, new TextureProvider.FileTextureProvider(), null);
}
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, P parameters) {
final Array<AssetDescriptor> deps = new Array();
ModelData data = loadModelData(file, parameters);
if (data == null) return deps;
ObjectMap.Entry<String, ModelData> item = new ObjectMap.Entry<String, ModelData>();
item.key = fileName;
item.value = data;
synchronized (items) {
items.add(item);
}
TextureLoader.TextureParameter textureParameter = (parameters != null) ? parameters.textureParameter
: defaultParameters.textureParameter;
for (final ModelMaterial modelMaterial : data.materials) {
if (modelMaterial.textures != null) {
for (final ModelTexture modelTexture : modelMaterial.textures)
deps.add(new AssetDescriptor(modelTexture.fileName, Texture.class, textureParameter));
}
}
return deps;
}
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle file, P parameters) {
}
@Override
public Model loadSync (AssetManager manager, String fileName, FileHandle file, P parameters) {
ModelData data = null;
synchronized (items) {
for (int i = 0; i < items.size; i++) {
if (items.get(i).key.equals(fileName)) {
data = items.get(i).value;
items.removeIndex(i);
}
}
}
if (data == null) return null;
final Model result = new Model(data, new TextureProvider.AssetTextureProvider(manager));
// need to remove the textures from the managed disposables, or else ref counting
// doesn't work!
Iterator<Disposable> disposables = result.getManagedDisposables().iterator();
while (disposables.hasNext()) {
Disposable disposable = disposables.next();
if (disposable instanceof Texture) {
disposables.remove();
}
}
return result;
}
static public class ModelParameters extends AssetLoaderParameters<Model> {
public TextureLoader.TextureParameter textureParameter;
public ModelParameters () {
textureParameter = new TextureLoader.TextureParameter();
textureParameter.minFilter = textureParameter.magFilter = Texture.TextureFilter.Linear;
textureParameter.wrapU = textureParameter.wrapV = Texture.TextureWrap.Repeat;
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.assets.loaders;
import java.util.Iterator;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetLoaderParameters;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.model.data.ModelData;
import com.badlogic.gdx.graphics.g3d.model.data.ModelMaterial;
import com.badlogic.gdx.graphics.g3d.model.data.ModelTexture;
import com.badlogic.gdx.graphics.g3d.utils.TextureProvider;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.ObjectMap;
public abstract class ModelLoader<P extends ModelLoader.ModelParameters> extends AsynchronousAssetLoader<Model, P> {
public ModelLoader (FileHandleResolver resolver) {
super(resolver);
}
protected Array<ObjectMap.Entry<String, ModelData>> items = new Array<ObjectMap.Entry<String, ModelData>>();
protected ModelParameters defaultParameters = new ModelParameters();
/** Directly load the raw model data on the calling thread. */
public abstract ModelData loadModelData (final FileHandle fileHandle, P parameters);
/** Directly load the raw model data on the calling thread. */
public ModelData loadModelData (final FileHandle fileHandle) {
return loadModelData(fileHandle, null);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle, TextureProvider textureProvider, P parameters) {
final ModelData data = loadModelData(fileHandle, parameters);
return data == null ? null : new Model(data, textureProvider);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle, P parameters) {
return loadModel(fileHandle, new TextureProvider.FileTextureProvider(), parameters);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle, TextureProvider textureProvider) {
return loadModel(fileHandle, textureProvider, null);
}
/** Directly load the model on the calling thread. The model with not be managed by an {@link AssetManager}. */
public Model loadModel (final FileHandle fileHandle) {
return loadModel(fileHandle, new TextureProvider.FileTextureProvider(), null);
}
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, P parameters) {
final Array<AssetDescriptor> deps = new Array();
ModelData data = loadModelData(file, parameters);
if (data == null) return deps;
ObjectMap.Entry<String, ModelData> item = new ObjectMap.Entry<String, ModelData>();
item.key = fileName;
item.value = data;
synchronized (items) {
items.add(item);
}
TextureLoader.TextureParameter textureParameter = (parameters != null) ? parameters.textureParameter
: defaultParameters.textureParameter;
for (final ModelMaterial modelMaterial : data.materials) {
if (modelMaterial.textures != null) {
for (final ModelTexture modelTexture : modelMaterial.textures)
deps.add(new AssetDescriptor(modelTexture.fileName, Texture.class, textureParameter));
}
}
return deps;
}
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle file, P parameters) {
}
@Override
public Model loadSync (AssetManager manager, String fileName, FileHandle file, P parameters) {
ModelData data = null;
synchronized (items) {
for (int i = 0; i < items.size; i++) {
if (items.get(i).key.equals(fileName)) {
data = items.get(i).value;
items.removeIndex(i);
}
}
}
if (data == null) return null;
final Model result = new Model(data, new TextureProvider.AssetTextureProvider(manager));
// need to remove the textures from the managed disposables, or else ref counting
// doesn't work!
Iterator<Disposable> disposables = result.getManagedDisposables().iterator();
while (disposables.hasNext()) {
Disposable disposable = disposables.next();
if (disposable instanceof Texture) {
disposables.remove();
}
}
return result;
}
static public class ModelParameters extends AssetLoaderParameters<Model> {
public TextureLoader.TextureParameter textureParameter;
public ModelParameters () {
textureParameter = new TextureLoader.TextureParameter();
textureParameter.minFilter = textureParameter.magFilter = Texture.TextureFilter.Linear;
textureParameter.wrapU = textureParameter.wrapV = Texture.TextureWrap.Repeat;
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3ApplicationConfiguration.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.lwjgl3;
import java.io.PrintStream;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.PointerBuffer;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.glfw.GLFWVidMode.Buffer;
import com.badlogic.gdx.Audio;
import com.badlogic.gdx.Files;
import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.Graphics.DisplayMode;
import com.badlogic.gdx.Graphics.Monitor;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics.Lwjgl3Monitor;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.HdpiMode;
import com.badlogic.gdx.graphics.glutils.HdpiUtils;
import com.badlogic.gdx.math.GridPoint2;
public class Lwjgl3ApplicationConfiguration extends Lwjgl3WindowConfiguration {
public static PrintStream errorStream = System.err;
boolean disableAudio = false;
/** The maximum number of threads to use for network requests. Default is {@link Integer#MAX_VALUE}. */
int maxNetThreads = Integer.MAX_VALUE;
int audioDeviceSimultaneousSources = 16;
int audioDeviceBufferSize = 512;
int audioDeviceBufferCount = 9;
public enum GLEmulation {
ANGLE_GLES20, GL20, GL30, GL31, GL32
}
GLEmulation glEmulation = GLEmulation.GL20;
int gles30ContextMajorVersion = 3;
int gles30ContextMinorVersion = 2;
int r = 8, g = 8, b = 8, a = 8;
int depth = 16, stencil = 0;
int samples = 0;
boolean transparentFramebuffer;
int idleFPS = 60;
int foregroundFPS = 0;
String preferencesDirectory = ".prefs/";
Files.FileType preferencesFileType = FileType.External;
HdpiMode hdpiMode = HdpiMode.Logical;
boolean debug = false;
PrintStream debugStream = System.err;
static Lwjgl3ApplicationConfiguration copy (Lwjgl3ApplicationConfiguration config) {
Lwjgl3ApplicationConfiguration copy = new Lwjgl3ApplicationConfiguration();
copy.set(config);
return copy;
}
void set (Lwjgl3ApplicationConfiguration config) {
super.setWindowConfiguration(config);
disableAudio = config.disableAudio;
audioDeviceSimultaneousSources = config.audioDeviceSimultaneousSources;
audioDeviceBufferSize = config.audioDeviceBufferSize;
audioDeviceBufferCount = config.audioDeviceBufferCount;
glEmulation = config.glEmulation;
gles30ContextMajorVersion = config.gles30ContextMajorVersion;
gles30ContextMinorVersion = config.gles30ContextMinorVersion;
r = config.r;
g = config.g;
b = config.b;
a = config.a;
depth = config.depth;
stencil = config.stencil;
samples = config.samples;
transparentFramebuffer = config.transparentFramebuffer;
idleFPS = config.idleFPS;
foregroundFPS = config.foregroundFPS;
preferencesDirectory = config.preferencesDirectory;
preferencesFileType = config.preferencesFileType;
hdpiMode = config.hdpiMode;
debug = config.debug;
debugStream = config.debugStream;
}
/** @param visibility whether the window will be visible on creation. (default true) */
public void setInitialVisible (boolean visibility) {
this.initialVisible = visibility;
}
/** Whether to disable audio or not. If set to true, the returned audio class instances like {@link Audio} or {@link Music}
* will be mock implementations. */
public void disableAudio (boolean disableAudio) {
this.disableAudio = disableAudio;
}
/** Sets the maximum number of threads to use for network requests. */
public void setMaxNetThreads (int maxNetThreads) {
this.maxNetThreads = maxNetThreads;
}
/** Sets the audio device configuration.
*
* @param simultaneousSources the maximum number of sources that can be played simultaniously (default 16)
* @param bufferSize the audio device buffer size in samples (default 512)
* @param bufferCount the audio device buffer count (default 9) */
public void setAudioConfig (int simultaneousSources, int bufferSize, int bufferCount) {
this.audioDeviceSimultaneousSources = simultaneousSources;
this.audioDeviceBufferSize = bufferSize;
this.audioDeviceBufferCount = bufferCount;
}
/** Sets which OpenGL version to use to emulate OpenGL ES. If the given major/minor version is not supported, the backend falls
* back to OpenGL ES 2.0 emulation through OpenGL 2.0. The default parameters for major and minor should be 3 and 2
* respectively to be compatible with Mac OS X. Specifying major version 4 and minor version 2 will ensure that all OpenGL ES
* 3.0 features are supported. Note however that Mac OS X does only support 3.2.
*
* @see <a href= "http://legacy.lwjgl.org/javadoc/org/lwjgl/opengl/ContextAttribs.html"> LWJGL OSX ContextAttribs note</a>
*
* @param glVersion which OpenGL ES emulation version to use
* @param gles3MajorVersion OpenGL ES major version, use 3 as default
* @param gles3MinorVersion OpenGL ES minor version, use 2 as default */
public void setOpenGLEmulation (GLEmulation glVersion, int gles3MajorVersion, int gles3MinorVersion) {
this.glEmulation = glVersion;
this.gles30ContextMajorVersion = gles3MajorVersion;
this.gles30ContextMinorVersion = gles3MinorVersion;
}
/** Sets the bit depth of the color, depth and stencil buffer as well as multi-sampling.
*
* @param r red bits (default 8)
* @param g green bits (default 8)
* @param b blue bits (default 8)
* @param a alpha bits (default 8)
* @param depth depth bits (default 16)
* @param stencil stencil bits (default 0)
* @param samples MSAA samples (default 0) */
public void setBackBufferConfig (int r, int g, int b, int a, int depth, int stencil, int samples) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
this.depth = depth;
this.stencil = stencil;
this.samples = samples;
}
/** Set transparent window hint. Results may vary on different OS and GPUs. Usage with the ANGLE backend is less consistent.
* @param transparentFramebuffer */
public void setTransparentFramebuffer (boolean transparentFramebuffer) {
this.transparentFramebuffer = transparentFramebuffer;
}
/** Sets the polling rate during idle time in non-continuous rendering mode. Must be positive. Default is 60. */
public void setIdleFPS (int fps) {
this.idleFPS = fps;
}
/** Sets the target framerate for the application. The CPU sleeps as needed. Must be positive. Use 0 to never sleep. Default is
* 0. */
public void setForegroundFPS (int fps) {
this.foregroundFPS = fps;
}
/** Sets the directory where {@link Preferences} will be stored, as well as the file type to be used to store them. Defaults to
* "$USER_HOME/.prefs/" and {@link FileType#External}. */
public void setPreferencesConfig (String preferencesDirectory, Files.FileType preferencesFileType) {
this.preferencesDirectory = preferencesDirectory;
this.preferencesFileType = preferencesFileType;
}
/** Defines how HDPI monitors are handled. Operating systems may have a per-monitor HDPI scale setting. The operating system
* may report window width/height and mouse coordinates in a logical coordinate system at a lower resolution than the actual
* physical resolution. This setting allows you to specify whether you want to work in logical or raw pixel units. See
* {@link HdpiMode} for more information. Note that some OpenGL functions like {@link GL20#glViewport(int, int, int, int)} and
* {@link GL20#glScissor(int, int, int, int)} require raw pixel units. Use {@link HdpiUtils} to help with the conversion if
* HdpiMode is set to {@link HdpiMode#Logical}. Defaults to {@link HdpiMode#Logical}. */
public void setHdpiMode (HdpiMode mode) {
this.hdpiMode = mode;
}
/** Enables use of OpenGL debug message callbacks. If not supported by the core GL driver (since GL 4.3), this uses the
* KHR_debug, ARB_debug_output or AMD_debug_output extension if available. By default, debug messages with NOTIFICATION
* severity are disabled to avoid log spam.
*
* You can call with {@link System#err} to output to the "standard" error output stream.
*
* Use {@link Lwjgl3Application#setGLDebugMessageControl(Lwjgl3Application.GLDebugMessageSeverity, boolean)} to enable or
* disable other severity debug levels. */
public void enableGLDebugOutput (boolean enable, PrintStream debugOutputStream) {
debug = enable;
debugStream = debugOutputStream;
}
/** @return the currently active {@link DisplayMode} of the primary monitor */
public static DisplayMode getDisplayMode () {
Lwjgl3Application.initializeGlfw();
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
return new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
/** @return the currently active {@link DisplayMode} of the given monitor */
public static DisplayMode getDisplayMode (Monitor monitor) {
Lwjgl3Application.initializeGlfw();
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(((Lwjgl3Monitor)monitor).monitorHandle);
return new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(), videoMode.height(),
videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
/** @return the available {@link DisplayMode}s of the primary monitor */
public static DisplayMode[] getDisplayModes () {
Lwjgl3Application.initializeGlfw();
Buffer videoModes = GLFW.glfwGetVideoModes(GLFW.glfwGetPrimaryMonitor());
DisplayMode[] result = new DisplayMode[videoModes.limit()];
for (int i = 0; i < result.length; i++) {
GLFWVidMode videoMode = videoModes.get(i);
result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
return result;
}
/** @return the available {@link DisplayMode}s of the given {@link Monitor} */
public static DisplayMode[] getDisplayModes (Monitor monitor) {
Lwjgl3Application.initializeGlfw();
Buffer videoModes = GLFW.glfwGetVideoModes(((Lwjgl3Monitor)monitor).monitorHandle);
DisplayMode[] result = new DisplayMode[videoModes.limit()];
for (int i = 0; i < result.length; i++) {
GLFWVidMode videoMode = videoModes.get(i);
result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(),
videoMode.height(), videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
return result;
}
/** @return the primary {@link Monitor} */
public static Monitor getPrimaryMonitor () {
Lwjgl3Application.initializeGlfw();
return toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}
/** @return the connected {@link Monitor}s */
public static Monitor[] getMonitors () {
Lwjgl3Application.initializeGlfw();
PointerBuffer glfwMonitors = GLFW.glfwGetMonitors();
Monitor[] monitors = new Monitor[glfwMonitors.limit()];
for (int i = 0; i < glfwMonitors.limit(); i++) {
monitors[i] = toLwjgl3Monitor(glfwMonitors.get(i));
}
return monitors;
}
static Lwjgl3Monitor toLwjgl3Monitor (long glfwMonitor) {
IntBuffer tmp = BufferUtils.createIntBuffer(1);
IntBuffer tmp2 = BufferUtils.createIntBuffer(1);
GLFW.glfwGetMonitorPos(glfwMonitor, tmp, tmp2);
int virtualX = tmp.get(0);
int virtualY = tmp2.get(0);
String name = GLFW.glfwGetMonitorName(glfwMonitor);
return new Lwjgl3Monitor(glfwMonitor, virtualX, virtualY, name);
}
static GridPoint2 calculateCenteredWindowPosition (Lwjgl3Monitor monitor, int newWidth, int newHeight) {
IntBuffer tmp = BufferUtils.createIntBuffer(1);
IntBuffer tmp2 = BufferUtils.createIntBuffer(1);
IntBuffer tmp3 = BufferUtils.createIntBuffer(1);
IntBuffer tmp4 = BufferUtils.createIntBuffer(1);
DisplayMode displayMode = getDisplayMode(monitor);
GLFW.glfwGetMonitorWorkarea(monitor.monitorHandle, tmp, tmp2, tmp3, tmp4);
int workareaWidth = tmp3.get(0);
int workareaHeight = tmp4.get(0);
int minX, minY, maxX, maxY;
// If the new width is greater than the working area, we have to ignore stuff like the taskbar for centering and use the
// whole monitor's size
if (newWidth > workareaWidth) {
minX = monitor.virtualX;
maxX = displayMode.width;
} else {
minX = tmp.get(0);
maxX = workareaWidth;
}
// The same is true for height
if (newHeight > workareaHeight) {
minY = monitor.virtualY;
maxY = displayMode.height;
} else {
minY = tmp2.get(0);
maxY = workareaHeight;
}
return new GridPoint2(Math.max(minX, minX + (maxX - newWidth) / 2), Math.max(minY, minY + (maxY - newHeight) / 2));
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.lwjgl3;
import java.io.PrintStream;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.PointerBuffer;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.glfw.GLFWVidMode.Buffer;
import com.badlogic.gdx.Audio;
import com.badlogic.gdx.Files;
import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.Graphics.DisplayMode;
import com.badlogic.gdx.Graphics.Monitor;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics.Lwjgl3Monitor;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.HdpiMode;
import com.badlogic.gdx.graphics.glutils.HdpiUtils;
import com.badlogic.gdx.math.GridPoint2;
public class Lwjgl3ApplicationConfiguration extends Lwjgl3WindowConfiguration {
public static PrintStream errorStream = System.err;
boolean disableAudio = false;
/** The maximum number of threads to use for network requests. Default is {@link Integer#MAX_VALUE}. */
int maxNetThreads = Integer.MAX_VALUE;
int audioDeviceSimultaneousSources = 16;
int audioDeviceBufferSize = 512;
int audioDeviceBufferCount = 9;
public enum GLEmulation {
ANGLE_GLES20, GL20, GL30, GL31, GL32
}
GLEmulation glEmulation = GLEmulation.GL20;
int gles30ContextMajorVersion = 3;
int gles30ContextMinorVersion = 2;
int r = 8, g = 8, b = 8, a = 8;
int depth = 16, stencil = 0;
int samples = 0;
boolean transparentFramebuffer;
int idleFPS = 60;
int foregroundFPS = 0;
String preferencesDirectory = ".prefs/";
Files.FileType preferencesFileType = FileType.External;
HdpiMode hdpiMode = HdpiMode.Logical;
boolean debug = false;
PrintStream debugStream = System.err;
static Lwjgl3ApplicationConfiguration copy (Lwjgl3ApplicationConfiguration config) {
Lwjgl3ApplicationConfiguration copy = new Lwjgl3ApplicationConfiguration();
copy.set(config);
return copy;
}
void set (Lwjgl3ApplicationConfiguration config) {
super.setWindowConfiguration(config);
disableAudio = config.disableAudio;
audioDeviceSimultaneousSources = config.audioDeviceSimultaneousSources;
audioDeviceBufferSize = config.audioDeviceBufferSize;
audioDeviceBufferCount = config.audioDeviceBufferCount;
glEmulation = config.glEmulation;
gles30ContextMajorVersion = config.gles30ContextMajorVersion;
gles30ContextMinorVersion = config.gles30ContextMinorVersion;
r = config.r;
g = config.g;
b = config.b;
a = config.a;
depth = config.depth;
stencil = config.stencil;
samples = config.samples;
transparentFramebuffer = config.transparentFramebuffer;
idleFPS = config.idleFPS;
foregroundFPS = config.foregroundFPS;
preferencesDirectory = config.preferencesDirectory;
preferencesFileType = config.preferencesFileType;
hdpiMode = config.hdpiMode;
debug = config.debug;
debugStream = config.debugStream;
}
/** @param visibility whether the window will be visible on creation. (default true) */
public void setInitialVisible (boolean visibility) {
this.initialVisible = visibility;
}
/** Whether to disable audio or not. If set to true, the returned audio class instances like {@link Audio} or {@link Music}
* will be mock implementations. */
public void disableAudio (boolean disableAudio) {
this.disableAudio = disableAudio;
}
/** Sets the maximum number of threads to use for network requests. */
public void setMaxNetThreads (int maxNetThreads) {
this.maxNetThreads = maxNetThreads;
}
/** Sets the audio device configuration.
*
* @param simultaneousSources the maximum number of sources that can be played simultaniously (default 16)
* @param bufferSize the audio device buffer size in samples (default 512)
* @param bufferCount the audio device buffer count (default 9) */
public void setAudioConfig (int simultaneousSources, int bufferSize, int bufferCount) {
this.audioDeviceSimultaneousSources = simultaneousSources;
this.audioDeviceBufferSize = bufferSize;
this.audioDeviceBufferCount = bufferCount;
}
/** Sets which OpenGL version to use to emulate OpenGL ES. If the given major/minor version is not supported, the backend falls
* back to OpenGL ES 2.0 emulation through OpenGL 2.0. The default parameters for major and minor should be 3 and 2
* respectively to be compatible with Mac OS X. Specifying major version 4 and minor version 2 will ensure that all OpenGL ES
* 3.0 features are supported. Note however that Mac OS X does only support 3.2.
*
* @see <a href= "http://legacy.lwjgl.org/javadoc/org/lwjgl/opengl/ContextAttribs.html"> LWJGL OSX ContextAttribs note</a>
*
* @param glVersion which OpenGL ES emulation version to use
* @param gles3MajorVersion OpenGL ES major version, use 3 as default
* @param gles3MinorVersion OpenGL ES minor version, use 2 as default */
public void setOpenGLEmulation (GLEmulation glVersion, int gles3MajorVersion, int gles3MinorVersion) {
this.glEmulation = glVersion;
this.gles30ContextMajorVersion = gles3MajorVersion;
this.gles30ContextMinorVersion = gles3MinorVersion;
}
/** Sets the bit depth of the color, depth and stencil buffer as well as multi-sampling.
*
* @param r red bits (default 8)
* @param g green bits (default 8)
* @param b blue bits (default 8)
* @param a alpha bits (default 8)
* @param depth depth bits (default 16)
* @param stencil stencil bits (default 0)
* @param samples MSAA samples (default 0) */
public void setBackBufferConfig (int r, int g, int b, int a, int depth, int stencil, int samples) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
this.depth = depth;
this.stencil = stencil;
this.samples = samples;
}
/** Set transparent window hint. Results may vary on different OS and GPUs. Usage with the ANGLE backend is less consistent.
* @param transparentFramebuffer */
public void setTransparentFramebuffer (boolean transparentFramebuffer) {
this.transparentFramebuffer = transparentFramebuffer;
}
/** Sets the polling rate during idle time in non-continuous rendering mode. Must be positive. Default is 60. */
public void setIdleFPS (int fps) {
this.idleFPS = fps;
}
/** Sets the target framerate for the application. The CPU sleeps as needed. Must be positive. Use 0 to never sleep. Default is
* 0. */
public void setForegroundFPS (int fps) {
this.foregroundFPS = fps;
}
/** Sets the directory where {@link Preferences} will be stored, as well as the file type to be used to store them. Defaults to
* "$USER_HOME/.prefs/" and {@link FileType#External}. */
public void setPreferencesConfig (String preferencesDirectory, Files.FileType preferencesFileType) {
this.preferencesDirectory = preferencesDirectory;
this.preferencesFileType = preferencesFileType;
}
/** Defines how HDPI monitors are handled. Operating systems may have a per-monitor HDPI scale setting. The operating system
* may report window width/height and mouse coordinates in a logical coordinate system at a lower resolution than the actual
* physical resolution. This setting allows you to specify whether you want to work in logical or raw pixel units. See
* {@link HdpiMode} for more information. Note that some OpenGL functions like {@link GL20#glViewport(int, int, int, int)} and
* {@link GL20#glScissor(int, int, int, int)} require raw pixel units. Use {@link HdpiUtils} to help with the conversion if
* HdpiMode is set to {@link HdpiMode#Logical}. Defaults to {@link HdpiMode#Logical}. */
public void setHdpiMode (HdpiMode mode) {
this.hdpiMode = mode;
}
/** Enables use of OpenGL debug message callbacks. If not supported by the core GL driver (since GL 4.3), this uses the
* KHR_debug, ARB_debug_output or AMD_debug_output extension if available. By default, debug messages with NOTIFICATION
* severity are disabled to avoid log spam.
*
* You can call with {@link System#err} to output to the "standard" error output stream.
*
* Use {@link Lwjgl3Application#setGLDebugMessageControl(Lwjgl3Application.GLDebugMessageSeverity, boolean)} to enable or
* disable other severity debug levels. */
public void enableGLDebugOutput (boolean enable, PrintStream debugOutputStream) {
debug = enable;
debugStream = debugOutputStream;
}
/** @return the currently active {@link DisplayMode} of the primary monitor */
public static DisplayMode getDisplayMode () {
Lwjgl3Application.initializeGlfw();
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
return new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
/** @return the currently active {@link DisplayMode} of the given monitor */
public static DisplayMode getDisplayMode (Monitor monitor) {
Lwjgl3Application.initializeGlfw();
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(((Lwjgl3Monitor)monitor).monitorHandle);
return new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(), videoMode.height(),
videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
/** @return the available {@link DisplayMode}s of the primary monitor */
public static DisplayMode[] getDisplayModes () {
Lwjgl3Application.initializeGlfw();
Buffer videoModes = GLFW.glfwGetVideoModes(GLFW.glfwGetPrimaryMonitor());
DisplayMode[] result = new DisplayMode[videoModes.limit()];
for (int i = 0; i < result.length; i++) {
GLFWVidMode videoMode = videoModes.get(i);
result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(),
videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
return result;
}
/** @return the available {@link DisplayMode}s of the given {@link Monitor} */
public static DisplayMode[] getDisplayModes (Monitor monitor) {
Lwjgl3Application.initializeGlfw();
Buffer videoModes = GLFW.glfwGetVideoModes(((Lwjgl3Monitor)monitor).monitorHandle);
DisplayMode[] result = new DisplayMode[videoModes.limit()];
for (int i = 0; i < result.length; i++) {
GLFWVidMode videoMode = videoModes.get(i);
result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(((Lwjgl3Monitor)monitor).monitorHandle, videoMode.width(),
videoMode.height(), videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
return result;
}
/** @return the primary {@link Monitor} */
public static Monitor getPrimaryMonitor () {
Lwjgl3Application.initializeGlfw();
return toLwjgl3Monitor(GLFW.glfwGetPrimaryMonitor());
}
/** @return the connected {@link Monitor}s */
public static Monitor[] getMonitors () {
Lwjgl3Application.initializeGlfw();
PointerBuffer glfwMonitors = GLFW.glfwGetMonitors();
Monitor[] monitors = new Monitor[glfwMonitors.limit()];
for (int i = 0; i < glfwMonitors.limit(); i++) {
monitors[i] = toLwjgl3Monitor(glfwMonitors.get(i));
}
return monitors;
}
static Lwjgl3Monitor toLwjgl3Monitor (long glfwMonitor) {
IntBuffer tmp = BufferUtils.createIntBuffer(1);
IntBuffer tmp2 = BufferUtils.createIntBuffer(1);
GLFW.glfwGetMonitorPos(glfwMonitor, tmp, tmp2);
int virtualX = tmp.get(0);
int virtualY = tmp2.get(0);
String name = GLFW.glfwGetMonitorName(glfwMonitor);
return new Lwjgl3Monitor(glfwMonitor, virtualX, virtualY, name);
}
static GridPoint2 calculateCenteredWindowPosition (Lwjgl3Monitor monitor, int newWidth, int newHeight) {
IntBuffer tmp = BufferUtils.createIntBuffer(1);
IntBuffer tmp2 = BufferUtils.createIntBuffer(1);
IntBuffer tmp3 = BufferUtils.createIntBuffer(1);
IntBuffer tmp4 = BufferUtils.createIntBuffer(1);
DisplayMode displayMode = getDisplayMode(monitor);
GLFW.glfwGetMonitorWorkarea(monitor.monitorHandle, tmp, tmp2, tmp3, tmp4);
int workareaWidth = tmp3.get(0);
int workareaHeight = tmp4.get(0);
int minX, minY, maxX, maxY;
// If the new width is greater than the working area, we have to ignore stuff like the taskbar for centering and use the
// whole monitor's size
if (newWidth > workareaWidth) {
minX = monitor.virtualX;
maxX = displayMode.width;
} else {
minX = tmp.get(0);
maxX = workareaWidth;
}
// The same is true for height
if (newHeight > workareaHeight) {
minY = monitor.virtualY;
maxY = displayMode.height;
} else {
minY = tmp2.get(0);
maxY = workareaHeight;
}
return new GridPoint2(Math.max(minX, minX + (maxX - newWidth) / 2), Math.max(minY, minY + (maxY - newHeight) / 2));
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/g3d/particles/batches/PointSpriteParticleBatch.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles.batches;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.DepthTestAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
import com.badlogic.gdx.graphics.g3d.particles.ParallelArray.FloatChannel;
import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels;
import com.badlogic.gdx.graphics.g3d.particles.ParticleShader;
import com.badlogic.gdx.graphics.g3d.particles.ParticleShader.ParticleType;
import com.badlogic.gdx.graphics.g3d.particles.ResourceData;
import com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData;
import com.badlogic.gdx.graphics.g3d.particles.renderers.PointSpriteControllerRenderData;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
/** This class is used to draw particles as point sprites.
* @author Inferno */
public class PointSpriteParticleBatch extends BufferedParticleBatch<PointSpriteControllerRenderData> {
private static boolean pointSpritesEnabled = false;
protected static final Vector3 TMP_V1 = new Vector3();
protected static final int sizeAndRotationUsage = 1 << 9;
protected static final VertexAttributes CPU_ATTRIBUTES = new VertexAttributes(
new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE),
new VertexAttribute(Usage.ColorUnpacked, 4, ShaderProgram.COLOR_ATTRIBUTE),
new VertexAttribute(Usage.TextureCoordinates, 4, "a_region"),
new VertexAttribute(sizeAndRotationUsage, 3, "a_sizeAndRotation"));
protected static final int CPU_VERTEX_SIZE = (short)(CPU_ATTRIBUTES.vertexSize / 4),
CPU_POSITION_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(Usage.Position).offset / 4),
CPU_COLOR_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(Usage.ColorUnpacked).offset / 4),
CPU_REGION_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(Usage.TextureCoordinates).offset / 4),
CPU_SIZE_AND_ROTATION_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(sizeAndRotationUsage).offset / 4);
private static void enablePointSprites () {
Gdx.gl.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
if (Gdx.app.getType() == ApplicationType.Desktop) {
Gdx.gl.glEnable(0x8861); // GL_POINT_OES
}
pointSpritesEnabled = true;
}
private float[] vertices;
Renderable renderable;
protected BlendingAttribute blendingAttribute;
protected DepthTestAttribute depthTestAttribute;
public PointSpriteParticleBatch () {
this(1000);
}
public PointSpriteParticleBatch (int capacity) {
this(capacity, new ParticleShader.Config(ParticleType.Point));
}
public PointSpriteParticleBatch (int capacity, ParticleShader.Config shaderConfig) {
this(capacity, shaderConfig, null, null);
}
public PointSpriteParticleBatch (int capacity, ParticleShader.Config shaderConfig, BlendingAttribute blendingAttribute,
DepthTestAttribute depthTestAttribute) {
super(PointSpriteControllerRenderData.class);
if (!pointSpritesEnabled) enablePointSprites();
this.blendingAttribute = blendingAttribute;
this.depthTestAttribute = depthTestAttribute;
if (this.blendingAttribute == null)
this.blendingAttribute = new BlendingAttribute(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA, 1f);
if (this.depthTestAttribute == null) this.depthTestAttribute = new DepthTestAttribute(GL20.GL_LEQUAL, false);
allocRenderable();
ensureCapacity(capacity);
renderable.shader = new ParticleShader(renderable, shaderConfig);
renderable.shader.init();
}
@Override
protected void allocParticlesData (int capacity) {
vertices = new float[capacity * CPU_VERTEX_SIZE];
if (renderable.meshPart.mesh != null) renderable.meshPart.mesh.dispose();
renderable.meshPart.mesh = new Mesh(false, capacity, 0, CPU_ATTRIBUTES);
}
protected void allocRenderable () {
renderable = new Renderable();
renderable.meshPart.primitiveType = GL20.GL_POINTS;
renderable.meshPart.offset = 0;
renderable.material = new Material(blendingAttribute, depthTestAttribute, TextureAttribute.createDiffuse((Texture)null));
}
public void setTexture (Texture texture) {
TextureAttribute attribute = (TextureAttribute)renderable.material.get(TextureAttribute.Diffuse);
attribute.textureDescription.texture = texture;
}
public Texture getTexture () {
TextureAttribute attribute = (TextureAttribute)renderable.material.get(TextureAttribute.Diffuse);
return attribute.textureDescription.texture;
}
public BlendingAttribute getBlendingAttribute () {
return blendingAttribute;
}
@Override
protected void flush (int[] offsets) {
int tp = 0;
for (PointSpriteControllerRenderData data : renderData) {
FloatChannel scaleChannel = data.scaleChannel;
FloatChannel regionChannel = data.regionChannel;
FloatChannel positionChannel = data.positionChannel;
FloatChannel colorChannel = data.colorChannel;
FloatChannel rotationChannel = data.rotationChannel;
for (int p = 0; p < data.controller.particles.size; ++p, ++tp) {
int offset = offsets[tp] * CPU_VERTEX_SIZE;
int regionOffset = p * regionChannel.strideSize;
int positionOffset = p * positionChannel.strideSize;
int colorOffset = p * colorChannel.strideSize;
int rotationOffset = p * rotationChannel.strideSize;
vertices[offset + CPU_POSITION_OFFSET] = positionChannel.data[positionOffset + ParticleChannels.XOffset];
vertices[offset + CPU_POSITION_OFFSET + 1] = positionChannel.data[positionOffset + ParticleChannels.YOffset];
vertices[offset + CPU_POSITION_OFFSET + 2] = positionChannel.data[positionOffset + ParticleChannels.ZOffset];
vertices[offset + CPU_COLOR_OFFSET] = colorChannel.data[colorOffset + ParticleChannels.RedOffset];
vertices[offset + CPU_COLOR_OFFSET + 1] = colorChannel.data[colorOffset + ParticleChannels.GreenOffset];
vertices[offset + CPU_COLOR_OFFSET + 2] = colorChannel.data[colorOffset + ParticleChannels.BlueOffset];
vertices[offset + CPU_COLOR_OFFSET + 3] = colorChannel.data[colorOffset + ParticleChannels.AlphaOffset];
vertices[offset + CPU_SIZE_AND_ROTATION_OFFSET] = scaleChannel.data[p * scaleChannel.strideSize];
vertices[offset + CPU_SIZE_AND_ROTATION_OFFSET + 1] = rotationChannel.data[rotationOffset
+ ParticleChannels.CosineOffset];
vertices[offset + CPU_SIZE_AND_ROTATION_OFFSET + 2] = rotationChannel.data[rotationOffset
+ ParticleChannels.SineOffset];
vertices[offset + CPU_REGION_OFFSET] = regionChannel.data[regionOffset + ParticleChannels.UOffset];
vertices[offset + CPU_REGION_OFFSET + 1] = regionChannel.data[regionOffset + ParticleChannels.VOffset];
vertices[offset + CPU_REGION_OFFSET + 2] = regionChannel.data[regionOffset + ParticleChannels.U2Offset];
vertices[offset + CPU_REGION_OFFSET + 3] = regionChannel.data[regionOffset + ParticleChannels.V2Offset];
}
}
renderable.meshPart.size = bufferedParticlesCount;
renderable.meshPart.mesh.setVertices(vertices, 0, bufferedParticlesCount * CPU_VERTEX_SIZE);
renderable.meshPart.update();
}
@Override
public void getRenderables (Array<Renderable> renderables, Pool<Renderable> pool) {
if (bufferedParticlesCount > 0) renderables.add(pool.obtain().set(renderable));
}
@Override
public void save (AssetManager manager, ResourceData resources) {
SaveData data = resources.createSaveData("pointSpriteBatch");
data.saveAsset(manager.getAssetFileName(getTexture()), Texture.class);
}
@Override
public void load (AssetManager manager, ResourceData resources) {
SaveData data = resources.getSaveData("pointSpriteBatch");
if (data != null) setTexture((Texture)manager.get(data.loadAsset()));
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles.batches;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Renderable;
import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.DepthTestAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
import com.badlogic.gdx.graphics.g3d.particles.ParallelArray.FloatChannel;
import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels;
import com.badlogic.gdx.graphics.g3d.particles.ParticleShader;
import com.badlogic.gdx.graphics.g3d.particles.ParticleShader.ParticleType;
import com.badlogic.gdx.graphics.g3d.particles.ResourceData;
import com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData;
import com.badlogic.gdx.graphics.g3d.particles.renderers.PointSpriteControllerRenderData;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
/** This class is used to draw particles as point sprites.
* @author Inferno */
public class PointSpriteParticleBatch extends BufferedParticleBatch<PointSpriteControllerRenderData> {
private static boolean pointSpritesEnabled = false;
protected static final Vector3 TMP_V1 = new Vector3();
protected static final int sizeAndRotationUsage = 1 << 9;
protected static final VertexAttributes CPU_ATTRIBUTES = new VertexAttributes(
new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE),
new VertexAttribute(Usage.ColorUnpacked, 4, ShaderProgram.COLOR_ATTRIBUTE),
new VertexAttribute(Usage.TextureCoordinates, 4, "a_region"),
new VertexAttribute(sizeAndRotationUsage, 3, "a_sizeAndRotation"));
protected static final int CPU_VERTEX_SIZE = (short)(CPU_ATTRIBUTES.vertexSize / 4),
CPU_POSITION_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(Usage.Position).offset / 4),
CPU_COLOR_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(Usage.ColorUnpacked).offset / 4),
CPU_REGION_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(Usage.TextureCoordinates).offset / 4),
CPU_SIZE_AND_ROTATION_OFFSET = (short)(CPU_ATTRIBUTES.findByUsage(sizeAndRotationUsage).offset / 4);
private static void enablePointSprites () {
Gdx.gl.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
if (Gdx.app.getType() == ApplicationType.Desktop) {
Gdx.gl.glEnable(0x8861); // GL_POINT_OES
}
pointSpritesEnabled = true;
}
private float[] vertices;
Renderable renderable;
protected BlendingAttribute blendingAttribute;
protected DepthTestAttribute depthTestAttribute;
public PointSpriteParticleBatch () {
this(1000);
}
public PointSpriteParticleBatch (int capacity) {
this(capacity, new ParticleShader.Config(ParticleType.Point));
}
public PointSpriteParticleBatch (int capacity, ParticleShader.Config shaderConfig) {
this(capacity, shaderConfig, null, null);
}
public PointSpriteParticleBatch (int capacity, ParticleShader.Config shaderConfig, BlendingAttribute blendingAttribute,
DepthTestAttribute depthTestAttribute) {
super(PointSpriteControllerRenderData.class);
if (!pointSpritesEnabled) enablePointSprites();
this.blendingAttribute = blendingAttribute;
this.depthTestAttribute = depthTestAttribute;
if (this.blendingAttribute == null)
this.blendingAttribute = new BlendingAttribute(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA, 1f);
if (this.depthTestAttribute == null) this.depthTestAttribute = new DepthTestAttribute(GL20.GL_LEQUAL, false);
allocRenderable();
ensureCapacity(capacity);
renderable.shader = new ParticleShader(renderable, shaderConfig);
renderable.shader.init();
}
@Override
protected void allocParticlesData (int capacity) {
vertices = new float[capacity * CPU_VERTEX_SIZE];
if (renderable.meshPart.mesh != null) renderable.meshPart.mesh.dispose();
renderable.meshPart.mesh = new Mesh(false, capacity, 0, CPU_ATTRIBUTES);
}
protected void allocRenderable () {
renderable = new Renderable();
renderable.meshPart.primitiveType = GL20.GL_POINTS;
renderable.meshPart.offset = 0;
renderable.material = new Material(blendingAttribute, depthTestAttribute, TextureAttribute.createDiffuse((Texture)null));
}
public void setTexture (Texture texture) {
TextureAttribute attribute = (TextureAttribute)renderable.material.get(TextureAttribute.Diffuse);
attribute.textureDescription.texture = texture;
}
public Texture getTexture () {
TextureAttribute attribute = (TextureAttribute)renderable.material.get(TextureAttribute.Diffuse);
return attribute.textureDescription.texture;
}
public BlendingAttribute getBlendingAttribute () {
return blendingAttribute;
}
@Override
protected void flush (int[] offsets) {
int tp = 0;
for (PointSpriteControllerRenderData data : renderData) {
FloatChannel scaleChannel = data.scaleChannel;
FloatChannel regionChannel = data.regionChannel;
FloatChannel positionChannel = data.positionChannel;
FloatChannel colorChannel = data.colorChannel;
FloatChannel rotationChannel = data.rotationChannel;
for (int p = 0; p < data.controller.particles.size; ++p, ++tp) {
int offset = offsets[tp] * CPU_VERTEX_SIZE;
int regionOffset = p * regionChannel.strideSize;
int positionOffset = p * positionChannel.strideSize;
int colorOffset = p * colorChannel.strideSize;
int rotationOffset = p * rotationChannel.strideSize;
vertices[offset + CPU_POSITION_OFFSET] = positionChannel.data[positionOffset + ParticleChannels.XOffset];
vertices[offset + CPU_POSITION_OFFSET + 1] = positionChannel.data[positionOffset + ParticleChannels.YOffset];
vertices[offset + CPU_POSITION_OFFSET + 2] = positionChannel.data[positionOffset + ParticleChannels.ZOffset];
vertices[offset + CPU_COLOR_OFFSET] = colorChannel.data[colorOffset + ParticleChannels.RedOffset];
vertices[offset + CPU_COLOR_OFFSET + 1] = colorChannel.data[colorOffset + ParticleChannels.GreenOffset];
vertices[offset + CPU_COLOR_OFFSET + 2] = colorChannel.data[colorOffset + ParticleChannels.BlueOffset];
vertices[offset + CPU_COLOR_OFFSET + 3] = colorChannel.data[colorOffset + ParticleChannels.AlphaOffset];
vertices[offset + CPU_SIZE_AND_ROTATION_OFFSET] = scaleChannel.data[p * scaleChannel.strideSize];
vertices[offset + CPU_SIZE_AND_ROTATION_OFFSET + 1] = rotationChannel.data[rotationOffset
+ ParticleChannels.CosineOffset];
vertices[offset + CPU_SIZE_AND_ROTATION_OFFSET + 2] = rotationChannel.data[rotationOffset
+ ParticleChannels.SineOffset];
vertices[offset + CPU_REGION_OFFSET] = regionChannel.data[regionOffset + ParticleChannels.UOffset];
vertices[offset + CPU_REGION_OFFSET + 1] = regionChannel.data[regionOffset + ParticleChannels.VOffset];
vertices[offset + CPU_REGION_OFFSET + 2] = regionChannel.data[regionOffset + ParticleChannels.U2Offset];
vertices[offset + CPU_REGION_OFFSET + 3] = regionChannel.data[regionOffset + ParticleChannels.V2Offset];
}
}
renderable.meshPart.size = bufferedParticlesCount;
renderable.meshPart.mesh.setVertices(vertices, 0, bufferedParticlesCount * CPU_VERTEX_SIZE);
renderable.meshPart.update();
}
@Override
public void getRenderables (Array<Renderable> renderables, Pool<Renderable> pool) {
if (bufferedParticlesCount > 0) renderables.add(pool.obtain().set(renderable));
}
@Override
public void save (AssetManager manager, ResourceData resources) {
SaveData data = resources.createSaveData("pointSpriteBatch");
data.saveAsset(manager.getAssetFileName(getTexture()), Texture.class);
}
@Override
public void load (AssetManager manager, ResourceData resources) {
SaveData data = resources.getSaveData("pointSpriteBatch");
if (data != null) setTexture((Texture)manager.get(data.loadAsset()));
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/GIM_QUANTIZED_BVH_NODE_ARRAY.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class GIM_QUANTIZED_BVH_NODE_ARRAY extends btGimQuantizedBvhNodeArray {
private long swigCPtr;
protected GIM_QUANTIZED_BVH_NODE_ARRAY (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.GIM_QUANTIZED_BVH_NODE_ARRAY_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new GIM_QUANTIZED_BVH_NODE_ARRAY, normally you should not need this constructor it's intended for low-level
* usage. */
public GIM_QUANTIZED_BVH_NODE_ARRAY (long cPtr, boolean cMemoryOwn) {
this("GIM_QUANTIZED_BVH_NODE_ARRAY", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.GIM_QUANTIZED_BVH_NODE_ARRAY_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (GIM_QUANTIZED_BVH_NODE_ARRAY obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_GIM_QUANTIZED_BVH_NODE_ARRAY(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public GIM_QUANTIZED_BVH_NODE_ARRAY () {
this(CollisionJNI.new_GIM_QUANTIZED_BVH_NODE_ARRAY(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class GIM_QUANTIZED_BVH_NODE_ARRAY extends btGimQuantizedBvhNodeArray {
private long swigCPtr;
protected GIM_QUANTIZED_BVH_NODE_ARRAY (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.GIM_QUANTIZED_BVH_NODE_ARRAY_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new GIM_QUANTIZED_BVH_NODE_ARRAY, normally you should not need this constructor it's intended for low-level
* usage. */
public GIM_QUANTIZED_BVH_NODE_ARRAY (long cPtr, boolean cMemoryOwn) {
this("GIM_QUANTIZED_BVH_NODE_ARRAY", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.GIM_QUANTIZED_BVH_NODE_ARRAY_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (GIM_QUANTIZED_BVH_NODE_ARRAY obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_GIM_QUANTIZED_BVH_NODE_ARRAY(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public GIM_QUANTIZED_BVH_NODE_ARRAY () {
this(CollisionJNI.new_GIM_QUANTIZED_BVH_NODE_ARRAY(), true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/btGeneric6DofSpring2Constraint.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Matrix3;
import com.badlogic.gdx.math.Matrix4;
public class btGeneric6DofSpring2Constraint extends btTypedConstraint {
private long swigCPtr;
protected btGeneric6DofSpring2Constraint (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btGeneric6DofSpring2Constraint_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btGeneric6DofSpring2Constraint, normally you should not need this constructor it's intended for low-level
* usage. */
public btGeneric6DofSpring2Constraint (long cPtr, boolean cMemoryOwn) {
this("btGeneric6DofSpring2Constraint", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btGeneric6DofSpring2Constraint_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btGeneric6DofSpring2Constraint obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btGeneric6DofSpring2Constraint(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbA, btRigidBody rbB, Matrix4 frameInA, Matrix4 frameInB, int rotOrder) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_0(btRigidBody.getCPtr(rbA), rbA, btRigidBody.getCPtr(rbB), rbB,
frameInA, frameInB, rotOrder), true);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbA, btRigidBody rbB, Matrix4 frameInA, Matrix4 frameInB) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_1(btRigidBody.getCPtr(rbA), rbA, btRigidBody.getCPtr(rbB), rbB,
frameInA, frameInB), true);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbB, Matrix4 frameInB, int rotOrder) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_2(btRigidBody.getCPtr(rbB), rbB, frameInB, rotOrder), true);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbB, Matrix4 frameInB) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_3(btRigidBody.getCPtr(rbB), rbB, frameInB), true);
}
public btRotationalLimitMotor2 getRotationalLimitMotor (int index) {
long cPtr = DynamicsJNI.btGeneric6DofSpring2Constraint_getRotationalLimitMotor(swigCPtr, this, index);
return (cPtr == 0) ? null : new btRotationalLimitMotor2(cPtr, false);
}
public btTranslationalLimitMotor2 getTranslationalLimitMotor () {
long cPtr = DynamicsJNI.btGeneric6DofSpring2Constraint_getTranslationalLimitMotor(swigCPtr, this);
return (cPtr == 0) ? null : new btTranslationalLimitMotor2(cPtr, false);
}
public void calculateTransforms (Matrix4 transA, Matrix4 transB) {
DynamicsJNI.btGeneric6DofSpring2Constraint_calculateTransforms__SWIG_0(swigCPtr, this, transA, transB);
}
public void calculateTransforms () {
DynamicsJNI.btGeneric6DofSpring2Constraint_calculateTransforms__SWIG_1(swigCPtr, this);
}
public Matrix4 getCalculatedTransformA () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getCalculatedTransformA(swigCPtr, this);
}
public Matrix4 getCalculatedTransformB () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getCalculatedTransformB(swigCPtr, this);
}
public Matrix4 getFrameOffsetAConst () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetAConst(swigCPtr, this);
}
public Matrix4 getFrameOffsetBConst () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetBConst(swigCPtr, this);
}
public Matrix4 getFrameOffsetA () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetA(swigCPtr, this);
}
public Matrix4 getFrameOffsetB () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetB(swigCPtr, this);
}
public Vector3 getAxis (int axis_index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getAxis(swigCPtr, this, axis_index);
}
public float getAngle (int axis_index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getAngle(swigCPtr, this, axis_index);
}
public float getRelativePivotPosition (int axis_index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getRelativePivotPosition(swigCPtr, this, axis_index);
}
public void setFrames (Matrix4 frameA, Matrix4 frameB) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setFrames(swigCPtr, this, frameA, frameB);
}
public void setLinearLowerLimit (Vector3 linearLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLinearLowerLimit(swigCPtr, this, linearLower);
}
public void getLinearLowerLimit (Vector3 linearLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getLinearLowerLimit(swigCPtr, this, linearLower);
}
public void setLinearUpperLimit (Vector3 linearUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLinearUpperLimit(swigCPtr, this, linearUpper);
}
public void getLinearUpperLimit (Vector3 linearUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getLinearUpperLimit(swigCPtr, this, linearUpper);
}
public void setAngularLowerLimit (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularLowerLimit(swigCPtr, this, angularLower);
}
public void setAngularLowerLimitReversed (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularLowerLimitReversed(swigCPtr, this, angularLower);
}
public void getAngularLowerLimit (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularLowerLimit(swigCPtr, this, angularLower);
}
public void getAngularLowerLimitReversed (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularLowerLimitReversed(swigCPtr, this, angularLower);
}
public void setAngularUpperLimit (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularUpperLimit(swigCPtr, this, angularUpper);
}
public void setAngularUpperLimitReversed (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularUpperLimitReversed(swigCPtr, this, angularUpper);
}
public void getAngularUpperLimit (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularUpperLimit(swigCPtr, this, angularUpper);
}
public void getAngularUpperLimitReversed (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularUpperLimitReversed(swigCPtr, this, angularUpper);
}
public void setLimit (int axis, float lo, float hi) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLimit(swigCPtr, this, axis, lo, hi);
}
public void setLimitReversed (int axis, float lo, float hi) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLimitReversed(swigCPtr, this, axis, lo, hi);
}
public boolean isLimited (int limitIndex) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_isLimited(swigCPtr, this, limitIndex);
}
public void setRotationOrder (int order) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setRotationOrder(swigCPtr, this, order);
}
public int getRotationOrder () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getRotationOrder(swigCPtr, this);
}
public void setAxis (Vector3 axis1, Vector3 axis2) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAxis(swigCPtr, this, axis1, axis2);
}
public void setBounce (int index, float bounce) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setBounce(swigCPtr, this, index, bounce);
}
public void enableMotor (int index, boolean onOff) {
DynamicsJNI.btGeneric6DofSpring2Constraint_enableMotor(swigCPtr, this, index, onOff);
}
public void setServo (int index, boolean onOff) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setServo(swigCPtr, this, index, onOff);
}
public void setTargetVelocity (int index, float velocity) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setTargetVelocity(swigCPtr, this, index, velocity);
}
public void setServoTarget (int index, float target) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setServoTarget(swigCPtr, this, index, target);
}
public void setMaxMotorForce (int index, float force) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setMaxMotorForce(swigCPtr, this, index, force);
}
public void enableSpring (int index, boolean onOff) {
DynamicsJNI.btGeneric6DofSpring2Constraint_enableSpring(swigCPtr, this, index, onOff);
}
public void setStiffness (int index, float stiffness, boolean limitIfNeeded) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setStiffness__SWIG_0(swigCPtr, this, index, stiffness, limitIfNeeded);
}
public void setStiffness (int index, float stiffness) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setStiffness__SWIG_1(swigCPtr, this, index, stiffness);
}
public void setDamping (int index, float damping, boolean limitIfNeeded) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setDamping__SWIG_0(swigCPtr, this, index, damping, limitIfNeeded);
}
public void setDamping (int index, float damping) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setDamping__SWIG_1(swigCPtr, this, index, damping);
}
public void setEquilibriumPoint () {
DynamicsJNI.btGeneric6DofSpring2Constraint_setEquilibriumPoint__SWIG_0(swigCPtr, this);
}
public void setEquilibriumPoint (int index) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setEquilibriumPoint__SWIG_1(swigCPtr, this, index);
}
public void setEquilibriumPoint (int index, float val) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setEquilibriumPoint__SWIG_2(swigCPtr, this, index, val);
}
public void setParam (int num, float value, int axis) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setParam__SWIG_0(swigCPtr, this, num, value, axis);
}
public void setParam (int num, float value) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setParam__SWIG_1(swigCPtr, this, num, value);
}
public float getParam (int num, int axis) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getParam__SWIG_0(swigCPtr, this, num, axis);
}
public float getParam (int num) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getParam__SWIG_1(swigCPtr, this, num);
}
public static float btGetMatrixElem (Matrix3 mat, int index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_btGetMatrixElem(mat, index);
}
public static boolean matrixToEulerXYZ (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerXYZ(mat, xyz);
}
public static boolean matrixToEulerXZY (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerXZY(mat, xyz);
}
public static boolean matrixToEulerYXZ (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerYXZ(mat, xyz);
}
public static boolean matrixToEulerYZX (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerYZX(mat, xyz);
}
public static boolean matrixToEulerZXY (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerZXY(mat, xyz);
}
public static boolean matrixToEulerZYX (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerZYX(mat, xyz);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Matrix3;
import com.badlogic.gdx.math.Matrix4;
public class btGeneric6DofSpring2Constraint extends btTypedConstraint {
private long swigCPtr;
protected btGeneric6DofSpring2Constraint (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btGeneric6DofSpring2Constraint_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btGeneric6DofSpring2Constraint, normally you should not need this constructor it's intended for low-level
* usage. */
public btGeneric6DofSpring2Constraint (long cPtr, boolean cMemoryOwn) {
this("btGeneric6DofSpring2Constraint", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btGeneric6DofSpring2Constraint_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btGeneric6DofSpring2Constraint obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btGeneric6DofSpring2Constraint(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
DynamicsJNI.btGeneric6DofSpring2Constraint_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbA, btRigidBody rbB, Matrix4 frameInA, Matrix4 frameInB, int rotOrder) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_0(btRigidBody.getCPtr(rbA), rbA, btRigidBody.getCPtr(rbB), rbB,
frameInA, frameInB, rotOrder), true);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbA, btRigidBody rbB, Matrix4 frameInA, Matrix4 frameInB) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_1(btRigidBody.getCPtr(rbA), rbA, btRigidBody.getCPtr(rbB), rbB,
frameInA, frameInB), true);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbB, Matrix4 frameInB, int rotOrder) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_2(btRigidBody.getCPtr(rbB), rbB, frameInB, rotOrder), true);
}
public btGeneric6DofSpring2Constraint (btRigidBody rbB, Matrix4 frameInB) {
this(DynamicsJNI.new_btGeneric6DofSpring2Constraint__SWIG_3(btRigidBody.getCPtr(rbB), rbB, frameInB), true);
}
public btRotationalLimitMotor2 getRotationalLimitMotor (int index) {
long cPtr = DynamicsJNI.btGeneric6DofSpring2Constraint_getRotationalLimitMotor(swigCPtr, this, index);
return (cPtr == 0) ? null : new btRotationalLimitMotor2(cPtr, false);
}
public btTranslationalLimitMotor2 getTranslationalLimitMotor () {
long cPtr = DynamicsJNI.btGeneric6DofSpring2Constraint_getTranslationalLimitMotor(swigCPtr, this);
return (cPtr == 0) ? null : new btTranslationalLimitMotor2(cPtr, false);
}
public void calculateTransforms (Matrix4 transA, Matrix4 transB) {
DynamicsJNI.btGeneric6DofSpring2Constraint_calculateTransforms__SWIG_0(swigCPtr, this, transA, transB);
}
public void calculateTransforms () {
DynamicsJNI.btGeneric6DofSpring2Constraint_calculateTransforms__SWIG_1(swigCPtr, this);
}
public Matrix4 getCalculatedTransformA () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getCalculatedTransformA(swigCPtr, this);
}
public Matrix4 getCalculatedTransformB () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getCalculatedTransformB(swigCPtr, this);
}
public Matrix4 getFrameOffsetAConst () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetAConst(swigCPtr, this);
}
public Matrix4 getFrameOffsetBConst () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetBConst(swigCPtr, this);
}
public Matrix4 getFrameOffsetA () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetA(swigCPtr, this);
}
public Matrix4 getFrameOffsetB () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getFrameOffsetB(swigCPtr, this);
}
public Vector3 getAxis (int axis_index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getAxis(swigCPtr, this, axis_index);
}
public float getAngle (int axis_index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getAngle(swigCPtr, this, axis_index);
}
public float getRelativePivotPosition (int axis_index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getRelativePivotPosition(swigCPtr, this, axis_index);
}
public void setFrames (Matrix4 frameA, Matrix4 frameB) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setFrames(swigCPtr, this, frameA, frameB);
}
public void setLinearLowerLimit (Vector3 linearLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLinearLowerLimit(swigCPtr, this, linearLower);
}
public void getLinearLowerLimit (Vector3 linearLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getLinearLowerLimit(swigCPtr, this, linearLower);
}
public void setLinearUpperLimit (Vector3 linearUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLinearUpperLimit(swigCPtr, this, linearUpper);
}
public void getLinearUpperLimit (Vector3 linearUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getLinearUpperLimit(swigCPtr, this, linearUpper);
}
public void setAngularLowerLimit (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularLowerLimit(swigCPtr, this, angularLower);
}
public void setAngularLowerLimitReversed (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularLowerLimitReversed(swigCPtr, this, angularLower);
}
public void getAngularLowerLimit (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularLowerLimit(swigCPtr, this, angularLower);
}
public void getAngularLowerLimitReversed (Vector3 angularLower) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularLowerLimitReversed(swigCPtr, this, angularLower);
}
public void setAngularUpperLimit (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularUpperLimit(swigCPtr, this, angularUpper);
}
public void setAngularUpperLimitReversed (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAngularUpperLimitReversed(swigCPtr, this, angularUpper);
}
public void getAngularUpperLimit (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularUpperLimit(swigCPtr, this, angularUpper);
}
public void getAngularUpperLimitReversed (Vector3 angularUpper) {
DynamicsJNI.btGeneric6DofSpring2Constraint_getAngularUpperLimitReversed(swigCPtr, this, angularUpper);
}
public void setLimit (int axis, float lo, float hi) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLimit(swigCPtr, this, axis, lo, hi);
}
public void setLimitReversed (int axis, float lo, float hi) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setLimitReversed(swigCPtr, this, axis, lo, hi);
}
public boolean isLimited (int limitIndex) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_isLimited(swigCPtr, this, limitIndex);
}
public void setRotationOrder (int order) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setRotationOrder(swigCPtr, this, order);
}
public int getRotationOrder () {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getRotationOrder(swigCPtr, this);
}
public void setAxis (Vector3 axis1, Vector3 axis2) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setAxis(swigCPtr, this, axis1, axis2);
}
public void setBounce (int index, float bounce) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setBounce(swigCPtr, this, index, bounce);
}
public void enableMotor (int index, boolean onOff) {
DynamicsJNI.btGeneric6DofSpring2Constraint_enableMotor(swigCPtr, this, index, onOff);
}
public void setServo (int index, boolean onOff) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setServo(swigCPtr, this, index, onOff);
}
public void setTargetVelocity (int index, float velocity) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setTargetVelocity(swigCPtr, this, index, velocity);
}
public void setServoTarget (int index, float target) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setServoTarget(swigCPtr, this, index, target);
}
public void setMaxMotorForce (int index, float force) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setMaxMotorForce(swigCPtr, this, index, force);
}
public void enableSpring (int index, boolean onOff) {
DynamicsJNI.btGeneric6DofSpring2Constraint_enableSpring(swigCPtr, this, index, onOff);
}
public void setStiffness (int index, float stiffness, boolean limitIfNeeded) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setStiffness__SWIG_0(swigCPtr, this, index, stiffness, limitIfNeeded);
}
public void setStiffness (int index, float stiffness) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setStiffness__SWIG_1(swigCPtr, this, index, stiffness);
}
public void setDamping (int index, float damping, boolean limitIfNeeded) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setDamping__SWIG_0(swigCPtr, this, index, damping, limitIfNeeded);
}
public void setDamping (int index, float damping) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setDamping__SWIG_1(swigCPtr, this, index, damping);
}
public void setEquilibriumPoint () {
DynamicsJNI.btGeneric6DofSpring2Constraint_setEquilibriumPoint__SWIG_0(swigCPtr, this);
}
public void setEquilibriumPoint (int index) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setEquilibriumPoint__SWIG_1(swigCPtr, this, index);
}
public void setEquilibriumPoint (int index, float val) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setEquilibriumPoint__SWIG_2(swigCPtr, this, index, val);
}
public void setParam (int num, float value, int axis) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setParam__SWIG_0(swigCPtr, this, num, value, axis);
}
public void setParam (int num, float value) {
DynamicsJNI.btGeneric6DofSpring2Constraint_setParam__SWIG_1(swigCPtr, this, num, value);
}
public float getParam (int num, int axis) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getParam__SWIG_0(swigCPtr, this, num, axis);
}
public float getParam (int num) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_getParam__SWIG_1(swigCPtr, this, num);
}
public static float btGetMatrixElem (Matrix3 mat, int index) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_btGetMatrixElem(mat, index);
}
public static boolean matrixToEulerXYZ (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerXYZ(mat, xyz);
}
public static boolean matrixToEulerXZY (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerXZY(mat, xyz);
}
public static boolean matrixToEulerYXZ (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerYXZ(mat, xyz);
}
public static boolean matrixToEulerYZX (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerYZX(mat, xyz);
}
public static boolean matrixToEulerZXY (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerZXY(mat, xyz);
}
public static boolean matrixToEulerZYX (Matrix3 mat, Vector3 xyz) {
return DynamicsJNI.btGeneric6DofSpring2Constraint_matrixToEulerZYX(mat, xyz);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btBox2dBox2dCollisionAlgorithm.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btBox2dBox2dCollisionAlgorithm extends btActivatingCollisionAlgorithm {
private long swigCPtr;
protected btBox2dBox2dCollisionAlgorithm (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btBox2dBox2dCollisionAlgorithm_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btBox2dBox2dCollisionAlgorithm, normally you should not need this constructor it's intended for low-level
* usage. */
public btBox2dBox2dCollisionAlgorithm (long cPtr, boolean cMemoryOwn) {
this("btBox2dBox2dCollisionAlgorithm", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btBox2dBox2dCollisionAlgorithm_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btBox2dBox2dCollisionAlgorithm obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btBox2dBox2dCollisionAlgorithm(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btBox2dBox2dCollisionAlgorithm (btCollisionAlgorithmConstructionInfo ci) {
this(CollisionJNI.new_btBox2dBox2dCollisionAlgorithm__SWIG_0(btCollisionAlgorithmConstructionInfo.getCPtr(ci), ci), true);
}
public btBox2dBox2dCollisionAlgorithm (btPersistentManifold mf, btCollisionAlgorithmConstructionInfo ci,
btCollisionObjectWrapper body0Wrap, btCollisionObjectWrapper body1Wrap) {
this(CollisionJNI.new_btBox2dBox2dCollisionAlgorithm__SWIG_1(btPersistentManifold.getCPtr(mf), mf,
btCollisionAlgorithmConstructionInfo.getCPtr(ci), ci, btCollisionObjectWrapper.getCPtr(body0Wrap), body0Wrap,
btCollisionObjectWrapper.getCPtr(body1Wrap), body1Wrap), true);
}
static public class CreateFunc extends btCollisionAlgorithmCreateFunc {
private long swigCPtr;
protected CreateFunc (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btBox2dBox2dCollisionAlgorithm_CreateFunc_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new CreateFunc, normally you should not need this constructor it's intended for low-level usage. */
public CreateFunc (long cPtr, boolean cMemoryOwn) {
this("CreateFunc", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btBox2dBox2dCollisionAlgorithm_CreateFunc_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (CreateFunc obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btBox2dBox2dCollisionAlgorithm_CreateFunc(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public CreateFunc () {
this(CollisionJNI.new_btBox2dBox2dCollisionAlgorithm_CreateFunc(), true);
}
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btBox2dBox2dCollisionAlgorithm extends btActivatingCollisionAlgorithm {
private long swigCPtr;
protected btBox2dBox2dCollisionAlgorithm (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btBox2dBox2dCollisionAlgorithm_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btBox2dBox2dCollisionAlgorithm, normally you should not need this constructor it's intended for low-level
* usage. */
public btBox2dBox2dCollisionAlgorithm (long cPtr, boolean cMemoryOwn) {
this("btBox2dBox2dCollisionAlgorithm", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btBox2dBox2dCollisionAlgorithm_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btBox2dBox2dCollisionAlgorithm obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btBox2dBox2dCollisionAlgorithm(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btBox2dBox2dCollisionAlgorithm (btCollisionAlgorithmConstructionInfo ci) {
this(CollisionJNI.new_btBox2dBox2dCollisionAlgorithm__SWIG_0(btCollisionAlgorithmConstructionInfo.getCPtr(ci), ci), true);
}
public btBox2dBox2dCollisionAlgorithm (btPersistentManifold mf, btCollisionAlgorithmConstructionInfo ci,
btCollisionObjectWrapper body0Wrap, btCollisionObjectWrapper body1Wrap) {
this(CollisionJNI.new_btBox2dBox2dCollisionAlgorithm__SWIG_1(btPersistentManifold.getCPtr(mf), mf,
btCollisionAlgorithmConstructionInfo.getCPtr(ci), ci, btCollisionObjectWrapper.getCPtr(body0Wrap), body0Wrap,
btCollisionObjectWrapper.getCPtr(body1Wrap), body1Wrap), true);
}
static public class CreateFunc extends btCollisionAlgorithmCreateFunc {
private long swigCPtr;
protected CreateFunc (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btBox2dBox2dCollisionAlgorithm_CreateFunc_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new CreateFunc, normally you should not need this constructor it's intended for low-level usage. */
public CreateFunc (long cPtr, boolean cMemoryOwn) {
this("CreateFunc", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btBox2dBox2dCollisionAlgorithm_CreateFunc_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (CreateFunc obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btBox2dBox2dCollisionAlgorithm_CreateFunc(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public CreateFunc () {
this(CollisionJNI.new_btBox2dBox2dCollisionAlgorithm_CreateFunc(), true);
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/com/badlogic/gdx/physics/box2d/joints/PulleyJoint.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d.joints;
import org.jbox2d.common.Vec2;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Joint;
import com.badlogic.gdx.physics.box2d.World;
/** The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 +
* ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit
* on both sides. This is useful to prevent one side of the pulley hitting the top. */
public class PulleyJoint extends Joint {
org.jbox2d.dynamics.joints.PulleyJoint joint;
public PulleyJoint (World world, org.jbox2d.dynamics.joints.PulleyJoint joint) {
super(world, joint);
this.joint = joint;
}
/** Get the first ground anchor. */
private final Vector2 groundAnchorA = new Vector2();
public Vector2 getGroundAnchorA () {
Vec2 g = joint.getGroundAnchorA();
return groundAnchorA.set(g.x, g.y);
}
/** Get the second ground anchor. */
private final Vector2 groundAnchorB = new Vector2();
public Vector2 getGroundAnchorB () {
Vec2 g = joint.getGroundAnchorB();
return groundAnchorB.set(g.x, g.y);
}
/** Get the current length of the segment attached to body1. */
public float getLength1 () {
return joint.getLength1();
}
/** Get the current length of the segment attached to body2. */
public float getLength2 () {
return joint.getLength2();
}
/** Get the pulley ratio. */
public float getRatio () {
return joint.getRatio();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d.joints;
import org.jbox2d.common.Vec2;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Joint;
import com.badlogic.gdx.physics.box2d.World;
/** The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 +
* ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit
* on both sides. This is useful to prevent one side of the pulley hitting the top. */
public class PulleyJoint extends Joint {
org.jbox2d.dynamics.joints.PulleyJoint joint;
public PulleyJoint (World world, org.jbox2d.dynamics.joints.PulleyJoint joint) {
super(world, joint);
this.joint = joint;
}
/** Get the first ground anchor. */
private final Vector2 groundAnchorA = new Vector2();
public Vector2 getGroundAnchorA () {
Vec2 g = joint.getGroundAnchorA();
return groundAnchorA.set(g.x, g.y);
}
/** Get the second ground anchor. */
private final Vector2 groundAnchorB = new Vector2();
public Vector2 getGroundAnchorB () {
Vec2 g = joint.getGroundAnchorB();
return groundAnchorB.set(g.x, g.y);
}
/** Get the current length of the segment attached to body1. */
public float getLength1 () {
return joint.getLength1();
}
/** Get the current length of the segment attached to body2. */
public float getLength2 () {
return joint.getLength2();
}
/** Get the pulley ratio. */
public float getRatio () {
return joint.getRatio();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BaseEntity.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.utils.Disposable;
/** @author xoppa Base class specifying only a renderable entity */
public abstract class BaseEntity implements Disposable {
public Matrix4 transform;
public ModelInstance modelInstance;
private Color color = new Color(1f, 1f, 1f, 1f);
public Color getColor () {
return color;
}
public void setColor (Color color) {
setColor(color.r, color.g, color.b, color.a);
}
public void setColor (float r, float g, float b, float a) {
color.set(r, g, b, a);
if (modelInstance != null) {
for (Material m : modelInstance.materials) {
ColorAttribute ca = (ColorAttribute)m.get(ColorAttribute.Diffuse);
if (ca != null) ca.color.set(r, g, b, a);
}
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.utils.Disposable;
/** @author xoppa Base class specifying only a renderable entity */
public abstract class BaseEntity implements Disposable {
public Matrix4 transform;
public ModelInstance modelInstance;
private Color color = new Color(1f, 1f, 1f, 1f);
public Color getColor () {
return color;
}
public void setColor (Color color) {
setColor(color.r, color.g, color.b, color.a);
}
public void setColor (float r, float g, float b, float a) {
color.set(r, g, b, a);
if (modelInstance != null) {
for (Material m : modelInstance.materials) {
ColorAttribute ca = (ColorAttribute)m.get(ColorAttribute.Diffuse);
if (ca != null) ca.color.set(r, g, b, a);
}
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/com/badlogic/gdx/physics/box2d/joints/PrismaticJointDef.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d.joints;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.JointDef;
/** Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses
* local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint
* translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when
* saving and loading a game.
* @warning at least one body should by dynamic with a non-fixed rotation. */
public class PrismaticJointDef extends JointDef {
public PrismaticJointDef () {
type = JointType.PrismaticJoint;
}
/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis) {
this.bodyA = bodyA;
this.bodyB = bodyB;
localAnchorA.set(bodyA.getLocalPoint(anchor));
localAnchorB.set(bodyB.getLocalPoint(anchor));
localAxisA.set(bodyA.getLocalVector(axis));
referenceAngle = bodyB.getAngle() - bodyA.getAngle();
}
/** The local anchor point relative to body1's origin. */
public final Vector2 localAnchorA = new Vector2();
/** The local anchor point relative to body2's origin. */
public final Vector2 localAnchorB = new Vector2();
/** The local translation axis in body1. */
public final Vector2 localAxisA = new Vector2(1, 0);
/** The constrained angle between the bodies: body2_angle - body1_angle. */
public float referenceAngle = 0;
/** Enable/disable the joint limit. */
public boolean enableLimit = false;
/** The lower translation limit, usually in meters. */
public float lowerTranslation = 0;
/** The upper translation limit, usually in meters. */
public float upperTranslation = 0;
/** Enable/disable the joint motor. */
public boolean enableMotor = false;
/** The maximum motor torque, usually in N-m. */
public float maxMotorForce = 0;
/** The desired motor speed in radians per second. */
public float motorSpeed = 0;
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
org.jbox2d.dynamics.joints.PrismaticJointDef jd = new org.jbox2d.dynamics.joints.PrismaticJointDef();
jd.bodyA = bodyA.body;
jd.bodyB = bodyB.body;
jd.collideConnected = collideConnected;
jd.enableLimit = enableLimit;
jd.enableMotor = enableMotor;
jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
jd.localAxisA.set(localAxisA.x, localAxisA.y);
jd.lowerTranslation = lowerTranslation;
jd.maxMotorForce = maxMotorForce;
jd.motorSpeed = motorSpeed;
jd.referenceAngle = referenceAngle;
jd.type = org.jbox2d.dynamics.joints.JointType.PRISMATIC;
jd.upperTranslation = upperTranslation;
return jd;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d.joints;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.JointDef;
/** Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses
* local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint
* translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when
* saving and loading a game.
* @warning at least one body should by dynamic with a non-fixed rotation. */
public class PrismaticJointDef extends JointDef {
public PrismaticJointDef () {
type = JointType.PrismaticJoint;
}
/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis) {
this.bodyA = bodyA;
this.bodyB = bodyB;
localAnchorA.set(bodyA.getLocalPoint(anchor));
localAnchorB.set(bodyB.getLocalPoint(anchor));
localAxisA.set(bodyA.getLocalVector(axis));
referenceAngle = bodyB.getAngle() - bodyA.getAngle();
}
/** The local anchor point relative to body1's origin. */
public final Vector2 localAnchorA = new Vector2();
/** The local anchor point relative to body2's origin. */
public final Vector2 localAnchorB = new Vector2();
/** The local translation axis in body1. */
public final Vector2 localAxisA = new Vector2(1, 0);
/** The constrained angle between the bodies: body2_angle - body1_angle. */
public float referenceAngle = 0;
/** Enable/disable the joint limit. */
public boolean enableLimit = false;
/** The lower translation limit, usually in meters. */
public float lowerTranslation = 0;
/** The upper translation limit, usually in meters. */
public float upperTranslation = 0;
/** Enable/disable the joint motor. */
public boolean enableMotor = false;
/** The maximum motor torque, usually in N-m. */
public float maxMotorForce = 0;
/** The desired motor speed in radians per second. */
public float motorSpeed = 0;
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
org.jbox2d.dynamics.joints.PrismaticJointDef jd = new org.jbox2d.dynamics.joints.PrismaticJointDef();
jd.bodyA = bodyA.body;
jd.bodyB = bodyB.body;
jd.collideConnected = collideConnected;
jd.enableLimit = enableLimit;
jd.enableMotor = enableMotor;
jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
jd.localAxisA.set(localAxisA.x, localAxisA.y);
jd.lowerTranslation = lowerTranslation;
jd.maxMotorForce = maxMotorForce;
jd.motorSpeed = motorSpeed;
jd.referenceAngle = referenceAngle;
jd.type = org.jbox2d.dynamics.joints.JointType.PRISMATIC;
jd.upperTranslation = upperTranslation;
return jd;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/nio/BaseByteBuffer.java | /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.nio;
/** Serves as the root of other byte buffer impl classes, implements common methods that can be shared by child classes. */
abstract class BaseByteBuffer extends ByteBuffer {
protected BaseByteBuffer (int capacity) {
super(capacity);
}
@Override
public CharBuffer asCharBuffer () {
return CharToByteBufferAdapter.wrap(this);
}
@Override
public DoubleBuffer asDoubleBuffer () {
return DoubleToByteBufferAdapter.wrap(this);
}
@Override
public FloatBuffer asFloatBuffer () {
return FloatToByteBufferAdapter.wrap(this);
}
@Override
public IntBuffer asIntBuffer () {
return IntToByteBufferAdapter.wrap(this);
}
@Override
public LongBuffer asLongBuffer () {
return LongToByteBufferAdapter.wrap(this);
}
@Override
public ShortBuffer asShortBuffer () {
return ShortToByteBufferAdapter.wrap(this);
}
public final char getChar () {
return (char)getShort();
}
public final char getChar (int index) {
return (char)getShort(index);
}
public final ByteBuffer putChar (char value) {
return putShort((short)value);
}
public final ByteBuffer putChar (int index, char value) {
return putShort(index, (short)value);
}
}
| /* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.nio;
/** Serves as the root of other byte buffer impl classes, implements common methods that can be shared by child classes. */
abstract class BaseByteBuffer extends ByteBuffer {
protected BaseByteBuffer (int capacity) {
super(capacity);
}
@Override
public CharBuffer asCharBuffer () {
return CharToByteBufferAdapter.wrap(this);
}
@Override
public DoubleBuffer asDoubleBuffer () {
return DoubleToByteBufferAdapter.wrap(this);
}
@Override
public FloatBuffer asFloatBuffer () {
return FloatToByteBufferAdapter.wrap(this);
}
@Override
public IntBuffer asIntBuffer () {
return IntToByteBufferAdapter.wrap(this);
}
@Override
public LongBuffer asLongBuffer () {
return LongToByteBufferAdapter.wrap(this);
}
@Override
public ShortBuffer asShortBuffer () {
return ShortToByteBufferAdapter.wrap(this);
}
public final char getChar () {
return (char)getShort();
}
public final char getChar (int index) {
return (char)getShort(index);
}
public final ByteBuffer putChar (char value) {
return putShort((short)value);
}
public final ByteBuffer putChar (int index, char value) {
return putShort(index, (short)value);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btBroadphaseRayCallback.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btBroadphaseRayCallback extends btBroadphaseAabbCallback {
private long swigCPtr;
protected btBroadphaseRayCallback (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btBroadphaseRayCallback_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btBroadphaseRayCallback, normally you should not need this constructor it's intended for low-level
* usage. */
public btBroadphaseRayCallback (long cPtr, boolean cMemoryOwn) {
this("btBroadphaseRayCallback", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btBroadphaseRayCallback_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btBroadphaseRayCallback obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btBroadphaseRayCallback(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
protected void swigDirectorDisconnect () {
swigCMemOwn = false;
delete();
}
public void swigReleaseOwnership () {
swigCMemOwn = false;
CollisionJNI.btBroadphaseRayCallback_change_ownership(this, swigCPtr, false);
}
public void swigTakeOwnership () {
swigCMemOwn = true;
CollisionJNI.btBroadphaseRayCallback_change_ownership(this, swigCPtr, true);
}
public void setRayDirectionInverse (btVector3 value) {
CollisionJNI.btBroadphaseRayCallback_rayDirectionInverse_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getRayDirectionInverse () {
long cPtr = CollisionJNI.btBroadphaseRayCallback_rayDirectionInverse_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSigns (long[] value) {
CollisionJNI.btBroadphaseRayCallback_signs_set(swigCPtr, this, value);
}
public long[] getSigns () {
return CollisionJNI.btBroadphaseRayCallback_signs_get(swigCPtr, this);
}
public void setLambda_max (float value) {
CollisionJNI.btBroadphaseRayCallback_lambda_max_set(swigCPtr, this, value);
}
public float getLambda_max () {
return CollisionJNI.btBroadphaseRayCallback_lambda_max_get(swigCPtr, this);
}
protected btBroadphaseRayCallback () {
this(CollisionJNI.new_btBroadphaseRayCallback(), true);
CollisionJNI.btBroadphaseRayCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btBroadphaseRayCallback extends btBroadphaseAabbCallback {
private long swigCPtr;
protected btBroadphaseRayCallback (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btBroadphaseRayCallback_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btBroadphaseRayCallback, normally you should not need this constructor it's intended for low-level
* usage. */
public btBroadphaseRayCallback (long cPtr, boolean cMemoryOwn) {
this("btBroadphaseRayCallback", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btBroadphaseRayCallback_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btBroadphaseRayCallback obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btBroadphaseRayCallback(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
protected void swigDirectorDisconnect () {
swigCMemOwn = false;
delete();
}
public void swigReleaseOwnership () {
swigCMemOwn = false;
CollisionJNI.btBroadphaseRayCallback_change_ownership(this, swigCPtr, false);
}
public void swigTakeOwnership () {
swigCMemOwn = true;
CollisionJNI.btBroadphaseRayCallback_change_ownership(this, swigCPtr, true);
}
public void setRayDirectionInverse (btVector3 value) {
CollisionJNI.btBroadphaseRayCallback_rayDirectionInverse_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getRayDirectionInverse () {
long cPtr = CollisionJNI.btBroadphaseRayCallback_rayDirectionInverse_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setSigns (long[] value) {
CollisionJNI.btBroadphaseRayCallback_signs_set(swigCPtr, this, value);
}
public long[] getSigns () {
return CollisionJNI.btBroadphaseRayCallback_signs_get(swigCPtr, this);
}
public void setLambda_max (float value) {
CollisionJNI.btBroadphaseRayCallback_lambda_max_set(swigCPtr, this, value);
}
public float getLambda_max () {
return CollisionJNI.btBroadphaseRayCallback_lambda_max_get(swigCPtr, this);
}
protected btBroadphaseRayCallback () {
this(CollisionJNI.new_btBroadphaseRayCallback(), true);
CollisionJNI.btBroadphaseRayCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BasicShapesTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
import com.badlogic.gdx.physics.bullet.collision.btBoxShape;
import com.badlogic.gdx.physics.bullet.collision.btCapsuleShape;
import com.badlogic.gdx.physics.bullet.collision.btConeShape;
import com.badlogic.gdx.physics.bullet.collision.btCylinderShape;
import com.badlogic.gdx.physics.bullet.collision.btSphereShape;
public class BasicShapesTest extends BaseBulletTest {
@Override
public void create () {
super.create();
final Texture texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
disposables.add(texture);
final Material material = new Material(TextureAttribute.createDiffuse(texture), ColorAttribute.createSpecular(1, 1, 1, 1),
FloatAttribute.createShininess(8f));
final long attributes = Usage.Position | Usage.Normal | Usage.TextureCoordinates;
final Model sphere = modelBuilder.createSphere(4f, 4f, 4f, 24, 24, material, attributes);
disposables.add(sphere);
world.addConstructor("sphere", new BulletConstructor(sphere, 10f, new btSphereShape(2f)));
final Model cylinder = modelBuilder.createCylinder(4f, 6f, 4f, 16, material, attributes);
disposables.add(cylinder);
world.addConstructor("cylinder", new BulletConstructor(cylinder, 10f, new btCylinderShape(tmpV1.set(2f, 3f, 2f))));
final Model capsule = modelBuilder.createCapsule(2f, 6f, 16, material, attributes);
disposables.add(capsule);
world.addConstructor("capsule", new BulletConstructor(capsule, 10f, new btCapsuleShape(2f, 2f)));
final Model box = modelBuilder.createBox(4f, 4f, 2f, material, attributes);
disposables.add(box);
world.addConstructor("box2", new BulletConstructor(box, 10f, new btBoxShape(tmpV1.set(2f, 2f, 1f))));
final Model cone = modelBuilder.createCone(4f, 6f, 4f, 16, material, attributes);
disposables.add(cone);
world.addConstructor("cone", new BulletConstructor(cone, 10f, new btConeShape(2f, 6f)));
// Create the entities
world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
0.25f + 0.5f * (float)Math.random(), 1f);
world.add("sphere", 0, 5, 5);
world.add("cylinder", 5, 5, 0);
world.add("box2", 0, 5, 0);
world.add("capsule", 5, 5, 5);
world.add("cone", 10, 5, 0);
}
@Override
public boolean tap (float x, float y, int count, int button) {
shoot(x, y);
return true;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
import com.badlogic.gdx.physics.bullet.collision.btBoxShape;
import com.badlogic.gdx.physics.bullet.collision.btCapsuleShape;
import com.badlogic.gdx.physics.bullet.collision.btConeShape;
import com.badlogic.gdx.physics.bullet.collision.btCylinderShape;
import com.badlogic.gdx.physics.bullet.collision.btSphereShape;
public class BasicShapesTest extends BaseBulletTest {
@Override
public void create () {
super.create();
final Texture texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
disposables.add(texture);
final Material material = new Material(TextureAttribute.createDiffuse(texture), ColorAttribute.createSpecular(1, 1, 1, 1),
FloatAttribute.createShininess(8f));
final long attributes = Usage.Position | Usage.Normal | Usage.TextureCoordinates;
final Model sphere = modelBuilder.createSphere(4f, 4f, 4f, 24, 24, material, attributes);
disposables.add(sphere);
world.addConstructor("sphere", new BulletConstructor(sphere, 10f, new btSphereShape(2f)));
final Model cylinder = modelBuilder.createCylinder(4f, 6f, 4f, 16, material, attributes);
disposables.add(cylinder);
world.addConstructor("cylinder", new BulletConstructor(cylinder, 10f, new btCylinderShape(tmpV1.set(2f, 3f, 2f))));
final Model capsule = modelBuilder.createCapsule(2f, 6f, 16, material, attributes);
disposables.add(capsule);
world.addConstructor("capsule", new BulletConstructor(capsule, 10f, new btCapsuleShape(2f, 2f)));
final Model box = modelBuilder.createBox(4f, 4f, 2f, material, attributes);
disposables.add(box);
world.addConstructor("box2", new BulletConstructor(box, 10f, new btBoxShape(tmpV1.set(2f, 2f, 1f))));
final Model cone = modelBuilder.createCone(4f, 6f, 4f, 16, material, attributes);
disposables.add(cone);
world.addConstructor("cone", new BulletConstructor(cone, 10f, new btConeShape(2f, 6f)));
// Create the entities
world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
0.25f + 0.5f * (float)Math.random(), 1f);
world.add("sphere", 0, 5, 5);
world.add("cylinder", 5, 5, 0);
world.add("box2", 0, 5, 0);
world.add("capsule", 5, 5, 5);
world.add("cone", 10, 5, 0);
}
@Override
public boolean tap (float x, float y, int count, int button) {
shoot(x, y);
return true;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/FilterableVehicleRaycaster.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class FilterableVehicleRaycaster extends btDefaultVehicleRaycaster {
private long swigCPtr;
protected FilterableVehicleRaycaster (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.FilterableVehicleRaycaster_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new FilterableVehicleRaycaster, normally you should not need this constructor it's intended for low-level
* usage. */
public FilterableVehicleRaycaster (long cPtr, boolean cMemoryOwn) {
this("FilterableVehicleRaycaster", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.FilterableVehicleRaycaster_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (FilterableVehicleRaycaster obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_FilterableVehicleRaycaster(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public FilterableVehicleRaycaster (btDynamicsWorld world) {
this(DynamicsJNI.new_FilterableVehicleRaycaster(btDynamicsWorld.getCPtr(world), world), true);
}
public void setCollisionFilterMask (short collisionFilterMask) {
DynamicsJNI.FilterableVehicleRaycaster_setCollisionFilterMask(swigCPtr, this, collisionFilterMask);
}
public void setCollisionFilterGroup (short collisionFilterGroup) {
DynamicsJNI.FilterableVehicleRaycaster_setCollisionFilterGroup(swigCPtr, this, collisionFilterGroup);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class FilterableVehicleRaycaster extends btDefaultVehicleRaycaster {
private long swigCPtr;
protected FilterableVehicleRaycaster (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.FilterableVehicleRaycaster_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new FilterableVehicleRaycaster, normally you should not need this constructor it's intended for low-level
* usage. */
public FilterableVehicleRaycaster (long cPtr, boolean cMemoryOwn) {
this("FilterableVehicleRaycaster", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.FilterableVehicleRaycaster_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (FilterableVehicleRaycaster obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_FilterableVehicleRaycaster(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public FilterableVehicleRaycaster (btDynamicsWorld world) {
this(DynamicsJNI.new_FilterableVehicleRaycaster(btDynamicsWorld.getCPtr(world), world), true);
}
public void setCollisionFilterMask (short collisionFilterMask) {
DynamicsJNI.FilterableVehicleRaycaster_setCollisionFilterMask(swigCPtr, this, collisionFilterMask);
}
public void setCollisionFilterGroup (short collisionFilterGroup) {
DynamicsJNI.FilterableVehicleRaycaster_setCollisionFilterGroup(swigCPtr, this, collisionFilterGroup);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BaseBulletTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
import com.badlogic.gdx.graphics.g3d.loader.ObjLoader;
import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.Ray;
import com.badlogic.gdx.physics.bullet.Bullet;
import com.badlogic.gdx.physics.bullet.dynamics.btRigidBody;
import com.badlogic.gdx.physics.bullet.linearmath.LinearMath;
import com.badlogic.gdx.physics.bullet.linearmath.btIDebugDraw.DebugDrawModes;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
/** @author xoppa */
public class BaseBulletTest extends BulletTest {
// Set this to the path of the lib to use it on desktop instead of default lib.
private final static String customDesktopLib = null;// "D:\\Xoppa\\code\\libgdx\\extensions\\gdx-bullet\\jni\\vs\\gdxBullet\\x64\\Debug\\gdxBullet.dll";
private static boolean initialized = false;
public static boolean shadows = true;
public static void init () {
if (initialized) return;
// Need to initialize bullet before using it.
if (Gdx.app.getType() == ApplicationType.Desktop && customDesktopLib != null) {
System.load(customDesktopLib);
} else
Bullet.init();
Gdx.app.log("Bullet", "Version = " + LinearMath.btGetVersion());
initialized = true;
}
public Environment environment;
public DirectionalLight light;
public ModelBatch shadowBatch;
public BulletWorld world;
public ObjLoader objLoader = new ObjLoader();
public ModelBuilder modelBuilder = new ModelBuilder();
public ModelBatch modelBatch;
public Array<Disposable> disposables = new Array<Disposable>();
private int debugMode = DebugDrawModes.DBG_NoDebug;
protected final static Vector3 tmpV1 = new Vector3(), tmpV2 = new Vector3();
public BulletWorld createWorld () {
return new BulletWorld();
}
@Override
public void create () {
init();
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1.f));
light = shadows ? new DirectionalShadowLight(1024, 1024, 20f, 20f, 1f, 300f) : new DirectionalLight();
light.set(0.8f, 0.8f, 0.8f, -0.5f, -1f, 0.7f);
environment.add(light);
if (shadows) environment.shadowMap = (DirectionalShadowLight)light;
shadowBatch = new ModelBatch(new DepthShaderProvider());
modelBatch = new ModelBatch();
world = createWorld();
world.performanceCounter = performanceCounter;
final float width = Gdx.graphics.getWidth();
final float height = Gdx.graphics.getHeight();
if (width > height)
camera = new PerspectiveCamera(67f, 3f * width / height, 3f);
else
camera = new PerspectiveCamera(67f, 3f, 3f * height / width);
camera.position.set(10f, 10f, 10f);
camera.lookAt(0, 0, 0);
camera.update();
// Create some simple models
final Model groundModel = modelBuilder.createRect(20f, 0f, -20f, -20f, 0f, -20f, -20f, 0f, 20f, 20f, 0f, 20f, 0, 1, 0,
new Material(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE),
FloatAttribute.createShininess(16f)),
Usage.Position | Usage.Normal);
disposables.add(groundModel);
final Model boxModel = modelBuilder.createBox(1f, 1f, 1f, new Material(ColorAttribute.createDiffuse(Color.WHITE),
ColorAttribute.createSpecular(Color.WHITE), FloatAttribute.createShininess(64f)), Usage.Position | Usage.Normal);
disposables.add(boxModel);
// Add the constructors
world.addConstructor("ground", new BulletConstructor(groundModel, 0f)); // mass = 0: static body
world.addConstructor("box", new BulletConstructor(boxModel, 1f)); // mass = 1kg: dynamic body
world.addConstructor("staticbox", new BulletConstructor(boxModel, 0f)); // mass = 0: static body
}
@Override
public void dispose () {
world.dispose();
world = null;
for (Disposable disposable : disposables)
disposable.dispose();
disposables.clear();
modelBatch.dispose();
modelBatch = null;
shadowBatch.dispose();
shadowBatch = null;
if (shadows) ((DirectionalShadowLight)light).dispose();
light = null;
super.dispose();
}
@Override
public void render () {
render(true);
}
public void render (boolean update) {
fpsCounter.put(Gdx.graphics.getFramesPerSecond());
if (update) update();
beginRender(true);
renderWorld();
Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
if (debugMode != DebugDrawModes.DBG_NoDebug) world.setDebugMode(debugMode);
Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
performance.setLength(0);
performance.append("FPS: ").append(fpsCounter.value).append(", Bullet: ")
.append((int)(performanceCounter.load.value * 100f)).append("%");
}
protected void beginRender (boolean lighting) {
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
camera.update();
}
protected void renderWorld () {
if (shadows) {
((DirectionalShadowLight)light).begin(Vector3.Zero, camera.direction);
shadowBatch.begin(((DirectionalShadowLight)light).getCamera());
world.render(shadowBatch, null);
shadowBatch.end();
((DirectionalShadowLight)light).end();
}
modelBatch.begin(camera);
world.render(modelBatch, environment);
modelBatch.end();
}
public void update () {
world.update();
}
public BulletEntity shoot (final float x, final float y) {
return shoot(x, y, 30f);
}
public BulletEntity shoot (final float x, final float y, final float impulse) {
return shoot("box", x, y, impulse);
}
public BulletEntity shoot (final String what, final float x, final float y, final float impulse) {
// Shoot a box
Ray ray = camera.getPickRay(x, y);
BulletEntity entity = world.add(what, ray.origin.x, ray.origin.y, ray.origin.z);
entity.setColor(0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.random(),
1f);
((btRigidBody)entity.body).applyCentralImpulse(ray.direction.scl(impulse));
return entity;
}
public void setDebugMode (final int mode) {
world.setDebugMode(debugMode = mode);
}
public void toggleDebugMode () {
if (world.getDebugMode() == DebugDrawModes.DBG_NoDebug)
setDebugMode(DebugDrawModes.DBG_DrawWireframe | DebugDrawModes.DBG_DrawFeaturesText | DebugDrawModes.DBG_DrawText
| DebugDrawModes.DBG_DrawContactPoints);
else if (world.renderMeshes)
world.renderMeshes = false;
else {
world.renderMeshes = true;
setDebugMode(DebugDrawModes.DBG_NoDebug);
}
}
@Override
public boolean longPress (float x, float y) {
toggleDebugMode();
return true;
}
@Override
public boolean keyUp (int keycode) {
if (keycode == Keys.ENTER) {
toggleDebugMode();
return true;
}
return super.keyUp(keycode);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.bullet;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
import com.badlogic.gdx.graphics.g3d.loader.ObjLoader;
import com.badlogic.gdx.graphics.g3d.utils.DepthShaderProvider;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.Ray;
import com.badlogic.gdx.physics.bullet.Bullet;
import com.badlogic.gdx.physics.bullet.dynamics.btRigidBody;
import com.badlogic.gdx.physics.bullet.linearmath.LinearMath;
import com.badlogic.gdx.physics.bullet.linearmath.btIDebugDraw.DebugDrawModes;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
/** @author xoppa */
public class BaseBulletTest extends BulletTest {
// Set this to the path of the lib to use it on desktop instead of default lib.
private final static String customDesktopLib = null;// "D:\\Xoppa\\code\\libgdx\\extensions\\gdx-bullet\\jni\\vs\\gdxBullet\\x64\\Debug\\gdxBullet.dll";
private static boolean initialized = false;
public static boolean shadows = true;
public static void init () {
if (initialized) return;
// Need to initialize bullet before using it.
if (Gdx.app.getType() == ApplicationType.Desktop && customDesktopLib != null) {
System.load(customDesktopLib);
} else
Bullet.init();
Gdx.app.log("Bullet", "Version = " + LinearMath.btGetVersion());
initialized = true;
}
public Environment environment;
public DirectionalLight light;
public ModelBatch shadowBatch;
public BulletWorld world;
public ObjLoader objLoader = new ObjLoader();
public ModelBuilder modelBuilder = new ModelBuilder();
public ModelBatch modelBatch;
public Array<Disposable> disposables = new Array<Disposable>();
private int debugMode = DebugDrawModes.DBG_NoDebug;
protected final static Vector3 tmpV1 = new Vector3(), tmpV2 = new Vector3();
public BulletWorld createWorld () {
return new BulletWorld();
}
@Override
public void create () {
init();
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.3f, 0.3f, 0.3f, 1.f));
light = shadows ? new DirectionalShadowLight(1024, 1024, 20f, 20f, 1f, 300f) : new DirectionalLight();
light.set(0.8f, 0.8f, 0.8f, -0.5f, -1f, 0.7f);
environment.add(light);
if (shadows) environment.shadowMap = (DirectionalShadowLight)light;
shadowBatch = new ModelBatch(new DepthShaderProvider());
modelBatch = new ModelBatch();
world = createWorld();
world.performanceCounter = performanceCounter;
final float width = Gdx.graphics.getWidth();
final float height = Gdx.graphics.getHeight();
if (width > height)
camera = new PerspectiveCamera(67f, 3f * width / height, 3f);
else
camera = new PerspectiveCamera(67f, 3f, 3f * height / width);
camera.position.set(10f, 10f, 10f);
camera.lookAt(0, 0, 0);
camera.update();
// Create some simple models
final Model groundModel = modelBuilder.createRect(20f, 0f, -20f, -20f, 0f, -20f, -20f, 0f, 20f, 20f, 0f, 20f, 0, 1, 0,
new Material(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE),
FloatAttribute.createShininess(16f)),
Usage.Position | Usage.Normal);
disposables.add(groundModel);
final Model boxModel = modelBuilder.createBox(1f, 1f, 1f, new Material(ColorAttribute.createDiffuse(Color.WHITE),
ColorAttribute.createSpecular(Color.WHITE), FloatAttribute.createShininess(64f)), Usage.Position | Usage.Normal);
disposables.add(boxModel);
// Add the constructors
world.addConstructor("ground", new BulletConstructor(groundModel, 0f)); // mass = 0: static body
world.addConstructor("box", new BulletConstructor(boxModel, 1f)); // mass = 1kg: dynamic body
world.addConstructor("staticbox", new BulletConstructor(boxModel, 0f)); // mass = 0: static body
}
@Override
public void dispose () {
world.dispose();
world = null;
for (Disposable disposable : disposables)
disposable.dispose();
disposables.clear();
modelBatch.dispose();
modelBatch = null;
shadowBatch.dispose();
shadowBatch = null;
if (shadows) ((DirectionalShadowLight)light).dispose();
light = null;
super.dispose();
}
@Override
public void render () {
render(true);
}
public void render (boolean update) {
fpsCounter.put(Gdx.graphics.getFramesPerSecond());
if (update) update();
beginRender(true);
renderWorld();
Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
if (debugMode != DebugDrawModes.DBG_NoDebug) world.setDebugMode(debugMode);
Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
performance.setLength(0);
performance.append("FPS: ").append(fpsCounter.value).append(", Bullet: ")
.append((int)(performanceCounter.load.value * 100f)).append("%");
}
protected void beginRender (boolean lighting) {
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
camera.update();
}
protected void renderWorld () {
if (shadows) {
((DirectionalShadowLight)light).begin(Vector3.Zero, camera.direction);
shadowBatch.begin(((DirectionalShadowLight)light).getCamera());
world.render(shadowBatch, null);
shadowBatch.end();
((DirectionalShadowLight)light).end();
}
modelBatch.begin(camera);
world.render(modelBatch, environment);
modelBatch.end();
}
public void update () {
world.update();
}
public BulletEntity shoot (final float x, final float y) {
return shoot(x, y, 30f);
}
public BulletEntity shoot (final float x, final float y, final float impulse) {
return shoot("box", x, y, impulse);
}
public BulletEntity shoot (final String what, final float x, final float y, final float impulse) {
// Shoot a box
Ray ray = camera.getPickRay(x, y);
BulletEntity entity = world.add(what, ray.origin.x, ray.origin.y, ray.origin.z);
entity.setColor(0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.random(),
1f);
((btRigidBody)entity.body).applyCentralImpulse(ray.direction.scl(impulse));
return entity;
}
public void setDebugMode (final int mode) {
world.setDebugMode(debugMode = mode);
}
public void toggleDebugMode () {
if (world.getDebugMode() == DebugDrawModes.DBG_NoDebug)
setDebugMode(DebugDrawModes.DBG_DrawWireframe | DebugDrawModes.DBG_DrawFeaturesText | DebugDrawModes.DBG_DrawText
| DebugDrawModes.DBG_DrawContactPoints);
else if (world.renderMeshes)
world.renderMeshes = false;
else {
world.renderMeshes = true;
setDebugMode(DebugDrawModes.DBG_NoDebug);
}
}
@Override
public boolean longPress (float x, float y) {
toggleDebugMode();
return true;
}
@Override
public boolean keyUp (int keycode) {
if (keycode == Keys.ENTER) {
toggleDebugMode();
return true;
}
return super.keyUp(keycode);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/util/zip/InflaterInputStream.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package java.util.zip;
import java.io.IOException;
import java.io.InputStream;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.StreamUtils;
/** Dummy emulation. Throws a GdxRuntimeException on first read.
* @author hneuer */
public class InflaterInputStream extends InputStream {
private InputStream in;
public InflaterInputStream (InputStream in) {
this.in = in;
}
@Override
public int read () throws IOException {
throw new GdxRuntimeException("InflaterInputStream not supported in GWT");
}
@Override
public void close () throws IOException {
super.close();
StreamUtils.closeQuietly(in);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package java.util.zip;
import java.io.IOException;
import java.io.InputStream;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.StreamUtils;
/** Dummy emulation. Throws a GdxRuntimeException on first read.
* @author hneuer */
public class InflaterInputStream extends InputStream {
private InputStream in;
public InflaterInputStream (InputStream in) {
this.in = in;
}
@Override
public int read () throws IOException {
throw new GdxRuntimeException("InflaterInputStream not supported in GWT");
}
@Override
public void close () throws IOException {
super.close();
StreamUtils.closeQuietly(in);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/ClosestConvexResultCallback.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
public class ClosestConvexResultCallback extends ConvexResultCallback {
private long swigCPtr;
protected ClosestConvexResultCallback (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.ClosestConvexResultCallback_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new ClosestConvexResultCallback, normally you should not need this constructor it's intended for low-level
* usage. */
public ClosestConvexResultCallback (long cPtr, boolean cMemoryOwn) {
this("ClosestConvexResultCallback", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.ClosestConvexResultCallback_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (ClosestConvexResultCallback obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_ClosestConvexResultCallback(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
protected void swigDirectorDisconnect () {
swigCMemOwn = false;
delete();
}
public void swigReleaseOwnership () {
swigCMemOwn = false;
CollisionJNI.ClosestConvexResultCallback_change_ownership(this, swigCPtr, false);
}
public void swigTakeOwnership () {
swigCMemOwn = true;
CollisionJNI.ClosestConvexResultCallback_change_ownership(this, swigCPtr, true);
}
public ClosestConvexResultCallback (Vector3 convexFromWorld, Vector3 convexToWorld) {
this(CollisionJNI.new_ClosestConvexResultCallback(convexFromWorld, convexToWorld), true);
CollisionJNI.ClosestConvexResultCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
public void setConvexFromWorld (btVector3 value) {
CollisionJNI.ClosestConvexResultCallback_convexFromWorld_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getConvexFromWorld () {
long cPtr = CollisionJNI.ClosestConvexResultCallback_convexFromWorld_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setConvexToWorld (btVector3 value) {
CollisionJNI.ClosestConvexResultCallback_convexToWorld_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getConvexToWorld () {
long cPtr = CollisionJNI.ClosestConvexResultCallback_convexToWorld_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setHitCollisionObject (btCollisionObject value) {
CollisionJNI.ClosestConvexResultCallback_hitCollisionObject_set(swigCPtr, this, btCollisionObject.getCPtr(value), value);
}
public btCollisionObject getHitCollisionObject () {
return btCollisionObject.getInstance(CollisionJNI.ClosestConvexResultCallback_hitCollisionObject_get(swigCPtr, this),
false);
}
public float addSingleResult (LocalConvexResult convexResult, boolean normalInWorldSpace) {
return (getClass() == ClosestConvexResultCallback.class)
? CollisionJNI.ClosestConvexResultCallback_addSingleResult(swigCPtr, this, LocalConvexResult.getCPtr(convexResult),
convexResult, normalInWorldSpace)
: CollisionJNI.ClosestConvexResultCallback_addSingleResultSwigExplicitClosestConvexResultCallback(swigCPtr, this,
LocalConvexResult.getCPtr(convexResult), convexResult, normalInWorldSpace);
}
public void getConvexFromWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getConvexFromWorld(swigCPtr, this, out);
}
public void setRayFromWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setRayFromWorld(swigCPtr, this, value);
}
public void getConvexToWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getConvexToWorld(swigCPtr, this, out);
}
public void setConvexToWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setConvexToWorld(swigCPtr, this, value);
}
public void getHitNormalWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getHitNormalWorld(swigCPtr, this, out);
}
public void setHitNormalWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setHitNormalWorld(swigCPtr, this, value);
}
public void getHitPointWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getHitPointWorld(swigCPtr, this, out);
}
public void setHitPointWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setHitPointWorld(swigCPtr, this, value);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
public class ClosestConvexResultCallback extends ConvexResultCallback {
private long swigCPtr;
protected ClosestConvexResultCallback (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.ClosestConvexResultCallback_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new ClosestConvexResultCallback, normally you should not need this constructor it's intended for low-level
* usage. */
public ClosestConvexResultCallback (long cPtr, boolean cMemoryOwn) {
this("ClosestConvexResultCallback", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.ClosestConvexResultCallback_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (ClosestConvexResultCallback obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_ClosestConvexResultCallback(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
protected void swigDirectorDisconnect () {
swigCMemOwn = false;
delete();
}
public void swigReleaseOwnership () {
swigCMemOwn = false;
CollisionJNI.ClosestConvexResultCallback_change_ownership(this, swigCPtr, false);
}
public void swigTakeOwnership () {
swigCMemOwn = true;
CollisionJNI.ClosestConvexResultCallback_change_ownership(this, swigCPtr, true);
}
public ClosestConvexResultCallback (Vector3 convexFromWorld, Vector3 convexToWorld) {
this(CollisionJNI.new_ClosestConvexResultCallback(convexFromWorld, convexToWorld), true);
CollisionJNI.ClosestConvexResultCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
public void setConvexFromWorld (btVector3 value) {
CollisionJNI.ClosestConvexResultCallback_convexFromWorld_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getConvexFromWorld () {
long cPtr = CollisionJNI.ClosestConvexResultCallback_convexFromWorld_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setConvexToWorld (btVector3 value) {
CollisionJNI.ClosestConvexResultCallback_convexToWorld_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getConvexToWorld () {
long cPtr = CollisionJNI.ClosestConvexResultCallback_convexToWorld_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setHitCollisionObject (btCollisionObject value) {
CollisionJNI.ClosestConvexResultCallback_hitCollisionObject_set(swigCPtr, this, btCollisionObject.getCPtr(value), value);
}
public btCollisionObject getHitCollisionObject () {
return btCollisionObject.getInstance(CollisionJNI.ClosestConvexResultCallback_hitCollisionObject_get(swigCPtr, this),
false);
}
public float addSingleResult (LocalConvexResult convexResult, boolean normalInWorldSpace) {
return (getClass() == ClosestConvexResultCallback.class)
? CollisionJNI.ClosestConvexResultCallback_addSingleResult(swigCPtr, this, LocalConvexResult.getCPtr(convexResult),
convexResult, normalInWorldSpace)
: CollisionJNI.ClosestConvexResultCallback_addSingleResultSwigExplicitClosestConvexResultCallback(swigCPtr, this,
LocalConvexResult.getCPtr(convexResult), convexResult, normalInWorldSpace);
}
public void getConvexFromWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getConvexFromWorld(swigCPtr, this, out);
}
public void setRayFromWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setRayFromWorld(swigCPtr, this, value);
}
public void getConvexToWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getConvexToWorld(swigCPtr, this, out);
}
public void setConvexToWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setConvexToWorld(swigCPtr, this, value);
}
public void getHitNormalWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getHitNormalWorld(swigCPtr, this, out);
}
public void setHitNormalWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setHitNormalWorld(swigCPtr, this, value);
}
public void getHitPointWorld (Vector3 out) {
CollisionJNI.ClosestConvexResultCallback_getHitPointWorld(swigCPtr, this, out);
}
public void setHitPointWorld (Vector3 value) {
CollisionJNI.ClosestConvexResultCallback_setHitPointWorld(swigCPtr, this, value);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-tools/src/com/badlogic/gdx/tools/hiero/unicodefont/effects/FilterEffect.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tools.hiero.unicodefont.effects;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import com.badlogic.gdx.tools.hiero.unicodefont.Glyph;
import com.badlogic.gdx.tools.hiero.unicodefont.UnicodeFont;
/** Applys a {@link BufferedImageOp} filter to glyphs. Many filters can be fond here: http://www.jhlabs.com/ip/filters/index.html
* @author Nathan Sweet */
public class FilterEffect implements Effect {
private BufferedImageOp filter;
public FilterEffect () {
}
public FilterEffect (BufferedImageOp filter) {
this.filter = filter;
}
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
BufferedImage scratchImage = EffectUtil.getScratchImage();
filter.filter(image, scratchImage);
image.getGraphics().drawImage(scratchImage, 0, 0, null);
}
public BufferedImageOp getFilter () {
return filter;
}
public void setFilter (BufferedImageOp filter) {
this.filter = filter;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tools.hiero.unicodefont.effects;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import com.badlogic.gdx.tools.hiero.unicodefont.Glyph;
import com.badlogic.gdx.tools.hiero.unicodefont.UnicodeFont;
/** Applys a {@link BufferedImageOp} filter to glyphs. Many filters can be fond here: http://www.jhlabs.com/ip/filters/index.html
* @author Nathan Sweet */
public class FilterEffect implements Effect {
private BufferedImageOp filter;
public FilterEffect () {
}
public FilterEffect (BufferedImageOp filter) {
this.filter = filter;
}
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
BufferedImage scratchImage = EffectUtil.getScratchImage();
filter.filter(image, scratchImage);
image.getGraphics().drawImage(scratchImage, 0, 0, null);
}
public BufferedImageOp getFilter () {
return filter;
}
public void setFilter (BufferedImageOp filter) {
this.filter = filter;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/utils/BaseJsonReader.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils;
import java.io.InputStream;
import com.badlogic.gdx.files.FileHandle;
public interface BaseJsonReader {
JsonValue parse (InputStream input);
JsonValue parse (FileHandle file);
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils;
import java.io.InputStream;
import com.badlogic.gdx.files.FileHandle;
public interface BaseJsonReader {
JsonValue parse (InputStream input);
JsonValue parse (FileHandle file);
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btElement.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btElement extends BulletBase {
private long swigCPtr;
protected btElement (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btElement, normally you should not need this constructor it's intended for low-level usage. */
public btElement (long cPtr, boolean cMemoryOwn) {
this("btElement", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btElement obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btElement(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setId (int value) {
CollisionJNI.btElement_id_set(swigCPtr, this, value);
}
public int getId () {
return CollisionJNI.btElement_id_get(swigCPtr, this);
}
public void setSz (int value) {
CollisionJNI.btElement_sz_set(swigCPtr, this, value);
}
public int getSz () {
return CollisionJNI.btElement_sz_get(swigCPtr, this);
}
public btElement () {
this(CollisionJNI.new_btElement(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btElement extends BulletBase {
private long swigCPtr;
protected btElement (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btElement, normally you should not need this constructor it's intended for low-level usage. */
public btElement (long cPtr, boolean cMemoryOwn) {
this("btElement", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btElement obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btElement(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setId (int value) {
CollisionJNI.btElement_id_set(swigCPtr, this, value);
}
public int getId () {
return CollisionJNI.btElement_id_get(swigCPtr, this);
}
public void setSz (int value) {
CollisionJNI.btElement_sz_set(swigCPtr, this, value);
}
public int getSz () {
return CollisionJNI.btElement_sz_get(swigCPtr, this);
}
public btElement () {
this(CollisionJNI.new_btElement(), true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/google/gwt/webgl/client/WebGLShader.java | /*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.webgl.client;
public class WebGLShader extends WebGLObject {
protected WebGLShader () {
}
}
| /*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.webgl.client;
public class WebGLShader extends WebGLObject {
protected WebGLShader () {
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-tools/src/com/badlogic/gdx/tools/FileProcessor.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tools;
import com.badlogic.gdx.utils.Array;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.regex.Pattern;
/** Collects files recursively, filtering by file name. Callbacks are provided to process files and the results are collected,
* either {@link #processFile(Entry)} or {@link #processDir(Entry, ArrayList)} can be overridden, or both. The entries provided to
* the callbacks have the original file, the output directory, and the output file. If {@link #setFlattenOutput(boolean)} is
* false, the output will match the directory structure of the input.
* @author Nathan Sweet */
public class FileProcessor {
FilenameFilter inputFilter;
Comparator<File> comparator = new Comparator<File>() {
public int compare (File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
};
Array<Pattern> inputRegex = new Array();
String outputSuffix;
ArrayList<Entry> outputFiles = new ArrayList();
boolean recursive = true;
boolean flattenOutput;
Comparator<Entry> entryComparator = new Comparator<Entry>() {
public int compare (Entry o1, Entry o2) {
return comparator.compare(o1.inputFile, o2.inputFile);
}
};
public FileProcessor () {
}
/** Copy constructor. */
public FileProcessor (FileProcessor processor) {
inputFilter = processor.inputFilter;
comparator = processor.comparator;
inputRegex.addAll(processor.inputRegex);
outputSuffix = processor.outputSuffix;
recursive = processor.recursive;
flattenOutput = processor.flattenOutput;
}
public FileProcessor setInputFilter (FilenameFilter inputFilter) {
this.inputFilter = inputFilter;
return this;
}
/** Sets the comparator for {@link #processDir(Entry, ArrayList)}. By default the files are sorted by alpha. */
public FileProcessor setComparator (Comparator<File> comparator) {
this.comparator = comparator;
return this;
}
/** Adds a case insensitive suffix for matching input files. */
public FileProcessor addInputSuffix (String... suffixes) {
for (String suffix : suffixes)
addInputRegex("(?i).*" + Pattern.quote(suffix));
return this;
}
public FileProcessor addInputRegex (String... regexes) {
for (String regex : regexes)
inputRegex.add(Pattern.compile(regex));
return this;
}
/** Sets the suffix for output files, replacing the extension of the input file. */
public FileProcessor setOutputSuffix (String outputSuffix) {
this.outputSuffix = outputSuffix;
return this;
}
public FileProcessor setFlattenOutput (boolean flattenOutput) {
this.flattenOutput = flattenOutput;
return this;
}
/** Default is true. */
public FileProcessor setRecursive (boolean recursive) {
this.recursive = recursive;
return this;
}
/** @param outputRoot May be null.
* @see #process(File, File) */
public ArrayList<Entry> process (String inputFileOrDir, String outputRoot) throws Exception {
return process(new File(inputFileOrDir), outputRoot == null ? null : new File(outputRoot));
}
/** Processes the specified input file or directory.
* @param outputRoot May be null if there is no output from processing the files.
* @return the processed files added with {@link #addProcessedFile(Entry)}. */
public ArrayList<Entry> process (File inputFileOrDir, File outputRoot) throws Exception {
if (!inputFileOrDir.exists())
throw new IllegalArgumentException("Input file does not exist: " + inputFileOrDir.getAbsolutePath());
if (inputFileOrDir.isFile())
return process(new File[] {inputFileOrDir}, outputRoot);
else
return process(inputFileOrDir.listFiles(), outputRoot);
}
/** Processes the specified input files.
* @param outputRoot May be null if there is no output from processing the files.
* @return the processed files added with {@link #addProcessedFile(Entry)}. */
public ArrayList<Entry> process (File[] files, File outputRoot) throws Exception {
if (outputRoot == null) outputRoot = new File("");
outputFiles.clear();
LinkedHashMap<File, ArrayList<Entry>> dirToEntries = new LinkedHashMap();
process(files, outputRoot, outputRoot, dirToEntries, 0);
ArrayList<Entry> allEntries = new ArrayList();
for (java.util.Map.Entry<File, ArrayList<Entry>> mapEntry : dirToEntries.entrySet()) {
ArrayList<Entry> dirEntries = mapEntry.getValue();
if (comparator != null) Collections.sort(dirEntries, entryComparator);
File inputDir = mapEntry.getKey();
File newOutputDir = null;
if (flattenOutput)
newOutputDir = outputRoot;
else if (!dirEntries.isEmpty()) //
newOutputDir = dirEntries.get(0).outputDir;
String outputName = inputDir.getName();
if (outputSuffix != null) outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;
Entry entry = new Entry();
entry.inputFile = mapEntry.getKey();
entry.outputDir = newOutputDir;
if (newOutputDir != null)
entry.outputFile = newOutputDir.length() == 0 ? new File(outputName) : new File(newOutputDir, outputName);
try {
processDir(entry, dirEntries);
} catch (Exception ex) {
throw new Exception("Error processing directory: " + entry.inputFile.getAbsolutePath(), ex);
}
allEntries.addAll(dirEntries);
}
if (comparator != null) Collections.sort(allEntries, entryComparator);
for (Entry entry : allEntries) {
try {
processFile(entry);
} catch (Exception ex) {
throw new Exception("Error processing file: " + entry.inputFile.getAbsolutePath(), ex);
}
}
return outputFiles;
}
private void process (File[] files, File outputRoot, File outputDir, LinkedHashMap<File, ArrayList<Entry>> dirToEntries,
int depth) {
// Store empty entries for every directory.
for (File file : files) {
File dir = file.getParentFile();
ArrayList<Entry> entries = dirToEntries.get(dir);
if (entries == null) {
entries = new ArrayList();
dirToEntries.put(dir, entries);
}
}
for (File file : files) {
if (file.isFile()) {
if (inputRegex.size > 0) {
boolean found = false;
for (Pattern pattern : inputRegex) {
if (pattern.matcher(file.getName()).matches()) {
found = true;
break;
}
}
if (!found) continue;
}
File dir = file.getParentFile();
if (inputFilter != null && !inputFilter.accept(dir, file.getName())) continue;
String outputName = file.getName();
if (outputSuffix != null) outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;
Entry entry = new Entry();
entry.depth = depth;
entry.inputFile = file;
entry.outputDir = outputDir;
if (flattenOutput) {
entry.outputFile = new File(outputRoot, outputName);
} else {
entry.outputFile = new File(outputDir, outputName);
}
dirToEntries.get(dir).add(entry);
}
if (recursive && file.isDirectory()) {
File subdir = outputDir.getPath().length() == 0 ? new File(file.getName()) : new File(outputDir, file.getName());
process(file.listFiles(inputFilter), outputRoot, subdir, dirToEntries, depth + 1);
}
}
}
/** Called with each input file. */
protected void processFile (Entry entry) throws Exception {
}
/** Called for each input directory. The files will be {@link #setComparator(Comparator) sorted}. The specified files list can
* be modified to change which files are processed. */
protected void processDir (Entry entryDir, ArrayList<Entry> files) throws Exception {
}
/** This method should be called by {@link #processFile(Entry)} or {@link #processDir(Entry, ArrayList)} if the return value of
* {@link #process(File, File)} or {@link #process(File[], File)} should return all the processed files. */
protected void addProcessedFile (Entry entry) {
outputFiles.add(entry);
}
/** @author Nathan Sweet */
static public class Entry {
public File inputFile;
/** May be null. */
public File outputDir;
public File outputFile;
public int depth;
public Entry () {
}
public Entry (File inputFile, File outputFile) {
this.inputFile = inputFile;
this.outputFile = outputFile;
}
public String toString () {
return inputFile.toString();
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tools;
import com.badlogic.gdx.utils.Array;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.regex.Pattern;
/** Collects files recursively, filtering by file name. Callbacks are provided to process files and the results are collected,
* either {@link #processFile(Entry)} or {@link #processDir(Entry, ArrayList)} can be overridden, or both. The entries provided to
* the callbacks have the original file, the output directory, and the output file. If {@link #setFlattenOutput(boolean)} is
* false, the output will match the directory structure of the input.
* @author Nathan Sweet */
public class FileProcessor {
FilenameFilter inputFilter;
Comparator<File> comparator = new Comparator<File>() {
public int compare (File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
};
Array<Pattern> inputRegex = new Array();
String outputSuffix;
ArrayList<Entry> outputFiles = new ArrayList();
boolean recursive = true;
boolean flattenOutput;
Comparator<Entry> entryComparator = new Comparator<Entry>() {
public int compare (Entry o1, Entry o2) {
return comparator.compare(o1.inputFile, o2.inputFile);
}
};
public FileProcessor () {
}
/** Copy constructor. */
public FileProcessor (FileProcessor processor) {
inputFilter = processor.inputFilter;
comparator = processor.comparator;
inputRegex.addAll(processor.inputRegex);
outputSuffix = processor.outputSuffix;
recursive = processor.recursive;
flattenOutput = processor.flattenOutput;
}
public FileProcessor setInputFilter (FilenameFilter inputFilter) {
this.inputFilter = inputFilter;
return this;
}
/** Sets the comparator for {@link #processDir(Entry, ArrayList)}. By default the files are sorted by alpha. */
public FileProcessor setComparator (Comparator<File> comparator) {
this.comparator = comparator;
return this;
}
/** Adds a case insensitive suffix for matching input files. */
public FileProcessor addInputSuffix (String... suffixes) {
for (String suffix : suffixes)
addInputRegex("(?i).*" + Pattern.quote(suffix));
return this;
}
public FileProcessor addInputRegex (String... regexes) {
for (String regex : regexes)
inputRegex.add(Pattern.compile(regex));
return this;
}
/** Sets the suffix for output files, replacing the extension of the input file. */
public FileProcessor setOutputSuffix (String outputSuffix) {
this.outputSuffix = outputSuffix;
return this;
}
public FileProcessor setFlattenOutput (boolean flattenOutput) {
this.flattenOutput = flattenOutput;
return this;
}
/** Default is true. */
public FileProcessor setRecursive (boolean recursive) {
this.recursive = recursive;
return this;
}
/** @param outputRoot May be null.
* @see #process(File, File) */
public ArrayList<Entry> process (String inputFileOrDir, String outputRoot) throws Exception {
return process(new File(inputFileOrDir), outputRoot == null ? null : new File(outputRoot));
}
/** Processes the specified input file or directory.
* @param outputRoot May be null if there is no output from processing the files.
* @return the processed files added with {@link #addProcessedFile(Entry)}. */
public ArrayList<Entry> process (File inputFileOrDir, File outputRoot) throws Exception {
if (!inputFileOrDir.exists())
throw new IllegalArgumentException("Input file does not exist: " + inputFileOrDir.getAbsolutePath());
if (inputFileOrDir.isFile())
return process(new File[] {inputFileOrDir}, outputRoot);
else
return process(inputFileOrDir.listFiles(), outputRoot);
}
/** Processes the specified input files.
* @param outputRoot May be null if there is no output from processing the files.
* @return the processed files added with {@link #addProcessedFile(Entry)}. */
public ArrayList<Entry> process (File[] files, File outputRoot) throws Exception {
if (outputRoot == null) outputRoot = new File("");
outputFiles.clear();
LinkedHashMap<File, ArrayList<Entry>> dirToEntries = new LinkedHashMap();
process(files, outputRoot, outputRoot, dirToEntries, 0);
ArrayList<Entry> allEntries = new ArrayList();
for (java.util.Map.Entry<File, ArrayList<Entry>> mapEntry : dirToEntries.entrySet()) {
ArrayList<Entry> dirEntries = mapEntry.getValue();
if (comparator != null) Collections.sort(dirEntries, entryComparator);
File inputDir = mapEntry.getKey();
File newOutputDir = null;
if (flattenOutput)
newOutputDir = outputRoot;
else if (!dirEntries.isEmpty()) //
newOutputDir = dirEntries.get(0).outputDir;
String outputName = inputDir.getName();
if (outputSuffix != null) outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;
Entry entry = new Entry();
entry.inputFile = mapEntry.getKey();
entry.outputDir = newOutputDir;
if (newOutputDir != null)
entry.outputFile = newOutputDir.length() == 0 ? new File(outputName) : new File(newOutputDir, outputName);
try {
processDir(entry, dirEntries);
} catch (Exception ex) {
throw new Exception("Error processing directory: " + entry.inputFile.getAbsolutePath(), ex);
}
allEntries.addAll(dirEntries);
}
if (comparator != null) Collections.sort(allEntries, entryComparator);
for (Entry entry : allEntries) {
try {
processFile(entry);
} catch (Exception ex) {
throw new Exception("Error processing file: " + entry.inputFile.getAbsolutePath(), ex);
}
}
return outputFiles;
}
private void process (File[] files, File outputRoot, File outputDir, LinkedHashMap<File, ArrayList<Entry>> dirToEntries,
int depth) {
// Store empty entries for every directory.
for (File file : files) {
File dir = file.getParentFile();
ArrayList<Entry> entries = dirToEntries.get(dir);
if (entries == null) {
entries = new ArrayList();
dirToEntries.put(dir, entries);
}
}
for (File file : files) {
if (file.isFile()) {
if (inputRegex.size > 0) {
boolean found = false;
for (Pattern pattern : inputRegex) {
if (pattern.matcher(file.getName()).matches()) {
found = true;
break;
}
}
if (!found) continue;
}
File dir = file.getParentFile();
if (inputFilter != null && !inputFilter.accept(dir, file.getName())) continue;
String outputName = file.getName();
if (outputSuffix != null) outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;
Entry entry = new Entry();
entry.depth = depth;
entry.inputFile = file;
entry.outputDir = outputDir;
if (flattenOutput) {
entry.outputFile = new File(outputRoot, outputName);
} else {
entry.outputFile = new File(outputDir, outputName);
}
dirToEntries.get(dir).add(entry);
}
if (recursive && file.isDirectory()) {
File subdir = outputDir.getPath().length() == 0 ? new File(file.getName()) : new File(outputDir, file.getName());
process(file.listFiles(inputFilter), outputRoot, subdir, dirToEntries, depth + 1);
}
}
}
/** Called with each input file. */
protected void processFile (Entry entry) throws Exception {
}
/** Called for each input directory. The files will be {@link #setComparator(Comparator) sorted}. The specified files list can
* be modified to change which files are processed. */
protected void processDir (Entry entryDir, ArrayList<Entry> files) throws Exception {
}
/** This method should be called by {@link #processFile(Entry)} or {@link #processDir(Entry, ArrayList)} if the return value of
* {@link #process(File, File)} or {@link #process(File[], File)} should return all the processed files. */
protected void addProcessedFile (Entry entry) {
outputFiles.add(entry);
}
/** @author Nathan Sweet */
static public class Entry {
public File inputFile;
/** May be null. */
public File outputDir;
public File outputFile;
public int depth;
public Entry () {
}
public Entry (File inputFile, File outputFile) {
this.inputFile = inputFile;
this.outputFile = outputFile;
}
public String toString () {
return inputFile.toString();
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/custom/UIAccelerometerDelegate.java | /*
* Copyright (C) 2014 Trillian Mobile AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.badlogic.gdx.backends.iosrobovm.custom;
/*<imports>*/
import org.robovm.objc.annotation.*;
import org.robovm.apple.foundation.*;
/*</imports>*/
/*<javadoc>*/
/*</javadoc>*/
/*<annotations>*//*</annotations>*/
/*<visibility>*/public/* </visibility> */ interface /* <name> */ UIAccelerometerDelegate/* </name> */
/* <implements> */extends NSObjectProtocol/* </implements> */ {
/* <ptr> */
/* </ptr> */
/* <bind> */
/* </bind> */
/* <constants> *//* </constants> */
/* <properties> */
/* </properties> */
/* <methods> */
/** @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 5.0. */
@Deprecated
@Method(selector = "accelerometer:didAccelerate:")
void didAccelerate (UIAccelerometer accelerometer, UIAcceleration acceleration);
/* </methods> */
/* <adapter> */
/* </adapter> */
}
| /*
* Copyright (C) 2014 Trillian Mobile AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.badlogic.gdx.backends.iosrobovm.custom;
/*<imports>*/
import org.robovm.objc.annotation.*;
import org.robovm.apple.foundation.*;
/*</imports>*/
/*<javadoc>*/
/*</javadoc>*/
/*<annotations>*//*</annotations>*/
/*<visibility>*/public/* </visibility> */ interface /* <name> */ UIAccelerometerDelegate/* </name> */
/* <implements> */extends NSObjectProtocol/* </implements> */ {
/* <ptr> */
/* </ptr> */
/* <bind> */
/* </bind> */
/* <constants> *//* </constants> */
/* <properties> */
/* </properties> */
/* <methods> */
/** @since Available in iOS 2.0 and later.
* @deprecated Deprecated in iOS 5.0. */
@Deprecated
@Method(selector = "accelerometer:didAccelerate:")
void didAccelerate (UIAccelerometer accelerometer, UIAcceleration acceleration);
/* </methods> */
/* <adapter> */
/* </adapter> */
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/utils/compression/Lzma.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.compression;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/** Adapted from LZMA SDK version 9.22.
*
* This was modified to be used directly on streams, rather than via the command line as in the LZMA SDK.
*
* We only currently allow the default LZMA options to be used, as we know it works on for our target usage. */
public class Lzma {
static class CommandLine {
public static final int kEncode = 0;
public static final int kDecode = 1;
public static final int kBenchmak = 2;
public int Command = -1;
public int NumBenchmarkPasses = 10;
public int DictionarySize = 1 << 23;
public boolean DictionarySizeIsDefined = false;
public int Lc = 3;
public int Lp = 0;
public int Pb = 2;
public int Fb = 128;
public boolean FbIsDefined = false;
public boolean Eos = false;
public int Algorithm = 2;
public int MatchFinder = 1;
public String InFile;
public String OutFile;
}
/** Compresses the given {@link InputStream} into the given {@link OutputStream}.
*
* @param in the {@link InputStream} to compress
* @param out the {@link OutputStream} to compress to
* @throws IOException */
static public void compress (InputStream in, OutputStream out) throws IOException {
CommandLine params = new CommandLine();
boolean eos = false;
if (params.Eos) eos = true;
com.badlogic.gdx.utils.compression.lzma.Encoder encoder = new com.badlogic.gdx.utils.compression.lzma.Encoder();
if (!encoder.SetAlgorithm(params.Algorithm)) throw new RuntimeException("Incorrect compression mode");
if (!encoder.SetDictionarySize(params.DictionarySize)) throw new RuntimeException("Incorrect dictionary size");
if (!encoder.SetNumFastBytes(params.Fb)) throw new RuntimeException("Incorrect -fb value");
if (!encoder.SetMatchFinder(params.MatchFinder)) throw new RuntimeException("Incorrect -mf value");
if (!encoder.SetLcLpPb(params.Lc, params.Lp, params.Pb)) throw new RuntimeException("Incorrect -lc or -lp or -pb value");
encoder.SetEndMarkerMode(eos);
encoder.WriteCoderProperties(out);
long fileSize;
if (eos) {
fileSize = -1;
} else {
if ((fileSize = in.available()) == 0) {
fileSize = -1;
}
}
for (int i = 0; i < 8; i++) {
out.write((int)(fileSize >>> (8 * i)) & 0xFF);
}
encoder.Code(in, out, -1, -1, null);
}
/** Decompresses the given {@link InputStream} into the given {@link OutputStream}.
*
* @param in the {@link InputStream} to decompress
* @param out the {@link OutputStream} to decompress to
* @throws IOException */
static public void decompress (InputStream in, OutputStream out) throws IOException {
int propertiesSize = 5;
byte[] properties = new byte[propertiesSize];
if (in.read(properties, 0, propertiesSize) != propertiesSize) throw new RuntimeException("input .lzma file is too short");
com.badlogic.gdx.utils.compression.lzma.Decoder decoder = new com.badlogic.gdx.utils.compression.lzma.Decoder();
if (!decoder.SetDecoderProperties(properties)) throw new RuntimeException("Incorrect stream properties");
long outSize = 0;
for (int i = 0; i < 8; i++) {
int v = in.read();
if (v < 0) {
throw new RuntimeException("Can't read stream size");
}
outSize |= ((long)v) << (8 * i);
}
if (!decoder.Code(in, out, outSize)) {
throw new RuntimeException("Error in data stream");
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.compression;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/** Adapted from LZMA SDK version 9.22.
*
* This was modified to be used directly on streams, rather than via the command line as in the LZMA SDK.
*
* We only currently allow the default LZMA options to be used, as we know it works on for our target usage. */
public class Lzma {
static class CommandLine {
public static final int kEncode = 0;
public static final int kDecode = 1;
public static final int kBenchmak = 2;
public int Command = -1;
public int NumBenchmarkPasses = 10;
public int DictionarySize = 1 << 23;
public boolean DictionarySizeIsDefined = false;
public int Lc = 3;
public int Lp = 0;
public int Pb = 2;
public int Fb = 128;
public boolean FbIsDefined = false;
public boolean Eos = false;
public int Algorithm = 2;
public int MatchFinder = 1;
public String InFile;
public String OutFile;
}
/** Compresses the given {@link InputStream} into the given {@link OutputStream}.
*
* @param in the {@link InputStream} to compress
* @param out the {@link OutputStream} to compress to
* @throws IOException */
static public void compress (InputStream in, OutputStream out) throws IOException {
CommandLine params = new CommandLine();
boolean eos = false;
if (params.Eos) eos = true;
com.badlogic.gdx.utils.compression.lzma.Encoder encoder = new com.badlogic.gdx.utils.compression.lzma.Encoder();
if (!encoder.SetAlgorithm(params.Algorithm)) throw new RuntimeException("Incorrect compression mode");
if (!encoder.SetDictionarySize(params.DictionarySize)) throw new RuntimeException("Incorrect dictionary size");
if (!encoder.SetNumFastBytes(params.Fb)) throw new RuntimeException("Incorrect -fb value");
if (!encoder.SetMatchFinder(params.MatchFinder)) throw new RuntimeException("Incorrect -mf value");
if (!encoder.SetLcLpPb(params.Lc, params.Lp, params.Pb)) throw new RuntimeException("Incorrect -lc or -lp or -pb value");
encoder.SetEndMarkerMode(eos);
encoder.WriteCoderProperties(out);
long fileSize;
if (eos) {
fileSize = -1;
} else {
if ((fileSize = in.available()) == 0) {
fileSize = -1;
}
}
for (int i = 0; i < 8; i++) {
out.write((int)(fileSize >>> (8 * i)) & 0xFF);
}
encoder.Code(in, out, -1, -1, null);
}
/** Decompresses the given {@link InputStream} into the given {@link OutputStream}.
*
* @param in the {@link InputStream} to decompress
* @param out the {@link OutputStream} to decompress to
* @throws IOException */
static public void decompress (InputStream in, OutputStream out) throws IOException {
int propertiesSize = 5;
byte[] properties = new byte[propertiesSize];
if (in.read(properties, 0, propertiesSize) != propertiesSize) throw new RuntimeException("input .lzma file is too short");
com.badlogic.gdx.utils.compression.lzma.Decoder decoder = new com.badlogic.gdx.utils.compression.lzma.Decoder();
if (!decoder.SetDecoderProperties(properties)) throw new RuntimeException("Incorrect stream properties");
long outSize = 0;
for (int i = 0; i < 8; i++) {
int v = in.read();
if (v < 0) {
throw new RuntimeException("Can't read stream size");
}
outSize |= ((long)v) << (8 * i);
}
if (!decoder.Code(in, out, outSize)) {
throw new RuntimeException("Error in data stream");
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-setup/res/com/badlogic/gdx/setup/resources/android/res/values-v21/styles.xml | <?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<item name="android:colorBackground">@color/ic_background_color</item>
</style>
</resources>
| <?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<item name="android:colorBackground">@color/ic_background_color</item>
</style>
</resources>
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btHashMapInternalShortBtHashIntBtTriangleInfo.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btHashMapInternalShortBtHashIntBtTriangleInfo extends BulletBase {
private long swigCPtr;
protected btHashMapInternalShortBtHashIntBtTriangleInfo (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btHashMapInternalShortBtHashIntBtTriangleInfo, normally you should not need this constructor it's intended
* for low-level usage. */
public btHashMapInternalShortBtHashIntBtTriangleInfo (long cPtr, boolean cMemoryOwn) {
this("btHashMapInternalShortBtHashIntBtTriangleInfo", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btHashMapInternalShortBtHashIntBtTriangleInfo obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btHashMapInternalShortBtHashIntBtTriangleInfo(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void insert (btHashInt key, btTriangleInfo value) {
CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_insert(swigCPtr, this, btHashInt.getCPtr(key), key,
btTriangleInfo.getCPtr(value), value);
}
public void remove (btHashInt key) {
CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_remove(swigCPtr, this, btHashInt.getCPtr(key), key);
}
public int size () {
return CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_size(swigCPtr, this);
}
public btTriangleInfo getAtIndexConst (int index) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getAtIndexConst(swigCPtr, this, index);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo getAtIndex (int index) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getAtIndex(swigCPtr, this, index);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btHashInt getKeyAtIndex (int index) {
return new btHashInt(CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getKeyAtIndex(swigCPtr, this, index), true);
}
public btHashInt getKeyAtIndexConst (int index) {
return new btHashInt(CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getKeyAtIndexConst(swigCPtr, this, index),
true);
}
public btTriangleInfo operatorSubscript (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_operatorSubscript(swigCPtr, this,
btHashInt.getCPtr(key), key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo operatorSubscriptConst (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_operatorSubscriptConst(swigCPtr, this,
btHashInt.getCPtr(key), key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo findConst (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_findConst(swigCPtr, this, btHashInt.getCPtr(key),
key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo find (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_find(swigCPtr, this, btHashInt.getCPtr(key), key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public int findIndex (btHashInt key) {
return CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_findIndex(swigCPtr, this, btHashInt.getCPtr(key), key);
}
public void clear () {
CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_clear(swigCPtr, this);
}
public btHashMapInternalShortBtHashIntBtTriangleInfo () {
this(CollisionJNI.new_btHashMapInternalShortBtHashIntBtTriangleInfo(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btHashMapInternalShortBtHashIntBtTriangleInfo extends BulletBase {
private long swigCPtr;
protected btHashMapInternalShortBtHashIntBtTriangleInfo (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btHashMapInternalShortBtHashIntBtTriangleInfo, normally you should not need this constructor it's intended
* for low-level usage. */
public btHashMapInternalShortBtHashIntBtTriangleInfo (long cPtr, boolean cMemoryOwn) {
this("btHashMapInternalShortBtHashIntBtTriangleInfo", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btHashMapInternalShortBtHashIntBtTriangleInfo obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btHashMapInternalShortBtHashIntBtTriangleInfo(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void insert (btHashInt key, btTriangleInfo value) {
CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_insert(swigCPtr, this, btHashInt.getCPtr(key), key,
btTriangleInfo.getCPtr(value), value);
}
public void remove (btHashInt key) {
CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_remove(swigCPtr, this, btHashInt.getCPtr(key), key);
}
public int size () {
return CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_size(swigCPtr, this);
}
public btTriangleInfo getAtIndexConst (int index) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getAtIndexConst(swigCPtr, this, index);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo getAtIndex (int index) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getAtIndex(swigCPtr, this, index);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btHashInt getKeyAtIndex (int index) {
return new btHashInt(CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getKeyAtIndex(swigCPtr, this, index), true);
}
public btHashInt getKeyAtIndexConst (int index) {
return new btHashInt(CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_getKeyAtIndexConst(swigCPtr, this, index),
true);
}
public btTriangleInfo operatorSubscript (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_operatorSubscript(swigCPtr, this,
btHashInt.getCPtr(key), key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo operatorSubscriptConst (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_operatorSubscriptConst(swigCPtr, this,
btHashInt.getCPtr(key), key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo findConst (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_findConst(swigCPtr, this, btHashInt.getCPtr(key),
key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public btTriangleInfo find (btHashInt key) {
long cPtr = CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_find(swigCPtr, this, btHashInt.getCPtr(key), key);
return (cPtr == 0) ? null : new btTriangleInfo(cPtr, false);
}
public int findIndex (btHashInt key) {
return CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_findIndex(swigCPtr, this, btHashInt.getCPtr(key), key);
}
public void clear () {
CollisionJNI.btHashMapInternalShortBtHashIntBtTriangleInfo_clear(swigCPtr, this);
}
public btHashMapInternalShortBtHashIntBtTriangleInfo () {
this(CollisionJNI.new_btHashMapInternalShortBtHashIntBtTriangleInfo(), true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backend-robovm-metalangle/src/com/badlogic/gdx/backends/iosrobovm/IOSMusic.java | /*DO NOT EDIT THIS FILE - it is machine generated*/
package com.badlogic.gdx.backends.iosrobovm;
import org.robovm.apple.foundation.NSObject;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.backends.iosrobovm.objectal.AVAudioPlayerDelegateAdapter;
import com.badlogic.gdx.backends.iosrobovm.objectal.OALAudioTrack;
/** DO NOT EDIT THIS FILE - it is machine generated
* @author Niklas Therning */
public class IOSMusic implements Music {
private final OALAudioTrack track;
private final String filePath;
private boolean initialized;
private boolean looping;
OnCompletionListener onCompletionListener;
public IOSMusic (OALAudioTrack track, String filePath) {
this.track = track;
this.filePath = filePath;
this.track.setDelegate(new AVAudioPlayerDelegateAdapter() {
@Override
public void didFinishPlaying (NSObject player, boolean success) {
final OnCompletionListener listener = onCompletionListener;
if (listener != null) {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run () {
listener.onCompletion(IOSMusic.this);
}
});
}
}
});
}
@Override
public void play () {
if (track.isPaused()) {
track.setPaused(false);
} else if (!track.isPlaying()) {
// Check https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/AudioTrack/OALAudioTrack.m
// OALAudioTrack needs to execute preloadURL() once to store the file path. From then on we avoid
// calling it again to avoid instantiating a new AVAudioPlayer every time.
if (!initialized) {
if (!looping)
initialized = track.playFile(filePath);
else
initialized = track.playFile(filePath, -1);
if (!initialized) {
Gdx.app.error("IOSMusic", "Unable to initialize music " + filePath);
}
} else {
track.play();
}
}
}
@Override
public void pause () {
if (track.isPlaying()) {
track.setPaused(true);
}
}
@Override
public void stop () {
track.stop();
}
@Override
public boolean isPlaying () {
return track.isPlaying() && !track.isPaused();
}
@Override
public void setLooping (boolean isLooping) {
track.setNumberOfLoops(isLooping ? -1 : 0);
looping = isLooping;
}
@Override
public boolean isLooping () {
return track.getNumberOfLoops() == -1;
}
@Override
public void setVolume (float volume) {
track.setVolume(volume);
}
@Override
public void setPosition (float position) {
track.setCurrentTime(position);
}
@Override
public float getPosition () {
return (float)(track.getCurrentTime());
}
@Override
public void dispose () {
track.clear();
}
@Override
public float getVolume () {
return track.getVolume();
}
@Override
public void setPan (float pan, float volume) {
track.setPan(pan);
track.setVolume(volume);
}
@Override
public void setOnCompletionListener (OnCompletionListener listener) {
this.onCompletionListener = listener;
}
/** Calling this method preloads audio buffers and acquires the audio hardware necessary for playback. Can be noticeable on
* latency critical scenarios. Call with some time before {@link #play()}. */
public boolean preload () {
return initialized = track.preloadFile(filePath);
}
}
| /*DO NOT EDIT THIS FILE - it is machine generated*/
package com.badlogic.gdx.backends.iosrobovm;
import org.robovm.apple.foundation.NSObject;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.backends.iosrobovm.objectal.AVAudioPlayerDelegateAdapter;
import com.badlogic.gdx.backends.iosrobovm.objectal.OALAudioTrack;
/** DO NOT EDIT THIS FILE - it is machine generated
* @author Niklas Therning */
public class IOSMusic implements Music {
private final OALAudioTrack track;
private final String filePath;
private boolean initialized;
private boolean looping;
OnCompletionListener onCompletionListener;
public IOSMusic (OALAudioTrack track, String filePath) {
this.track = track;
this.filePath = filePath;
this.track.setDelegate(new AVAudioPlayerDelegateAdapter() {
@Override
public void didFinishPlaying (NSObject player, boolean success) {
final OnCompletionListener listener = onCompletionListener;
if (listener != null) {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run () {
listener.onCompletion(IOSMusic.this);
}
});
}
}
});
}
@Override
public void play () {
if (track.isPaused()) {
track.setPaused(false);
} else if (!track.isPlaying()) {
// Check https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/AudioTrack/OALAudioTrack.m
// OALAudioTrack needs to execute preloadURL() once to store the file path. From then on we avoid
// calling it again to avoid instantiating a new AVAudioPlayer every time.
if (!initialized) {
if (!looping)
initialized = track.playFile(filePath);
else
initialized = track.playFile(filePath, -1);
if (!initialized) {
Gdx.app.error("IOSMusic", "Unable to initialize music " + filePath);
}
} else {
track.play();
}
}
}
@Override
public void pause () {
if (track.isPlaying()) {
track.setPaused(true);
}
}
@Override
public void stop () {
track.stop();
}
@Override
public boolean isPlaying () {
return track.isPlaying() && !track.isPaused();
}
@Override
public void setLooping (boolean isLooping) {
track.setNumberOfLoops(isLooping ? -1 : 0);
looping = isLooping;
}
@Override
public boolean isLooping () {
return track.getNumberOfLoops() == -1;
}
@Override
public void setVolume (float volume) {
track.setVolume(volume);
}
@Override
public void setPosition (float position) {
track.setCurrentTime(position);
}
@Override
public float getPosition () {
return (float)(track.getCurrentTime());
}
@Override
public void dispose () {
track.clear();
}
@Override
public float getVolume () {
return track.getVolume();
}
@Override
public void setPan (float pan, float volume) {
track.setPan(pan);
track.setVolume(volume);
}
@Override
public void setOnCompletionListener (OnCompletionListener listener) {
this.onCompletionListener = listener;
}
/** Calling this method preloads audio buffers and acquires the audio hardware necessary for playback. Can be noticeable on
* latency critical scenarios. Call with some time before {@link #play()}. */
public boolean preload () {
return initialized = track.preloadFile(filePath);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests-android/src/com/badlogic/gdx/tests/android/WindowedTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.android;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.ScreenUtils;
public class WindowedTest extends AndroidApplication implements ApplicationListener {
Color color = new Color(1, 1, 1, 1);
public void onCreate (Bundle bundle) {
super.onCreate(bundle);
Button b1 = new Button(this);
b1.setText(getResources().getString(R.string.change_color));
b1.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Button b2 = new Button(this);
b2.setText(getResources().getString(R.string.new_window));
b2.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
View view = initializeForView(this);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(b1);
layout.addView(b2);
layout.addView(view, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
setContentView(layout);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick (View arg0) {
color.set((float)Math.random(), (float)Math.random(), (float)Math.random(), 1);
}
});
b2.setOnClickListener(new OnClickListener() {
@Override
public void onClick (View v) {
Intent intent = new Intent(WindowedTest.this, WindowedTest.class);
WindowedTest.this.startActivity(intent);
}
});
}
public void onPause () {
super.onPause();
}
@Override
public void onDestroy () {
super.onDestroy();
Log.w("WindowedTest", "destroying");
}
@Override
public void create () {
}
@Override
public void render () {
ScreenUtils.clear(color);
}
@Override
public void dispose () {
}
@Override
public void pause () {
}
@Override
public void resume () {
}
@Override
public void resize (int width, int height) {
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.android;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.ScreenUtils;
public class WindowedTest extends AndroidApplication implements ApplicationListener {
Color color = new Color(1, 1, 1, 1);
public void onCreate (Bundle bundle) {
super.onCreate(bundle);
Button b1 = new Button(this);
b1.setText(getResources().getString(R.string.change_color));
b1.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Button b2 = new Button(this);
b2.setText(getResources().getString(R.string.new_window));
b2.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
View view = initializeForView(this);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(b1);
layout.addView(b2);
layout.addView(view, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
setContentView(layout);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick (View arg0) {
color.set((float)Math.random(), (float)Math.random(), (float)Math.random(), 1);
}
});
b2.setOnClickListener(new OnClickListener() {
@Override
public void onClick (View v) {
Intent intent = new Intent(WindowedTest.this, WindowedTest.class);
WindowedTest.this.startActivity(intent);
}
});
}
public void onPause () {
super.onPause();
}
@Override
public void onDestroy () {
super.onDestroy();
Log.w("WindowedTest", "destroying");
}
@Override
public void create () {
}
@Override
public void render () {
ScreenUtils.clear(color);
}
@Override
public void dispose () {
}
@Override
public void pause () {
}
@Override
public void resume () {
}
@Override
public void resize (int width, int height) {
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/g2d/TextureRegion.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g2d;
import com.badlogic.gdx.graphics.Texture;
/** Defines a rectangular area of a texture. The coordinate system used has its origin in the upper left corner with the x-axis
* pointing to the right and the y axis pointing downwards.
* @author mzechner
* @author Nathan Sweet */
public class TextureRegion {
Texture texture;
float u, v;
float u2, v2;
int regionWidth, regionHeight;
/** Constructs a region that cannot be used until a texture and texture coordinates are set. */
public TextureRegion () {
}
/** Constructs a region the size of the specified texture. */
public TextureRegion (Texture texture) {
if (texture == null) throw new IllegalArgumentException("texture cannot be null.");
this.texture = texture;
setRegion(0, 0, texture.getWidth(), texture.getHeight());
}
/** @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public TextureRegion (Texture texture, int width, int height) {
this.texture = texture;
setRegion(0, 0, width, height);
}
/** @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public TextureRegion (Texture texture, int x, int y, int width, int height) {
this.texture = texture;
setRegion(x, y, width, height);
}
public TextureRegion (Texture texture, float u, float v, float u2, float v2) {
this.texture = texture;
setRegion(u, v, u2, v2);
}
/** Constructs a region with the same texture and coordinates of the specified region. */
public TextureRegion (TextureRegion region) {
setRegion(region);
}
/** Constructs a region with the same texture as the specified region and sets the coordinates relative to the specified
* region.
* @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public TextureRegion (TextureRegion region, int x, int y, int width, int height) {
setRegion(region, x, y, width, height);
}
/** Sets the texture and sets the coordinates to the size of the specified texture. */
public void setRegion (Texture texture) {
this.texture = texture;
setRegion(0, 0, texture.getWidth(), texture.getHeight());
}
/** @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public void setRegion (int x, int y, int width, int height) {
float invTexWidth = 1f / texture.getWidth();
float invTexHeight = 1f / texture.getHeight();
setRegion(x * invTexWidth, y * invTexHeight, (x + width) * invTexWidth, (y + height) * invTexHeight);
regionWidth = Math.abs(width);
regionHeight = Math.abs(height);
}
public void setRegion (float u, float v, float u2, float v2) {
int texWidth = texture.getWidth(), texHeight = texture.getHeight();
regionWidth = Math.round(Math.abs(u2 - u) * texWidth);
regionHeight = Math.round(Math.abs(v2 - v) * texHeight);
// For a 1x1 region, adjust UVs toward pixel center to avoid filtering artifacts on AMD GPUs when drawing very stretched.
if (regionWidth == 1 && regionHeight == 1) {
float adjustX = 0.25f / texWidth;
u += adjustX;
u2 -= adjustX;
float adjustY = 0.25f / texHeight;
v += adjustY;
v2 -= adjustY;
}
this.u = u;
this.v = v;
this.u2 = u2;
this.v2 = v2;
}
/** Sets the texture and coordinates to the specified region. */
public void setRegion (TextureRegion region) {
texture = region.texture;
setRegion(region.u, region.v, region.u2, region.v2);
}
/** Sets the texture to that of the specified region and sets the coordinates relative to the specified region. */
public void setRegion (TextureRegion region, int x, int y, int width, int height) {
texture = region.texture;
setRegion(region.getRegionX() + x, region.getRegionY() + y, width, height);
}
public Texture getTexture () {
return texture;
}
public void setTexture (Texture texture) {
this.texture = texture;
}
public float getU () {
return u;
}
public void setU (float u) {
this.u = u;
regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());
}
public float getV () {
return v;
}
public void setV (float v) {
this.v = v;
regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());
}
public float getU2 () {
return u2;
}
public void setU2 (float u2) {
this.u2 = u2;
regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());
}
public float getV2 () {
return v2;
}
public void setV2 (float v2) {
this.v2 = v2;
regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());
}
public int getRegionX () {
return Math.round(u * texture.getWidth());
}
public void setRegionX (int x) {
setU(x / (float)texture.getWidth());
}
public int getRegionY () {
return Math.round(v * texture.getHeight());
}
public void setRegionY (int y) {
setV(y / (float)texture.getHeight());
}
/** Returns the region's width. */
public int getRegionWidth () {
return regionWidth;
}
public void setRegionWidth (int width) {
if (isFlipX()) {
setU(u2 + width / (float)texture.getWidth());
} else {
setU2(u + width / (float)texture.getWidth());
}
}
/** Returns the region's height. */
public int getRegionHeight () {
return regionHeight;
}
public void setRegionHeight (int height) {
if (isFlipY()) {
setV(v2 + height / (float)texture.getHeight());
} else {
setV2(v + height / (float)texture.getHeight());
}
}
public void flip (boolean x, boolean y) {
if (x) {
float temp = u;
u = u2;
u2 = temp;
}
if (y) {
float temp = v;
v = v2;
v2 = temp;
}
}
public boolean isFlipX () {
return u > u2;
}
public boolean isFlipY () {
return v > v2;
}
/** Offsets the region relative to the current region. Generally the region's size should be the entire size of the texture in
* the direction(s) it is scrolled.
* @param xAmount The percentage to offset horizontally.
* @param yAmount The percentage to offset vertically. This is done in texture space, so up is negative. */
public void scroll (float xAmount, float yAmount) {
if (xAmount != 0) {
float width = (u2 - u) * texture.getWidth();
u = (u + xAmount) % 1;
u2 = u + width / texture.getWidth();
}
if (yAmount != 0) {
float height = (v2 - v) * texture.getHeight();
v = (v + yAmount) % 1;
v2 = v + height / texture.getHeight();
}
}
/** Helper method to create tiles out of this TextureRegion starting from the top left corner going to the right and ending at
* the bottom right corner. Only complete tiles will be returned so if the region's width or height are not a multiple of the
* tile width and height not all of the region will be used. This will not work on texture regions returned from a TextureAtlas
* that either have whitespace removed or where flipped before the region is split.
*
* @param tileWidth a tile's width in pixels
* @param tileHeight a tile's height in pixels
* @return a 2D array of TextureRegions indexed by [row][column]. */
public TextureRegion[][] split (int tileWidth, int tileHeight) {
int x = getRegionX();
int y = getRegionY();
int width = regionWidth;
int height = regionHeight;
int rows = height / tileHeight;
int cols = width / tileWidth;
int startX = x;
TextureRegion[][] tiles = new TextureRegion[rows][cols];
for (int row = 0; row < rows; row++, y += tileHeight) {
x = startX;
for (int col = 0; col < cols; col++, x += tileWidth) {
tiles[row][col] = new TextureRegion(texture, x, y, tileWidth, tileHeight);
}
}
return tiles;
}
/** Helper method to create tiles out of the given {@link Texture} starting from the top left corner going to the right and
* ending at the bottom right corner. Only complete tiles will be returned so if the texture's width or height are not a
* multiple of the tile width and height not all of the texture will be used.
*
* @param texture the Texture
* @param tileWidth a tile's width in pixels
* @param tileHeight a tile's height in pixels
* @return a 2D array of TextureRegions indexed by [row][column]. */
public static TextureRegion[][] split (Texture texture, int tileWidth, int tileHeight) {
TextureRegion region = new TextureRegion(texture);
return region.split(tileWidth, tileHeight);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g2d;
import com.badlogic.gdx.graphics.Texture;
/** Defines a rectangular area of a texture. The coordinate system used has its origin in the upper left corner with the x-axis
* pointing to the right and the y axis pointing downwards.
* @author mzechner
* @author Nathan Sweet */
public class TextureRegion {
Texture texture;
float u, v;
float u2, v2;
int regionWidth, regionHeight;
/** Constructs a region that cannot be used until a texture and texture coordinates are set. */
public TextureRegion () {
}
/** Constructs a region the size of the specified texture. */
public TextureRegion (Texture texture) {
if (texture == null) throw new IllegalArgumentException("texture cannot be null.");
this.texture = texture;
setRegion(0, 0, texture.getWidth(), texture.getHeight());
}
/** @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public TextureRegion (Texture texture, int width, int height) {
this.texture = texture;
setRegion(0, 0, width, height);
}
/** @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public TextureRegion (Texture texture, int x, int y, int width, int height) {
this.texture = texture;
setRegion(x, y, width, height);
}
public TextureRegion (Texture texture, float u, float v, float u2, float v2) {
this.texture = texture;
setRegion(u, v, u2, v2);
}
/** Constructs a region with the same texture and coordinates of the specified region. */
public TextureRegion (TextureRegion region) {
setRegion(region);
}
/** Constructs a region with the same texture as the specified region and sets the coordinates relative to the specified
* region.
* @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public TextureRegion (TextureRegion region, int x, int y, int width, int height) {
setRegion(region, x, y, width, height);
}
/** Sets the texture and sets the coordinates to the size of the specified texture. */
public void setRegion (Texture texture) {
this.texture = texture;
setRegion(0, 0, texture.getWidth(), texture.getHeight());
}
/** @param width The width of the texture region. May be negative to flip the sprite when drawn.
* @param height The height of the texture region. May be negative to flip the sprite when drawn. */
public void setRegion (int x, int y, int width, int height) {
float invTexWidth = 1f / texture.getWidth();
float invTexHeight = 1f / texture.getHeight();
setRegion(x * invTexWidth, y * invTexHeight, (x + width) * invTexWidth, (y + height) * invTexHeight);
regionWidth = Math.abs(width);
regionHeight = Math.abs(height);
}
public void setRegion (float u, float v, float u2, float v2) {
int texWidth = texture.getWidth(), texHeight = texture.getHeight();
regionWidth = Math.round(Math.abs(u2 - u) * texWidth);
regionHeight = Math.round(Math.abs(v2 - v) * texHeight);
// For a 1x1 region, adjust UVs toward pixel center to avoid filtering artifacts on AMD GPUs when drawing very stretched.
if (regionWidth == 1 && regionHeight == 1) {
float adjustX = 0.25f / texWidth;
u += adjustX;
u2 -= adjustX;
float adjustY = 0.25f / texHeight;
v += adjustY;
v2 -= adjustY;
}
this.u = u;
this.v = v;
this.u2 = u2;
this.v2 = v2;
}
/** Sets the texture and coordinates to the specified region. */
public void setRegion (TextureRegion region) {
texture = region.texture;
setRegion(region.u, region.v, region.u2, region.v2);
}
/** Sets the texture to that of the specified region and sets the coordinates relative to the specified region. */
public void setRegion (TextureRegion region, int x, int y, int width, int height) {
texture = region.texture;
setRegion(region.getRegionX() + x, region.getRegionY() + y, width, height);
}
public Texture getTexture () {
return texture;
}
public void setTexture (Texture texture) {
this.texture = texture;
}
public float getU () {
return u;
}
public void setU (float u) {
this.u = u;
regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());
}
public float getV () {
return v;
}
public void setV (float v) {
this.v = v;
regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());
}
public float getU2 () {
return u2;
}
public void setU2 (float u2) {
this.u2 = u2;
regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());
}
public float getV2 () {
return v2;
}
public void setV2 (float v2) {
this.v2 = v2;
regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());
}
public int getRegionX () {
return Math.round(u * texture.getWidth());
}
public void setRegionX (int x) {
setU(x / (float)texture.getWidth());
}
public int getRegionY () {
return Math.round(v * texture.getHeight());
}
public void setRegionY (int y) {
setV(y / (float)texture.getHeight());
}
/** Returns the region's width. */
public int getRegionWidth () {
return regionWidth;
}
public void setRegionWidth (int width) {
if (isFlipX()) {
setU(u2 + width / (float)texture.getWidth());
} else {
setU2(u + width / (float)texture.getWidth());
}
}
/** Returns the region's height. */
public int getRegionHeight () {
return regionHeight;
}
public void setRegionHeight (int height) {
if (isFlipY()) {
setV(v2 + height / (float)texture.getHeight());
} else {
setV2(v + height / (float)texture.getHeight());
}
}
public void flip (boolean x, boolean y) {
if (x) {
float temp = u;
u = u2;
u2 = temp;
}
if (y) {
float temp = v;
v = v2;
v2 = temp;
}
}
public boolean isFlipX () {
return u > u2;
}
public boolean isFlipY () {
return v > v2;
}
/** Offsets the region relative to the current region. Generally the region's size should be the entire size of the texture in
* the direction(s) it is scrolled.
* @param xAmount The percentage to offset horizontally.
* @param yAmount The percentage to offset vertically. This is done in texture space, so up is negative. */
public void scroll (float xAmount, float yAmount) {
if (xAmount != 0) {
float width = (u2 - u) * texture.getWidth();
u = (u + xAmount) % 1;
u2 = u + width / texture.getWidth();
}
if (yAmount != 0) {
float height = (v2 - v) * texture.getHeight();
v = (v + yAmount) % 1;
v2 = v + height / texture.getHeight();
}
}
/** Helper method to create tiles out of this TextureRegion starting from the top left corner going to the right and ending at
* the bottom right corner. Only complete tiles will be returned so if the region's width or height are not a multiple of the
* tile width and height not all of the region will be used. This will not work on texture regions returned from a TextureAtlas
* that either have whitespace removed or where flipped before the region is split.
*
* @param tileWidth a tile's width in pixels
* @param tileHeight a tile's height in pixels
* @return a 2D array of TextureRegions indexed by [row][column]. */
public TextureRegion[][] split (int tileWidth, int tileHeight) {
int x = getRegionX();
int y = getRegionY();
int width = regionWidth;
int height = regionHeight;
int rows = height / tileHeight;
int cols = width / tileWidth;
int startX = x;
TextureRegion[][] tiles = new TextureRegion[rows][cols];
for (int row = 0; row < rows; row++, y += tileHeight) {
x = startX;
for (int col = 0; col < cols; col++, x += tileWidth) {
tiles[row][col] = new TextureRegion(texture, x, y, tileWidth, tileHeight);
}
}
return tiles;
}
/** Helper method to create tiles out of the given {@link Texture} starting from the top left corner going to the right and
* ending at the bottom right corner. Only complete tiles will be returned so if the texture's width or height are not a
* multiple of the tile width and height not all of the texture will be used.
*
* @param texture the Texture
* @param tileWidth a tile's width in pixels
* @param tileHeight a tile's height in pixels
* @return a 2D array of TextureRegions indexed by [row][column]. */
public static TextureRegion[][] split (Texture texture, int tileWidth, int tileHeight) {
TextureRegion region = new TextureRegion(texture);
return region.split(tileWidth, tileHeight);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/CpuSpriteBatchTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.CpuSpriteBatch;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.TransformDrawable;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.viewport.ExtendViewport;
public class CpuSpriteBatchTest extends GdxTest {
private static class DrawableActor extends Actor {
private final TransformDrawable drawable;
public DrawableActor (TransformDrawable drawable) {
this.drawable = drawable;
setSize(drawable.getMinWidth(), drawable.getMinHeight());
}
public void draw (Batch batch, float parentAlpha) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, parentAlpha);
drawable.draw(batch, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(),
getRotation());
}
}
private static final int NUM_GROUPS = 1000;
private Stage stage;
private Texture texture;
private long sampleStartTime;
private long sampleFrames;
public void create () {
Batch batch = new CpuSpriteBatch();
// batch = new SpriteBatch();
stage = new Stage(new ExtendViewport(500, 500), batch);
Gdx.input.setInputProcessor(stage);
texture = new Texture("data/bobargb8888-32x32.png");
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegionDrawable drawable = new TextureRegionDrawable(new TextureRegion(texture));
for (int i = 0; i < NUM_GROUPS; i++) {
Group group = createActorGroup(drawable);
stage.addActor(group);
}
}
private Group createActorGroup (TextureRegionDrawable bob) {
Actor main = new DrawableActor(bob);
main.setPosition(0, 0, Align.center);
Actor hat = new DrawableActor(bob) {
@Override
public void act (float delta) {
rotateBy(delta * -300);
}
};
hat.setOrigin(Align.center);
hat.setScale(0.5f);
hat.setPosition(0, 21, Align.center);
Group group = new Group() {
@Override
public void act (float delta) {
rotateBy(delta * 120);
setScale(0.9f + 0.2f * MathUtils.cos(MathUtils.degreesToRadians * getRotation()));
super.act(delta);
}
};
group.addActor(main);
group.addActor(hat);
// group.setTransform(false);
float margin = 35;
float x = MathUtils.random(margin, stage.getWidth() - margin);
float y = MathUtils.random(margin, stage.getHeight() - margin);
group.setPosition(x, y);
group.setRotation(MathUtils.random(0, 360));
return group;
}
public void render () {
ScreenUtils.clear(0.5f, 0.5f, 0.5f, 1);
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
long now = TimeUtils.nanoTime();
sampleFrames++;
if (now - sampleStartTime > 1000000000) {
if (sampleStartTime != 0) {
int renderCalls = ((SpriteBatch)stage.getBatch()).renderCalls;
Gdx.app.log("CpuSpriteBatch", "FPS: " + sampleFrames + ", render calls: " + renderCalls);
}
sampleStartTime = now;
sampleFrames = 0;
}
}
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
public void dispose () {
stage.dispose();
texture.dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.CpuSpriteBatch;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.TransformDrawable;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.viewport.ExtendViewport;
public class CpuSpriteBatchTest extends GdxTest {
private static class DrawableActor extends Actor {
private final TransformDrawable drawable;
public DrawableActor (TransformDrawable drawable) {
this.drawable = drawable;
setSize(drawable.getMinWidth(), drawable.getMinHeight());
}
public void draw (Batch batch, float parentAlpha) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, parentAlpha);
drawable.draw(batch, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(),
getRotation());
}
}
private static final int NUM_GROUPS = 1000;
private Stage stage;
private Texture texture;
private long sampleStartTime;
private long sampleFrames;
public void create () {
Batch batch = new CpuSpriteBatch();
// batch = new SpriteBatch();
stage = new Stage(new ExtendViewport(500, 500), batch);
Gdx.input.setInputProcessor(stage);
texture = new Texture("data/bobargb8888-32x32.png");
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegionDrawable drawable = new TextureRegionDrawable(new TextureRegion(texture));
for (int i = 0; i < NUM_GROUPS; i++) {
Group group = createActorGroup(drawable);
stage.addActor(group);
}
}
private Group createActorGroup (TextureRegionDrawable bob) {
Actor main = new DrawableActor(bob);
main.setPosition(0, 0, Align.center);
Actor hat = new DrawableActor(bob) {
@Override
public void act (float delta) {
rotateBy(delta * -300);
}
};
hat.setOrigin(Align.center);
hat.setScale(0.5f);
hat.setPosition(0, 21, Align.center);
Group group = new Group() {
@Override
public void act (float delta) {
rotateBy(delta * 120);
setScale(0.9f + 0.2f * MathUtils.cos(MathUtils.degreesToRadians * getRotation()));
super.act(delta);
}
};
group.addActor(main);
group.addActor(hat);
// group.setTransform(false);
float margin = 35;
float x = MathUtils.random(margin, stage.getWidth() - margin);
float y = MathUtils.random(margin, stage.getHeight() - margin);
group.setPosition(x, y);
group.setRotation(MathUtils.random(0, 360));
return group;
}
public void render () {
ScreenUtils.clear(0.5f, 0.5f, 0.5f, 1);
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
long now = TimeUtils.nanoTime();
sampleFrames++;
if (now - sampleStartTime > 1000000000) {
if (sampleStartTime != 0) {
int renderCalls = ((SpriteBatch)stage.getBatch()).renderCalls;
Gdx.app.log("CpuSpriteBatch", "FPS: " + sampleFrames + ", render calls: " + renderCalls);
}
sampleStartTime = now;
sampleFrames = 0;
}
}
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
public void dispose () {
stage.dispose();
texture.dispose();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/scenes/scene2d/ui/ImageButton.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.ui;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Null;
import com.badlogic.gdx.utils.Scaling;
/** A button with a child {@link Image} to display an image. This is useful when the button must be larger than the image and the
* image centered on the button. If the image is the size of the button, a {@link Button} without any children can be used, where
* the {@link Button.ButtonStyle#up}, {@link Button.ButtonStyle#down}, and {@link Button.ButtonStyle#checked} nine patches define
* the image.
* @author Nathan Sweet */
public class ImageButton extends Button {
private final Image image;
private ImageButtonStyle style;
public ImageButton (Skin skin) {
this(skin.get(ImageButtonStyle.class));
setSkin(skin);
}
public ImageButton (Skin skin, String styleName) {
this(skin.get(styleName, ImageButtonStyle.class));
setSkin(skin);
}
public ImageButton (ImageButtonStyle style) {
super(style);
image = newImage();
add(image);
setStyle(style);
setSize(getPrefWidth(), getPrefHeight());
}
public ImageButton (@Null Drawable imageUp) {
this(new ImageButtonStyle(null, null, null, imageUp, null, null));
}
public ImageButton (@Null Drawable imageUp, @Null Drawable imageDown) {
this(new ImageButtonStyle(null, null, null, imageUp, imageDown, null));
}
public ImageButton (@Null Drawable imageUp, @Null Drawable imageDown, @Null Drawable imageChecked) {
this(new ImageButtonStyle(null, null, null, imageUp, imageDown, imageChecked));
}
protected Image newImage () {
return new Image((Drawable)null, Scaling.fit);
}
public void setStyle (ButtonStyle style) {
if (!(style instanceof ImageButtonStyle)) throw new IllegalArgumentException("style must be an ImageButtonStyle.");
this.style = (ImageButtonStyle)style;
super.setStyle(style);
if (image != null) updateImage();
}
public ImageButtonStyle getStyle () {
return style;
}
/** Returns the appropriate image drawable from the style based on the current button state. */
protected @Null Drawable getImageDrawable () {
if (isDisabled() && style.imageDisabled != null) return style.imageDisabled;
if (isPressed()) {
if (isChecked() && style.imageCheckedDown != null) return style.imageCheckedDown;
if (style.imageDown != null) return style.imageDown;
}
if (isOver()) {
if (isChecked()) {
if (style.imageCheckedOver != null) return style.imageCheckedOver;
} else {
if (style.imageOver != null) return style.imageOver;
}
}
if (isChecked()) {
if (style.imageChecked != null) return style.imageChecked;
if (isOver() && style.imageOver != null) return style.imageOver;
}
return style.imageUp;
}
/** Sets the image drawable based on the current button state. The default implementation sets the image drawable using
* {@link #getImageDrawable()}. */
protected void updateImage () {
image.setDrawable(getImageDrawable());
}
public void draw (Batch batch, float parentAlpha) {
updateImage();
super.draw(batch, parentAlpha);
}
public Image getImage () {
return image;
}
public Cell getImageCell () {
return getCell(image);
}
public String toString () {
String name = getName();
if (name != null) return name;
String className = getClass().getName();
int dotIndex = className.lastIndexOf('.');
if (dotIndex != -1) className = className.substring(dotIndex + 1);
return (className.indexOf('$') != -1 ? "ImageButton " : "") + className + ": " + image.getDrawable();
}
/** The style for an image button, see {@link ImageButton}.
* @author Nathan Sweet */
static public class ImageButtonStyle extends ButtonStyle {
public @Null Drawable imageUp, imageDown, imageOver, imageDisabled;
public @Null Drawable imageChecked, imageCheckedDown, imageCheckedOver;
public ImageButtonStyle () {
}
public ImageButtonStyle (@Null Drawable up, @Null Drawable down, @Null Drawable checked, @Null Drawable imageUp,
@Null Drawable imageDown, @Null Drawable imageChecked) {
super(up, down, checked);
this.imageUp = imageUp;
this.imageDown = imageDown;
this.imageChecked = imageChecked;
}
public ImageButtonStyle (ImageButtonStyle style) {
super(style);
imageUp = style.imageUp;
imageDown = style.imageDown;
imageOver = style.imageOver;
imageDisabled = style.imageDisabled;
imageChecked = style.imageChecked;
imageCheckedDown = style.imageCheckedDown;
imageCheckedOver = style.imageCheckedOver;
}
public ImageButtonStyle (ButtonStyle style) {
super(style);
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.ui;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Null;
import com.badlogic.gdx.utils.Scaling;
/** A button with a child {@link Image} to display an image. This is useful when the button must be larger than the image and the
* image centered on the button. If the image is the size of the button, a {@link Button} without any children can be used, where
* the {@link Button.ButtonStyle#up}, {@link Button.ButtonStyle#down}, and {@link Button.ButtonStyle#checked} nine patches define
* the image.
* @author Nathan Sweet */
public class ImageButton extends Button {
private final Image image;
private ImageButtonStyle style;
public ImageButton (Skin skin) {
this(skin.get(ImageButtonStyle.class));
setSkin(skin);
}
public ImageButton (Skin skin, String styleName) {
this(skin.get(styleName, ImageButtonStyle.class));
setSkin(skin);
}
public ImageButton (ImageButtonStyle style) {
super(style);
image = newImage();
add(image);
setStyle(style);
setSize(getPrefWidth(), getPrefHeight());
}
public ImageButton (@Null Drawable imageUp) {
this(new ImageButtonStyle(null, null, null, imageUp, null, null));
}
public ImageButton (@Null Drawable imageUp, @Null Drawable imageDown) {
this(new ImageButtonStyle(null, null, null, imageUp, imageDown, null));
}
public ImageButton (@Null Drawable imageUp, @Null Drawable imageDown, @Null Drawable imageChecked) {
this(new ImageButtonStyle(null, null, null, imageUp, imageDown, imageChecked));
}
protected Image newImage () {
return new Image((Drawable)null, Scaling.fit);
}
public void setStyle (ButtonStyle style) {
if (!(style instanceof ImageButtonStyle)) throw new IllegalArgumentException("style must be an ImageButtonStyle.");
this.style = (ImageButtonStyle)style;
super.setStyle(style);
if (image != null) updateImage();
}
public ImageButtonStyle getStyle () {
return style;
}
/** Returns the appropriate image drawable from the style based on the current button state. */
protected @Null Drawable getImageDrawable () {
if (isDisabled() && style.imageDisabled != null) return style.imageDisabled;
if (isPressed()) {
if (isChecked() && style.imageCheckedDown != null) return style.imageCheckedDown;
if (style.imageDown != null) return style.imageDown;
}
if (isOver()) {
if (isChecked()) {
if (style.imageCheckedOver != null) return style.imageCheckedOver;
} else {
if (style.imageOver != null) return style.imageOver;
}
}
if (isChecked()) {
if (style.imageChecked != null) return style.imageChecked;
if (isOver() && style.imageOver != null) return style.imageOver;
}
return style.imageUp;
}
/** Sets the image drawable based on the current button state. The default implementation sets the image drawable using
* {@link #getImageDrawable()}. */
protected void updateImage () {
image.setDrawable(getImageDrawable());
}
public void draw (Batch batch, float parentAlpha) {
updateImage();
super.draw(batch, parentAlpha);
}
public Image getImage () {
return image;
}
public Cell getImageCell () {
return getCell(image);
}
public String toString () {
String name = getName();
if (name != null) return name;
String className = getClass().getName();
int dotIndex = className.lastIndexOf('.');
if (dotIndex != -1) className = className.substring(dotIndex + 1);
return (className.indexOf('$') != -1 ? "ImageButton " : "") + className + ": " + image.getDrawable();
}
/** The style for an image button, see {@link ImageButton}.
* @author Nathan Sweet */
static public class ImageButtonStyle extends ButtonStyle {
public @Null Drawable imageUp, imageDown, imageOver, imageDisabled;
public @Null Drawable imageChecked, imageCheckedDown, imageCheckedOver;
public ImageButtonStyle () {
}
public ImageButtonStyle (@Null Drawable up, @Null Drawable down, @Null Drawable checked, @Null Drawable imageUp,
@Null Drawable imageDown, @Null Drawable imageChecked) {
super(up, down, checked);
this.imageUp = imageUp;
this.imageDown = imageDown;
this.imageChecked = imageChecked;
}
public ImageButtonStyle (ImageButtonStyle style) {
super(style);
imageUp = style.imageUp;
imageDown = style.imageDown;
imageOver = style.imageOver;
imageDisabled = style.imageDisabled;
imageChecked = style.imageChecked;
imageCheckedDown = style.imageCheckedDown;
imageCheckedOver = style.imageCheckedOver;
}
public ImageButtonStyle (ButtonStyle style) {
super(style);
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/TangentialAccelerationTest.java |
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
import com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch;
import com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier.TangentialAcceleration;
import com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer;
import com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Array;
/** @author ryanastout */
public class TangentialAccelerationTest extends BaseG3dTest {
public static final String DEFAULT_PARTICLE = "data/pre_particle.png", DEFAULT_SKIN = "data/uiskin.json";
Quaternion tmpQuaternion = new Quaternion();
Matrix4 tmpMatrix = new Matrix4(), tmpMatrix4 = new Matrix4();
Vector3 tmpVector = new Vector3();
// Simulation
Array<ParticleController> emitters;
// Rendering
Environment environment;
BillboardParticleBatch billboardParticleBatch;
// UI
Stage ui;
Label fpsLabel;
StringBuilder builder;
@Override
public void create () {
super.create();
emitters = new Array<ParticleController>();
assets.load(DEFAULT_PARTICLE, Texture.class);
assets.load(DEFAULT_SKIN, Skin.class);
loading = true;
environment = new Environment();
billboardParticleBatch = new BillboardParticleBatch();
billboardParticleBatch.setCamera(cam);
ui = new Stage();
builder = new StringBuilder();
}
@Override
public void resize (int width, int height) {
super.resize(width, height);
ui.getViewport().setWorldSize(width, height);
ui.getViewport().update(width, height, true);
}
@Override
protected void onLoaded () {
Texture particleTexture = assets.get(DEFAULT_PARTICLE);
billboardParticleBatch.setTexture(assets.get(DEFAULT_PARTICLE, Texture.class));
addEmitter(particleTexture);
setupUI();
}
private void addEmitter (Texture particleTexture) {
ParticleController controller = createBillboardController(particleTexture);
controller.init();
controller.start();
emitters.add(controller);
controller.translate(new Vector3(5, 0, 5));
controller.rotate(new Vector3(.707f, .707f, 0), 135);
}
private void setupUI () {
Skin skin = assets.get(DEFAULT_SKIN);
Table table = new Table();
table.setFillParent(true);
table.top().left().add(new Label("FPS ", skin)).left();
table.add(fpsLabel = new Label("", skin)).left().expandX().row();
ui.addActor(table);
}
private ParticleController createBillboardController (Texture particleTexture) {
// Emission
RegularEmitter emitter = new RegularEmitter();
emitter.getDuration().setLow(3000);
emitter.getEmission().setHigh(300);
emitter.getLife().setHigh(4000);
emitter.setMaxParticleCount(3000);
// Spawn
CylinderSpawnShapeValue cylinderSpawnShapeValue = new CylinderSpawnShapeValue();
cylinderSpawnShapeValue.spawnWidthValue.setHigh(5);// x
cylinderSpawnShapeValue.spawnHeightValue.setHigh(10);// y
cylinderSpawnShapeValue.spawnDepthValue.setHigh(5);// z
cylinderSpawnShapeValue.setEdges(true);
SpawnInfluencer spawnSource = new SpawnInfluencer(cylinderSpawnShapeValue);
// Dynamics
DynamicsInfluencer dynamicsInfluencer = new DynamicsInfluencer();
TangentialAcceleration tangentialAcceleration = new TangentialAcceleration();
tangentialAcceleration.thetaValue.setActive(true);
tangentialAcceleration.thetaValue.setTimeline(new float[] {0});
tangentialAcceleration.thetaValue.setScaling(new float[] {1});
tangentialAcceleration.thetaValue.setHigh(90);
tangentialAcceleration.phiValue.setActive(true);
tangentialAcceleration.phiValue.setTimeline(new float[] {0});
tangentialAcceleration.phiValue.setScaling(new float[] {1});
tangentialAcceleration.phiValue.setHigh(0);
tangentialAcceleration.strengthValue.setActive(true);
tangentialAcceleration.strengthValue.setHigh(10);
tangentialAcceleration.strengthValue.setTimeline(new float[] {0});
tangentialAcceleration.strengthValue.setScaling(new float[] {1});
tangentialAcceleration.isGlobal = false;
dynamicsInfluencer.velocities.add(tangentialAcceleration);
ParticleController ret = new ParticleController("Billboard Controller", emitter,
new BillboardRenderer(billboardParticleBatch), new RegionInfluencer.Single(particleTexture), spawnSource,
dynamicsInfluencer);
return ret;
}
@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
if (emitters.size > 0) {
// Update
float delta = Gdx.graphics.getDeltaTime();
builder.delete(0, builder.length());
builder.append(Gdx.graphics.getFramesPerSecond());
fpsLabel.setText(builder);
ui.act(delta);
billboardParticleBatch.begin();
for (ParticleController controller : emitters) {
controller.update();
controller.draw();
}
billboardParticleBatch.end();
batch.render(billboardParticleBatch, environment);
}
batch.render(instances, environment);
ui.draw();
}
}
|
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
import com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch;
import com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier.TangentialAcceleration;
import com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer;
import com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Array;
/** @author ryanastout */
public class TangentialAccelerationTest extends BaseG3dTest {
public static final String DEFAULT_PARTICLE = "data/pre_particle.png", DEFAULT_SKIN = "data/uiskin.json";
Quaternion tmpQuaternion = new Quaternion();
Matrix4 tmpMatrix = new Matrix4(), tmpMatrix4 = new Matrix4();
Vector3 tmpVector = new Vector3();
// Simulation
Array<ParticleController> emitters;
// Rendering
Environment environment;
BillboardParticleBatch billboardParticleBatch;
// UI
Stage ui;
Label fpsLabel;
StringBuilder builder;
@Override
public void create () {
super.create();
emitters = new Array<ParticleController>();
assets.load(DEFAULT_PARTICLE, Texture.class);
assets.load(DEFAULT_SKIN, Skin.class);
loading = true;
environment = new Environment();
billboardParticleBatch = new BillboardParticleBatch();
billboardParticleBatch.setCamera(cam);
ui = new Stage();
builder = new StringBuilder();
}
@Override
public void resize (int width, int height) {
super.resize(width, height);
ui.getViewport().setWorldSize(width, height);
ui.getViewport().update(width, height, true);
}
@Override
protected void onLoaded () {
Texture particleTexture = assets.get(DEFAULT_PARTICLE);
billboardParticleBatch.setTexture(assets.get(DEFAULT_PARTICLE, Texture.class));
addEmitter(particleTexture);
setupUI();
}
private void addEmitter (Texture particleTexture) {
ParticleController controller = createBillboardController(particleTexture);
controller.init();
controller.start();
emitters.add(controller);
controller.translate(new Vector3(5, 0, 5));
controller.rotate(new Vector3(.707f, .707f, 0), 135);
}
private void setupUI () {
Skin skin = assets.get(DEFAULT_SKIN);
Table table = new Table();
table.setFillParent(true);
table.top().left().add(new Label("FPS ", skin)).left();
table.add(fpsLabel = new Label("", skin)).left().expandX().row();
ui.addActor(table);
}
private ParticleController createBillboardController (Texture particleTexture) {
// Emission
RegularEmitter emitter = new RegularEmitter();
emitter.getDuration().setLow(3000);
emitter.getEmission().setHigh(300);
emitter.getLife().setHigh(4000);
emitter.setMaxParticleCount(3000);
// Spawn
CylinderSpawnShapeValue cylinderSpawnShapeValue = new CylinderSpawnShapeValue();
cylinderSpawnShapeValue.spawnWidthValue.setHigh(5);// x
cylinderSpawnShapeValue.spawnHeightValue.setHigh(10);// y
cylinderSpawnShapeValue.spawnDepthValue.setHigh(5);// z
cylinderSpawnShapeValue.setEdges(true);
SpawnInfluencer spawnSource = new SpawnInfluencer(cylinderSpawnShapeValue);
// Dynamics
DynamicsInfluencer dynamicsInfluencer = new DynamicsInfluencer();
TangentialAcceleration tangentialAcceleration = new TangentialAcceleration();
tangentialAcceleration.thetaValue.setActive(true);
tangentialAcceleration.thetaValue.setTimeline(new float[] {0});
tangentialAcceleration.thetaValue.setScaling(new float[] {1});
tangentialAcceleration.thetaValue.setHigh(90);
tangentialAcceleration.phiValue.setActive(true);
tangentialAcceleration.phiValue.setTimeline(new float[] {0});
tangentialAcceleration.phiValue.setScaling(new float[] {1});
tangentialAcceleration.phiValue.setHigh(0);
tangentialAcceleration.strengthValue.setActive(true);
tangentialAcceleration.strengthValue.setHigh(10);
tangentialAcceleration.strengthValue.setTimeline(new float[] {0});
tangentialAcceleration.strengthValue.setScaling(new float[] {1});
tangentialAcceleration.isGlobal = false;
dynamicsInfluencer.velocities.add(tangentialAcceleration);
ParticleController ret = new ParticleController("Billboard Controller", emitter,
new BillboardRenderer(billboardParticleBatch), new RegionInfluencer.Single(particleTexture), spawnSource,
dynamicsInfluencer);
return ret;
}
@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
if (emitters.size > 0) {
// Update
float delta = Gdx.graphics.getDeltaTime();
builder.delete(0, builder.length());
builder.append(Gdx.graphics.getFramesPerSecond());
fpsLabel.setText(builder);
ui.act(delta);
billboardParticleBatch.begin();
for (ParticleController controller : emitters) {
controller.update();
controller.draw();
}
billboardParticleBatch.end();
batch.render(billboardParticleBatch, environment);
}
batch.render(instances, environment);
ui.draw();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/assets/loaders/SoundLoader.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.assets.loaders;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetLoaderParameters;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
/** {@link AssetLoader} to load {@link Sound} instances.
* @author mzechner */
public class SoundLoader extends AsynchronousAssetLoader<Sound, SoundLoader.SoundParameter> {
private Sound sound;
public SoundLoader (FileHandleResolver resolver) {
super(resolver);
}
/** Returns the {@link Sound} instance currently loaded by this {@link SoundLoader}.
*
* @return the currently loaded {@link Sound}, otherwise {@code null} if no {@link Sound} has been loaded yet. */
protected Sound getLoadedSound () {
return sound;
}
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle file, SoundParameter parameter) {
sound = Gdx.audio.newSound(file);
}
@Override
public Sound loadSync (AssetManager manager, String fileName, FileHandle file, SoundParameter parameter) {
Sound sound = this.sound;
this.sound = null;
return sound;
}
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, SoundParameter parameter) {
return null;
}
static public class SoundParameter extends AssetLoaderParameters<Sound> {
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.assets.loaders;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetLoaderParameters;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
/** {@link AssetLoader} to load {@link Sound} instances.
* @author mzechner */
public class SoundLoader extends AsynchronousAssetLoader<Sound, SoundLoader.SoundParameter> {
private Sound sound;
public SoundLoader (FileHandleResolver resolver) {
super(resolver);
}
/** Returns the {@link Sound} instance currently loaded by this {@link SoundLoader}.
*
* @return the currently loaded {@link Sound}, otherwise {@code null} if no {@link Sound} has been loaded yet. */
protected Sound getLoadedSound () {
return sound;
}
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle file, SoundParameter parameter) {
sound = Gdx.audio.newSound(file);
}
@Override
public Sound loadSync (AssetManager manager, String fileName, FileHandle file, SoundParameter parameter) {
Sound sound = this.sound;
this.sound = null;
return sound;
}
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, SoundParameter parameter) {
return null;
}
static public class SoundParameter extends AssetLoaderParameters<Sound> {
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/utils/reflect/Field.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.reflect;
import com.badlogic.gwtref.client.Type;
/** Provides information about, and access to, a single field of a class or interface.
* @author nexsoftware */
public final class Field {
private final com.badlogic.gwtref.client.Field field;
Field (com.badlogic.gwtref.client.Field field) {
this.field = field;
}
/** Returns the name of the field. */
public String getName () {
return field.getName();
}
/** Returns a Class object that identifies the declared type for the field. */
public Class getType () {
return field.getType().getClassOfType();
}
/** Returns the Class object representing the class or interface that declares the field. */
public Class getDeclaringClass () {
return field.getEnclosingType().getClassOfType();
}
public boolean isAccessible () {
return field.isPublic();
}
public void setAccessible (boolean accessible) {
// NOOP in GWT
}
/** Return true if the field does not include any of the {@code private}, {@code protected}, or {@code public} modifiers. */
public boolean isDefaultAccess () {
return !isPrivate() && !isProtected() && !isPublic();
}
/** Return true if the field includes the {@code final} modifier. */
public boolean isFinal () {
return field.isFinal();
}
/** Return true if the field includes the {@code private} modifier. */
public boolean isPrivate () {
return field.isPrivate();
}
/** Return true if the field includes the {@code protected} modifier. */
public boolean isProtected () {
return field.isProtected();
}
/** Return true if the field includes the {@code public} modifier. */
public boolean isPublic () {
return field.isPublic();
}
/** Return true if the field includes the {@code static} modifier. */
public boolean isStatic () {
return field.isStatic();
}
/** Return true if the field includes the {@code transient} modifier. */
public boolean isTransient () {
return field.isTransient();
}
/** Return true if the field includes the {@code volatile} modifier. */
public boolean isVolatile () {
return field.isVolatile();
}
/** Return true if the field is a synthetic field. */
public boolean isSynthetic () {
return field.isSynthetic();
}
/** If the type of the field is parameterized, returns the Class object representing the parameter type at the specified index,
* null otherwise. */
public Class getElementType (int index) {
Type elementType = field.getElementType(index);
return elementType != null ? elementType.getClassOfType() : null;
}
/** Returns true if the field includes an annotation of the provided class type. */
public boolean isAnnotationPresent (Class<? extends java.lang.annotation.Annotation> annotationType) {
java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
for (java.lang.annotation.Annotation annotation : annotations) {
if (annotation.annotationType().equals(annotationType)) {
return true;
}
}
return false;
}
/** Returns an array of {@link Annotation} objects reflecting all annotations declared by this field, or an empty array if
* there are none. Does not include inherited annotations. */
public Annotation[] getDeclaredAnnotations () {
java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
Annotation[] result = new Annotation[annotations.length];
for (int i = 0; i < annotations.length; i++) {
result[i] = new Annotation(annotations[i]);
}
return result;
}
/** Returns an {@link Annotation} object reflecting the annotation provided, or null of this field doesn't have such an
* annotation. This is a convenience function if the caller knows already which annotation type he's looking for. */
public Annotation getDeclaredAnnotation (Class<? extends java.lang.annotation.Annotation> annotationType) {
java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
for (java.lang.annotation.Annotation annotation : annotations) {
if (annotation.annotationType().equals(annotationType)) {
return new Annotation(annotation);
}
}
return null;
}
/** Returns the value of the field on the supplied object. */
public Object get (Object obj) throws ReflectionException {
try {
return field.get(obj);
} catch (IllegalArgumentException e) {
throw new ReflectionException("Could not get " + getDeclaringClass() + "#" + getName() + ": " + e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new ReflectionException("Illegal access to field " + getName() + ": " + e.getMessage(), e);
}
}
/** Sets the value of the field on the supplied object. */
public void set (Object obj, Object value) throws ReflectionException {
try {
field.set(obj, value);
} catch (IllegalArgumentException e) {
throw new ReflectionException("Could not set " + getDeclaringClass() + "#" + getName() + ": " + e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new ReflectionException("Illegal access to field " + getName() + ": " + e.getMessage(), e);
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.reflect;
import com.badlogic.gwtref.client.Type;
/** Provides information about, and access to, a single field of a class or interface.
* @author nexsoftware */
public final class Field {
private final com.badlogic.gwtref.client.Field field;
Field (com.badlogic.gwtref.client.Field field) {
this.field = field;
}
/** Returns the name of the field. */
public String getName () {
return field.getName();
}
/** Returns a Class object that identifies the declared type for the field. */
public Class getType () {
return field.getType().getClassOfType();
}
/** Returns the Class object representing the class or interface that declares the field. */
public Class getDeclaringClass () {
return field.getEnclosingType().getClassOfType();
}
public boolean isAccessible () {
return field.isPublic();
}
public void setAccessible (boolean accessible) {
// NOOP in GWT
}
/** Return true if the field does not include any of the {@code private}, {@code protected}, or {@code public} modifiers. */
public boolean isDefaultAccess () {
return !isPrivate() && !isProtected() && !isPublic();
}
/** Return true if the field includes the {@code final} modifier. */
public boolean isFinal () {
return field.isFinal();
}
/** Return true if the field includes the {@code private} modifier. */
public boolean isPrivate () {
return field.isPrivate();
}
/** Return true if the field includes the {@code protected} modifier. */
public boolean isProtected () {
return field.isProtected();
}
/** Return true if the field includes the {@code public} modifier. */
public boolean isPublic () {
return field.isPublic();
}
/** Return true if the field includes the {@code static} modifier. */
public boolean isStatic () {
return field.isStatic();
}
/** Return true if the field includes the {@code transient} modifier. */
public boolean isTransient () {
return field.isTransient();
}
/** Return true if the field includes the {@code volatile} modifier. */
public boolean isVolatile () {
return field.isVolatile();
}
/** Return true if the field is a synthetic field. */
public boolean isSynthetic () {
return field.isSynthetic();
}
/** If the type of the field is parameterized, returns the Class object representing the parameter type at the specified index,
* null otherwise. */
public Class getElementType (int index) {
Type elementType = field.getElementType(index);
return elementType != null ? elementType.getClassOfType() : null;
}
/** Returns true if the field includes an annotation of the provided class type. */
public boolean isAnnotationPresent (Class<? extends java.lang.annotation.Annotation> annotationType) {
java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
for (java.lang.annotation.Annotation annotation : annotations) {
if (annotation.annotationType().equals(annotationType)) {
return true;
}
}
return false;
}
/** Returns an array of {@link Annotation} objects reflecting all annotations declared by this field, or an empty array if
* there are none. Does not include inherited annotations. */
public Annotation[] getDeclaredAnnotations () {
java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
Annotation[] result = new Annotation[annotations.length];
for (int i = 0; i < annotations.length; i++) {
result[i] = new Annotation(annotations[i]);
}
return result;
}
/** Returns an {@link Annotation} object reflecting the annotation provided, or null of this field doesn't have such an
* annotation. This is a convenience function if the caller knows already which annotation type he's looking for. */
public Annotation getDeclaredAnnotation (Class<? extends java.lang.annotation.Annotation> annotationType) {
java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
for (java.lang.annotation.Annotation annotation : annotations) {
if (annotation.annotationType().equals(annotationType)) {
return new Annotation(annotation);
}
}
return null;
}
/** Returns the value of the field on the supplied object. */
public Object get (Object obj) throws ReflectionException {
try {
return field.get(obj);
} catch (IllegalArgumentException e) {
throw new ReflectionException("Could not get " + getDeclaringClass() + "#" + getName() + ": " + e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new ReflectionException("Illegal access to field " + getName() + ": " + e.getMessage(), e);
}
}
/** Sets the value of the field on the supplied object. */
public void set (Object obj, Object value) throws ReflectionException {
try {
field.set(obj, value);
} catch (IllegalArgumentException e) {
throw new ReflectionException("Could not set " + getDeclaringClass() + "#" + getName() + ": " + e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new ReflectionException("Illegal access to field " + getName() + ": " + e.getMessage(), e);
}
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/g3d/particles/values/RangedNumericValue.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles.values;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonValue;
/** A value which has a defined minimum and maximum bounds.
* @author Inferno */
public class RangedNumericValue extends ParticleValue {
private float lowMin, lowMax;
public float newLowValue () {
return lowMin + (lowMax - lowMin) * MathUtils.random();
}
public void setLow (float value) {
lowMin = value;
lowMax = value;
}
public void setLow (float min, float max) {
lowMin = min;
lowMax = max;
}
public float getLowMin () {
return lowMin;
}
public void setLowMin (float lowMin) {
this.lowMin = lowMin;
}
public float getLowMax () {
return lowMax;
}
public void setLowMax (float lowMax) {
this.lowMax = lowMax;
}
public void load (RangedNumericValue value) {
super.load(value);
lowMax = value.lowMax;
lowMin = value.lowMin;
}
@Override
public void write (Json json) {
super.write(json);
json.writeValue("lowMin", lowMin);
json.writeValue("lowMax", lowMax);
}
@Override
public void read (Json json, JsonValue jsonData) {
super.read(json, jsonData);
lowMin = json.readValue("lowMin", float.class, jsonData);
lowMax = json.readValue("lowMax", float.class, jsonData);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.particles.values;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonValue;
/** A value which has a defined minimum and maximum bounds.
* @author Inferno */
public class RangedNumericValue extends ParticleValue {
private float lowMin, lowMax;
public float newLowValue () {
return lowMin + (lowMax - lowMin) * MathUtils.random();
}
public void setLow (float value) {
lowMin = value;
lowMax = value;
}
public void setLow (float min, float max) {
lowMin = min;
lowMax = max;
}
public float getLowMin () {
return lowMin;
}
public void setLowMin (float lowMin) {
this.lowMin = lowMin;
}
public float getLowMax () {
return lowMax;
}
public void setLowMax (float lowMax) {
this.lowMax = lowMax;
}
public void load (RangedNumericValue value) {
super.load(value);
lowMax = value.lowMax;
lowMin = value.lowMin;
}
@Override
public void write (Json json) {
super.write(json);
json.writeValue("lowMin", lowMin);
json.writeValue("lowMax", lowMax);
}
@Override
public void read (Json json, JsonValue jsonData) {
super.read(json, jsonData);
lowMin = json.readValue("lowMin", float.class, jsonData);
lowMax = json.readValue("lowMax", float.class, jsonData);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/avian/Utf8.java | /* Copyright (c) 2010, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package avian;
import java.io.ByteArrayOutputStream;
public class Utf8 {
public static boolean test (Object data) {
if (!(data instanceof byte[])) return false;
byte[] b = (byte[])data;
for (int i = 0; i < b.length; ++i) {
if (((int)b[i] & 0x080) != 0) return true;
}
return false;
}
public static byte[] encode (char[] s16, int offset, int length) {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
for (int i = offset; i < offset + length; ++i) {
char c = s16[i];
if (c == '\u0000') { // null char
buf.write(0);
buf.write(0);
} else if (c < 0x080) { // 1 byte char
buf.write(c);
} else if (c < 0x0800) { // 2 byte char
buf.write(0x0c0 | (c >>> 6));
buf.write(0x080 | (c & 0x03f));
} else { // 3 byte char
buf.write(0x0e0 | ((c >>> 12) & 0x0f));
buf.write(0x080 | ((c >>> 6) & 0x03f));
buf.write(0x080 | (c & 0x03f));
}
}
return buf.toByteArray();
}
public static Object decode (byte[] s8, int offset, int length) {
Object buf = new byte[length];
boolean isMultiByte = false;
int i = offset, j = 0;
while (i < offset + length) {
int x = s8[i++];
if ((x & 0x080) == 0x0) { // 1 byte char
if (x == 0) ++i; // 2 byte null char
cram(buf, j++, x);
} else if ((x & 0x0e0) == 0x0c0) { // 2 byte char
if (!isMultiByte) {
buf = widen(buf, j, length - 1);
isMultiByte = true;
}
int y = s8[i++];
cram(buf, j++, ((x & 0x1f) << 6) | (y & 0x3f));
} else if ((x & 0x0f0) == 0x0e0) { // 3 byte char
if (!isMultiByte) {
buf = widen(buf, j, length - 2);
isMultiByte = true;
}
int y = s8[i++];
int z = s8[i++];
cram(buf, j++, ((x & 0xf) << 12) | ((y & 0x3f) << 6) | (z & 0x3f));
}
}
return trim(buf, j);
}
public static char[] decode16 (byte[] s8, int offset, int length) {
Object decoded = decode(s8, offset, length);
if (decoded instanceof char[]) return (char[])decoded;
return (char[])widen(decoded, length, length);
}
private static void cram (Object data, int index, int val) {
if (data instanceof byte[])
((byte[])data)[index] = (byte)val;
else
((char[])data)[index] = (char)val;
}
private static Object widen (Object data, int length, int capacity) {
byte[] src = (byte[])data;
char[] result = new char[capacity];
for (int i = 0; i < length; ++i)
result[i] = (char)((int)src[i] & 0x0ff);
return result;
}
private static Object trim (Object data, int length) {
if (data instanceof byte[]) return data;
if (((char[])data).length == length) return data;
char[] result = new char[length];
System.arraycopy(data, 0, result, 0, length);
return result;
}
}
| /* Copyright (c) 2010, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package avian;
import java.io.ByteArrayOutputStream;
public class Utf8 {
public static boolean test (Object data) {
if (!(data instanceof byte[])) return false;
byte[] b = (byte[])data;
for (int i = 0; i < b.length; ++i) {
if (((int)b[i] & 0x080) != 0) return true;
}
return false;
}
public static byte[] encode (char[] s16, int offset, int length) {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
for (int i = offset; i < offset + length; ++i) {
char c = s16[i];
if (c == '\u0000') { // null char
buf.write(0);
buf.write(0);
} else if (c < 0x080) { // 1 byte char
buf.write(c);
} else if (c < 0x0800) { // 2 byte char
buf.write(0x0c0 | (c >>> 6));
buf.write(0x080 | (c & 0x03f));
} else { // 3 byte char
buf.write(0x0e0 | ((c >>> 12) & 0x0f));
buf.write(0x080 | ((c >>> 6) & 0x03f));
buf.write(0x080 | (c & 0x03f));
}
}
return buf.toByteArray();
}
public static Object decode (byte[] s8, int offset, int length) {
Object buf = new byte[length];
boolean isMultiByte = false;
int i = offset, j = 0;
while (i < offset + length) {
int x = s8[i++];
if ((x & 0x080) == 0x0) { // 1 byte char
if (x == 0) ++i; // 2 byte null char
cram(buf, j++, x);
} else if ((x & 0x0e0) == 0x0c0) { // 2 byte char
if (!isMultiByte) {
buf = widen(buf, j, length - 1);
isMultiByte = true;
}
int y = s8[i++];
cram(buf, j++, ((x & 0x1f) << 6) | (y & 0x3f));
} else if ((x & 0x0f0) == 0x0e0) { // 3 byte char
if (!isMultiByte) {
buf = widen(buf, j, length - 2);
isMultiByte = true;
}
int y = s8[i++];
int z = s8[i++];
cram(buf, j++, ((x & 0xf) << 12) | ((y & 0x3f) << 6) | (z & 0x3f));
}
}
return trim(buf, j);
}
public static char[] decode16 (byte[] s8, int offset, int length) {
Object decoded = decode(s8, offset, length);
if (decoded instanceof char[]) return (char[])decoded;
return (char[])widen(decoded, length, length);
}
private static void cram (Object data, int index, int val) {
if (data instanceof byte[])
((byte[])data)[index] = (byte)val;
else
((char[])data)[index] = (char)val;
}
private static Object widen (Object data, int length, int capacity) {
byte[] src = (byte[])data;
char[] result = new char[capacity];
for (int i = 0; i < length; ++i)
result[i] = (char)((int)src[i] & 0x0ff);
return result;
}
private static Object trim (Object data, int length) {
if (data instanceof byte[]) return data;
if (((char[])data).length == length) return data;
char[] result = new char[length];
System.arraycopy(data, 0, result, 0, length);
return result;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/com/badlogic/gdx/physics/box2d/joints/PulleyJointDef.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d.joints;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.JointDef;
/** Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a
* pulley ratio. */
public class PulleyJointDef extends JointDef {
private final static float minPulleyLength = 2.0f;
public PulleyJointDef () {
type = JointType.PulleyJoint;
collideConnected = true;
}
/** Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 groundAnchorA, Vector2 groundAnchorB, Vector2 anchorA, Vector2 anchorB,
float ratio) {
this.bodyA = bodyA;
this.bodyB = bodyB;
this.groundAnchorA.set(groundAnchorA);
this.groundAnchorB.set(groundAnchorB);
this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
lengthA = anchorA.dst(groundAnchorA);
lengthB = anchorB.dst(groundAnchorB);
this.ratio = ratio;
float C = lengthA + ratio * lengthB;
}
/** The first ground anchor in world coordinates. This point never moves. */
public final Vector2 groundAnchorA = new Vector2(-1, 1);
/** The second ground anchor in world coordinates. This point never moves. */
public final Vector2 groundAnchorB = new Vector2(1, 1);
/** The local anchor point relative to bodyA's origin. */
public final Vector2 localAnchorA = new Vector2(-1, 0);
/** The local anchor point relative to bodyB's origin. */
public final Vector2 localAnchorB = new Vector2(1, 0);
/** The a reference length for the segment attached to bodyA. */
public float lengthA = 0;
/** The a reference length for the segment attached to bodyB. */
public float lengthB = 0;
/** The pulley ratio, used to simulate a block-and-tackle. */
public float ratio = 1;
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
org.jbox2d.dynamics.joints.PulleyJointDef jd = new org.jbox2d.dynamics.joints.PulleyJointDef();
jd.bodyA = bodyA.body;
jd.bodyB = bodyB.body;
jd.collideConnected = collideConnected;
jd.groundAnchorA.set(groundAnchorA.x, groundAnchorB.y);
jd.groundAnchorB.set(groundAnchorB.x, groundAnchorB.y);
jd.lengthA = lengthA;
jd.lengthB = lengthB;
jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
jd.ratio = ratio;
jd.type = org.jbox2d.dynamics.joints.JointType.PULLEY;
return jd;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d.joints;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.JointDef;
/** Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a
* pulley ratio. */
public class PulleyJointDef extends JointDef {
private final static float minPulleyLength = 2.0f;
public PulleyJointDef () {
type = JointType.PulleyJoint;
collideConnected = true;
}
/** Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 groundAnchorA, Vector2 groundAnchorB, Vector2 anchorA, Vector2 anchorB,
float ratio) {
this.bodyA = bodyA;
this.bodyB = bodyB;
this.groundAnchorA.set(groundAnchorA);
this.groundAnchorB.set(groundAnchorB);
this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
lengthA = anchorA.dst(groundAnchorA);
lengthB = anchorB.dst(groundAnchorB);
this.ratio = ratio;
float C = lengthA + ratio * lengthB;
}
/** The first ground anchor in world coordinates. This point never moves. */
public final Vector2 groundAnchorA = new Vector2(-1, 1);
/** The second ground anchor in world coordinates. This point never moves. */
public final Vector2 groundAnchorB = new Vector2(1, 1);
/** The local anchor point relative to bodyA's origin. */
public final Vector2 localAnchorA = new Vector2(-1, 0);
/** The local anchor point relative to bodyB's origin. */
public final Vector2 localAnchorB = new Vector2(1, 0);
/** The a reference length for the segment attached to bodyA. */
public float lengthA = 0;
/** The a reference length for the segment attached to bodyB. */
public float lengthB = 0;
/** The pulley ratio, used to simulate a block-and-tackle. */
public float ratio = 1;
@Override
public org.jbox2d.dynamics.joints.JointDef toJBox2d () {
org.jbox2d.dynamics.joints.PulleyJointDef jd = new org.jbox2d.dynamics.joints.PulleyJointDef();
jd.bodyA = bodyA.body;
jd.bodyB = bodyB.body;
jd.collideConnected = collideConnected;
jd.groundAnchorA.set(groundAnchorA.x, groundAnchorB.y);
jd.groundAnchorB.set(groundAnchorB.x, groundAnchorB.y);
jd.lengthA = lengthA;
jd.lengthB = lengthB;
jd.localAnchorA.set(localAnchorA.x, localAnchorA.y);
jd.localAnchorB.set(localAnchorB.x, localAnchorB.y);
jd.ratio = ratio;
jd.type = org.jbox2d.dynamics.joints.JointType.PULLEY;
return jd;
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/theme/chrome/public/gwt/chrome/images/ie6/hborder_blue_shadow.png | PNG
IHDR 8A bKGD pHYs tIME02 &GO #IDATcx&tܹs{1100 X
IENDB` | PNG
IHDR 8A bKGD pHYs tIME02 &GO #IDATcx&tܹs{1100 X
IENDB` | -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btOptimizedBvhNodeDoubleData.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btOptimizedBvhNodeDoubleData extends BulletBase {
private long swigCPtr;
protected btOptimizedBvhNodeDoubleData (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btOptimizedBvhNodeDoubleData, normally you should not need this constructor it's intended for low-level
* usage. */
public btOptimizedBvhNodeDoubleData (long cPtr, boolean cMemoryOwn) {
this("btOptimizedBvhNodeDoubleData", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btOptimizedBvhNodeDoubleData obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btOptimizedBvhNodeDoubleData(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setAabbMinOrg (btVector3DoubleData value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMinOrg_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getAabbMinOrg () {
long cPtr = CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMinOrg_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setAabbMaxOrg (btVector3DoubleData value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMaxOrg_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getAabbMaxOrg () {
long cPtr = CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMaxOrg_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setEscapeIndex (int value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_escapeIndex_set(swigCPtr, this, value);
}
public int getEscapeIndex () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_escapeIndex_get(swigCPtr, this);
}
public void setSubPart (int value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_subPart_set(swigCPtr, this, value);
}
public int getSubPart () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_subPart_get(swigCPtr, this);
}
public void setTriangleIndex (int value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_triangleIndex_set(swigCPtr, this, value);
}
public int getTriangleIndex () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_triangleIndex_get(swigCPtr, this);
}
public void setPad (String value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_pad_set(swigCPtr, this, value);
}
public String getPad () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_pad_get(swigCPtr, this);
}
public btOptimizedBvhNodeDoubleData () {
this(CollisionJNI.new_btOptimizedBvhNodeDoubleData(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class btOptimizedBvhNodeDoubleData extends BulletBase {
private long swigCPtr;
protected btOptimizedBvhNodeDoubleData (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btOptimizedBvhNodeDoubleData, normally you should not need this constructor it's intended for low-level
* usage. */
public btOptimizedBvhNodeDoubleData (long cPtr, boolean cMemoryOwn) {
this("btOptimizedBvhNodeDoubleData", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btOptimizedBvhNodeDoubleData obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btOptimizedBvhNodeDoubleData(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setAabbMinOrg (btVector3DoubleData value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMinOrg_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getAabbMinOrg () {
long cPtr = CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMinOrg_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setAabbMaxOrg (btVector3DoubleData value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMaxOrg_set(swigCPtr, this, btVector3DoubleData.getCPtr(value), value);
}
public btVector3DoubleData getAabbMaxOrg () {
long cPtr = CollisionJNI.btOptimizedBvhNodeDoubleData_aabbMaxOrg_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3DoubleData(cPtr, false);
}
public void setEscapeIndex (int value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_escapeIndex_set(swigCPtr, this, value);
}
public int getEscapeIndex () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_escapeIndex_get(swigCPtr, this);
}
public void setSubPart (int value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_subPart_set(swigCPtr, this, value);
}
public int getSubPart () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_subPart_get(swigCPtr, this);
}
public void setTriangleIndex (int value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_triangleIndex_set(swigCPtr, this, value);
}
public int getTriangleIndex () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_triangleIndex_get(swigCPtr, this);
}
public void setPad (String value) {
CollisionJNI.btOptimizedBvhNodeDoubleData_pad_set(swigCPtr, this, value);
}
public String getPad () {
return CollisionJNI.btOptimizedBvhNodeDoubleData_pad_get(swigCPtr, this);
}
public btOptimizedBvhNodeDoubleData () {
this(CollisionJNI.new_btOptimizedBvhNodeDoubleData(), true);
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/src/bullet/BulletSoftBody/btSoftBodyData.h | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_SOFTBODY_FLOAT_DATA
#define BT_SOFTBODY_FLOAT_DATA
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
struct SoftBodyMaterialData
{
float m_linearStiffness;
float m_angularStiffness;
float m_volumeStiffness;
int m_flags;
};
struct SoftBodyNodeData
{
SoftBodyMaterialData *m_material;
btVector3FloatData m_position;
btVector3FloatData m_previousPosition;
btVector3FloatData m_velocity;
btVector3FloatData m_accumulatedForce;
btVector3FloatData m_normal;
float m_inverseMass;
float m_area;
int m_attach;
int m_pad;
};
struct SoftBodyLinkData
{
SoftBodyMaterialData *m_material;
int m_nodeIndices[2]; // Node pointers
float m_restLength; // Rest length
int m_bbending; // Bending link
};
struct SoftBodyFaceData
{
btVector3FloatData m_normal; // Normal
SoftBodyMaterialData *m_material;
int m_nodeIndices[3]; // Node pointers
float m_restArea; // Rest area
};
struct SoftBodyTetraData
{
btVector3FloatData m_c0[4]; // gradients
SoftBodyMaterialData *m_material;
int m_nodeIndices[4]; // Node pointers
float m_restVolume; // Rest volume
float m_c1; // (4*kVST)/(im0+im1+im2+im3)
float m_c2; // m_c1/sum(|g0..3|^2)
int m_pad;
};
struct SoftRigidAnchorData
{
btMatrix3x3FloatData m_c0; // Impulse matrix
btVector3FloatData m_c1; // Relative anchor
btVector3FloatData m_localFrame; // Anchor position in body space
btRigidBodyData *m_rigidBody;
int m_nodeIndex; // Node pointer
float m_c2; // ima*dt
};
struct SoftBodyConfigData
{
int m_aeroModel; // Aerodynamic model (default: V_Point)
float m_baumgarte; // Velocities correction factor (Baumgarte)
float m_damping; // Damping coefficient [0,1]
float m_drag; // Drag coefficient [0,+inf]
float m_lift; // Lift coefficient [0,+inf]
float m_pressure; // Pressure coefficient [-inf,+inf]
float m_volume; // Volume conversation coefficient [0,+inf]
float m_dynamicFriction; // Dynamic friction coefficient [0,1]
float m_poseMatch; // Pose matching coefficient [0,1]
float m_rigidContactHardness; // Rigid contacts hardness [0,1]
float m_kineticContactHardness; // Kinetic contacts hardness [0,1]
float m_softContactHardness; // Soft contacts hardness [0,1]
float m_anchorHardness; // Anchors hardness [0,1]
float m_softRigidClusterHardness; // Soft vs rigid hardness [0,1] (cluster only)
float m_softKineticClusterHardness; // Soft vs kinetic hardness [0,1] (cluster only)
float m_softSoftClusterHardness; // Soft vs soft hardness [0,1] (cluster only)
float m_softRigidClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
float m_softKineticClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
float m_softSoftClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
float m_maxVolume; // Maximum volume ratio for pose
float m_timeScale; // Time scale
int m_velocityIterations; // Velocities solver iterations
int m_positionIterations; // Positions solver iterations
int m_driftIterations; // Drift solver iterations
int m_clusterIterations; // Cluster solver iterations
int m_collisionFlags; // Collisions flags
};
struct SoftBodyPoseData
{
btMatrix3x3FloatData m_rot; // Rotation
btMatrix3x3FloatData m_scale; // Scale
btMatrix3x3FloatData m_aqq; // Base scaling
btVector3FloatData m_com; // COM
btVector3FloatData *m_positions; // Reference positions
float *m_weights; // Weights
int m_numPositions;
int m_numWeigts;
int m_bvolume; // Is valid
int m_bframe; // Is frame
float m_restVolume; // Rest volume
int m_pad;
};
struct SoftBodyClusterData
{
btTransformFloatData m_framexform;
btMatrix3x3FloatData m_locii;
btMatrix3x3FloatData m_invwi;
btVector3FloatData m_com;
btVector3FloatData m_vimpulses[2];
btVector3FloatData m_dimpulses[2];
btVector3FloatData m_lv;
btVector3FloatData m_av;
btVector3FloatData *m_framerefs;
int *m_nodeIndices;
float *m_masses;
int m_numFrameRefs;
int m_numNodes;
int m_numMasses;
float m_idmass;
float m_imass;
int m_nvimpulses;
int m_ndimpulses;
float m_ndamping;
float m_ldamping;
float m_adamping;
float m_matching;
float m_maxSelfCollisionImpulse;
float m_selfCollisionImpulseFactor;
int m_containsAnchor;
int m_collide;
int m_clusterIndex;
};
enum btSoftJointBodyType
{
BT_JOINT_SOFT_BODY_CLUSTER=1,
BT_JOINT_RIGID_BODY,
BT_JOINT_COLLISION_OBJECT
};
struct btSoftBodyJointData
{
void *m_bodyA;
void *m_bodyB;
btVector3FloatData m_refs[2];
float m_cfm;
float m_erp;
float m_split;
int m_delete;
btVector3FloatData m_relPosition[2];//linear
int m_bodyAtype;
int m_bodyBtype;
int m_jointType;
int m_pad;
};
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
struct btSoftBodyFloatData
{
btCollisionObjectFloatData m_collisionObjectData;
SoftBodyPoseData *m_pose;
SoftBodyMaterialData **m_materials;
SoftBodyNodeData *m_nodes;
SoftBodyLinkData *m_links;
SoftBodyFaceData *m_faces;
SoftBodyTetraData *m_tetrahedra;
SoftRigidAnchorData *m_anchors;
SoftBodyClusterData *m_clusters;
btSoftBodyJointData *m_joints;
int m_numMaterials;
int m_numNodes;
int m_numLinks;
int m_numFaces;
int m_numTetrahedra;
int m_numAnchors;
int m_numClusters;
int m_numJoints;
SoftBodyConfigData m_config;
};
#endif //BT_SOFTBODY_FLOAT_DATA
| /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_SOFTBODY_FLOAT_DATA
#define BT_SOFTBODY_FLOAT_DATA
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
struct SoftBodyMaterialData
{
float m_linearStiffness;
float m_angularStiffness;
float m_volumeStiffness;
int m_flags;
};
struct SoftBodyNodeData
{
SoftBodyMaterialData *m_material;
btVector3FloatData m_position;
btVector3FloatData m_previousPosition;
btVector3FloatData m_velocity;
btVector3FloatData m_accumulatedForce;
btVector3FloatData m_normal;
float m_inverseMass;
float m_area;
int m_attach;
int m_pad;
};
struct SoftBodyLinkData
{
SoftBodyMaterialData *m_material;
int m_nodeIndices[2]; // Node pointers
float m_restLength; // Rest length
int m_bbending; // Bending link
};
struct SoftBodyFaceData
{
btVector3FloatData m_normal; // Normal
SoftBodyMaterialData *m_material;
int m_nodeIndices[3]; // Node pointers
float m_restArea; // Rest area
};
struct SoftBodyTetraData
{
btVector3FloatData m_c0[4]; // gradients
SoftBodyMaterialData *m_material;
int m_nodeIndices[4]; // Node pointers
float m_restVolume; // Rest volume
float m_c1; // (4*kVST)/(im0+im1+im2+im3)
float m_c2; // m_c1/sum(|g0..3|^2)
int m_pad;
};
struct SoftRigidAnchorData
{
btMatrix3x3FloatData m_c0; // Impulse matrix
btVector3FloatData m_c1; // Relative anchor
btVector3FloatData m_localFrame; // Anchor position in body space
btRigidBodyData *m_rigidBody;
int m_nodeIndex; // Node pointer
float m_c2; // ima*dt
};
struct SoftBodyConfigData
{
int m_aeroModel; // Aerodynamic model (default: V_Point)
float m_baumgarte; // Velocities correction factor (Baumgarte)
float m_damping; // Damping coefficient [0,1]
float m_drag; // Drag coefficient [0,+inf]
float m_lift; // Lift coefficient [0,+inf]
float m_pressure; // Pressure coefficient [-inf,+inf]
float m_volume; // Volume conversation coefficient [0,+inf]
float m_dynamicFriction; // Dynamic friction coefficient [0,1]
float m_poseMatch; // Pose matching coefficient [0,1]
float m_rigidContactHardness; // Rigid contacts hardness [0,1]
float m_kineticContactHardness; // Kinetic contacts hardness [0,1]
float m_softContactHardness; // Soft contacts hardness [0,1]
float m_anchorHardness; // Anchors hardness [0,1]
float m_softRigidClusterHardness; // Soft vs rigid hardness [0,1] (cluster only)
float m_softKineticClusterHardness; // Soft vs kinetic hardness [0,1] (cluster only)
float m_softSoftClusterHardness; // Soft vs soft hardness [0,1] (cluster only)
float m_softRigidClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
float m_softKineticClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
float m_softSoftClusterImpulseSplit; // Soft vs rigid impulse split [0,1] (cluster only)
float m_maxVolume; // Maximum volume ratio for pose
float m_timeScale; // Time scale
int m_velocityIterations; // Velocities solver iterations
int m_positionIterations; // Positions solver iterations
int m_driftIterations; // Drift solver iterations
int m_clusterIterations; // Cluster solver iterations
int m_collisionFlags; // Collisions flags
};
struct SoftBodyPoseData
{
btMatrix3x3FloatData m_rot; // Rotation
btMatrix3x3FloatData m_scale; // Scale
btMatrix3x3FloatData m_aqq; // Base scaling
btVector3FloatData m_com; // COM
btVector3FloatData *m_positions; // Reference positions
float *m_weights; // Weights
int m_numPositions;
int m_numWeigts;
int m_bvolume; // Is valid
int m_bframe; // Is frame
float m_restVolume; // Rest volume
int m_pad;
};
struct SoftBodyClusterData
{
btTransformFloatData m_framexform;
btMatrix3x3FloatData m_locii;
btMatrix3x3FloatData m_invwi;
btVector3FloatData m_com;
btVector3FloatData m_vimpulses[2];
btVector3FloatData m_dimpulses[2];
btVector3FloatData m_lv;
btVector3FloatData m_av;
btVector3FloatData *m_framerefs;
int *m_nodeIndices;
float *m_masses;
int m_numFrameRefs;
int m_numNodes;
int m_numMasses;
float m_idmass;
float m_imass;
int m_nvimpulses;
int m_ndimpulses;
float m_ndamping;
float m_ldamping;
float m_adamping;
float m_matching;
float m_maxSelfCollisionImpulse;
float m_selfCollisionImpulseFactor;
int m_containsAnchor;
int m_collide;
int m_clusterIndex;
};
enum btSoftJointBodyType
{
BT_JOINT_SOFT_BODY_CLUSTER=1,
BT_JOINT_RIGID_BODY,
BT_JOINT_COLLISION_OBJECT
};
struct btSoftBodyJointData
{
void *m_bodyA;
void *m_bodyB;
btVector3FloatData m_refs[2];
float m_cfm;
float m_erp;
float m_split;
int m_delete;
btVector3FloatData m_relPosition[2];//linear
int m_bodyAtype;
int m_bodyBtype;
int m_jointType;
int m_pad;
};
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
struct btSoftBodyFloatData
{
btCollisionObjectFloatData m_collisionObjectData;
SoftBodyPoseData *m_pose;
SoftBodyMaterialData **m_materials;
SoftBodyNodeData *m_nodes;
SoftBodyLinkData *m_links;
SoftBodyFaceData *m_faces;
SoftBodyTetraData *m_tetrahedra;
SoftRigidAnchorData *m_anchors;
SoftBodyClusterData *m_clusters;
btSoftBodyJointData *m_joints;
int m_numMaterials;
int m_numNodes;
int m_numLinks;
int m_numFaces;
int m_numTetrahedra;
int m_numAnchors;
int m_numClusters;
int m_numJoints;
SoftBodyConfigData m_config;
};
#endif //BT_SOFTBODY_FLOAT_DATA
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./tests/gdx-tests/src/com/badlogic/gdx/tests/BitmapFontTest.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.BitmapFontCache;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.GlyphLayout.GlyphRun;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
public class BitmapFontTest extends GdxTest {
private Stage stage;
private SpriteBatch spriteBatch;
private BitmapFont font;
private ShapeRenderer renderer;
private BitmapFont multiPageFont;
private BitmapFont smallFont;
private GlyphLayout layout;
private Label label;
@Override
public void create () {
spriteBatch = new SpriteBatch();
// font = new BitmapFont(Gdx.files.internal("data/verdana39.fnt"), false);
font = new BitmapFont(Gdx.files.internal("data/lsans-32-pad.fnt"), false);
smallFont = new BitmapFont(); // uses LSans 15, the default
// font = new FreeTypeFontGenerator(Gdx.files.internal("data/lsans.ttf")).generateFont(new FreeTypeFontParameter());
font.getData().markupEnabled = true;
font.getData().breakChars = new char[] {'-'};
multiPageFont = new BitmapFont(Gdx.files.internal("data/multipagefont.fnt"));
// Add user defined color
Colors.put("PERU", Color.valueOf("CD853F"));
renderer = new ShapeRenderer();
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
stage = new Stage(new ScreenViewport());
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
BitmapFont labelFont = skin.get("default-font", BitmapFont.class);
labelFont.getData().markupEnabled = true;
// Notice that the last [] has been deliberately added to test the effect of excessive pop operations.
// They are silently ignored, as expected.
label = new Label("<<[BLUE]M[RED]u[YELLOW]l[GREEN]t[OLIVE]ic[]o[]l[]o[]r[]*[MAROON]Label[][] [Unknown Color]>>", skin);
label.setPosition(100, 200);
stage.addActor(label);
Window window = new Window("[RED]Multicolor[GREEN] Title", skin);
window.setPosition(400, 300);
window.pack();
stage.addActor(window);
layout = new GlyphLayout();
}
@Override
public void render () {
// red.a = (red.a + Gdx.graphics.getDeltaTime() * 0.1f) % 1;
int viewHeight = Gdx.graphics.getHeight();
ScreenUtils.clear(0, 0, 0, 1);
// Test wrapping or truncation with the font directly.
if (true) {
// BitmapFont font = label.getStyle().font;
BitmapFont font = this.font;
font.getData().markupEnabled = true;
font.getRegion().getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
font.getData().setScale(2f);
renderer.begin(ShapeRenderer.ShapeType.Line);
renderer.setColor(0, 1, 0, 1);
float w = Gdx.input.getX() - 10;
// w = 855;
renderer.rect(10, 10, w, 500);
renderer.end();
spriteBatch.begin();
String text = "your new";
// text = "How quickly da[RED]ft jumping zebras vex.";
// text = "Another font wrap is-sue, this time with multiple whitespace characters.";
// text = "test with AGWlWi AGWlWi issue";
// text = "AA BB \nEE"; // When wrapping after BB, there should not be a blank line before EE.
text = "[BLUE]A[]A BB [#00f000]EE[] T [GREEN]e[] \r\r[PINK]\n\nV[][YELLOW]a bb[] ([CYAN]5[]FFFurz)\nV[PURPLE]a[]\nVa\n[PURPLE]V[]a";
if (true) { // Test wrap.
layout.setText(font, text, 0, text.length(), font.getColor(), w, Align.center, true, null);
} else { // Test truncation.
layout.setText(font, text, 0, text.length(), font.getColor(), w, Align.center, false, "...");
}
float meowy = (500 / 2 + layout.height / 2 + 5);
font.draw(spriteBatch, layout, 10, 10 + meowy);
spriteBatch.end();
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE);
renderer.begin(ShapeRenderer.ShapeType.Line);
float c = 0.8f;
// GlyphLayout bounds
if (true) {
renderer.setColor(c, c, c, 1);
renderer.rect(10 + 0.5f * (w - layout.width), 10 + meowy, layout.width, -layout.height);
}
// GlyphRun bounds
for (int i = 0, n = layout.runs.size; i < n; i++) {
if (i % 3 == 0)
renderer.setColor(c, 0, c, 1);
else if (i % 2 == 0)
renderer.setColor(0, c, c, 1);
else
renderer.setColor(c, c, 0, 1);
GlyphRun r = layout.runs.get(i);
renderer.rect(10 + r.x, 10 + meowy + r.y, r.width, -font.getLineHeight());
}
renderer.end();
font.getData().setScale(1f);
return;
}
// Test wrapping with label.
if (false) {
label.debug();
label.getStyle().font = font;
label.setStyle(label.getStyle());
label.setText("How quickly [RED]daft[] jumping zebras vex.");
label.setWrap(true);
// label.setEllipsis(true);
label.setAlignment(Align.center, Align.right);
label.setWidth(Gdx.input.getX() - label.getX());
label.setHeight(label.getPrefHeight());
} else {
// Test various font features.
spriteBatch.begin();
String text = "Sphinx of black quartz, judge my vow.";
font.setColor(Color.RED);
float x = 100, y = 20;
float alignmentWidth;
if (false) {
alignmentWidth = 0;
font.draw(spriteBatch, text, x, viewHeight - y, alignmentWidth, Align.right, false);
}
if (true) {
alignmentWidth = 280;
font.draw(spriteBatch, text, x, viewHeight - y, alignmentWidth, Align.right, true);
}
font.draw(spriteBatch, "[", 50, 60, 100, Align.left, true);
font.getData().markupEnabled = true;
font.draw(spriteBatch, "[", 100, 60, 100, Align.left, true);
font.getData().markupEnabled = false;
// 'R' and 'p' are in different pages
String txt2 = "this font uses " + multiPageFont.getRegions().size + " texture pages: RpRpRpRpRpNM";
spriteBatch.renderCalls = 0;
// regular draw function
multiPageFont.setColor(Color.BLUE);
multiPageFont.draw(spriteBatch, txt2, 10, 100);
// expert usage.. drawing with bitmap font cache
BitmapFontCache cache = multiPageFont.getCache();
cache.clear();
cache.setColor(Color.BLACK);
cache.setText(txt2, 10, 50);
cache.setColors(Color.PINK, 3, 6);
cache.setColors(Color.ORANGE, 9, 12);
cache.setColors(Color.GREEN, 16, txt2.length());
cache.draw(spriteBatch, 5, txt2.length() - 5);
cache.clear();
cache.setColor(Color.BLACK);
float textX = 10;
textX += cache.setText("[black] ", textX, 150).width;
multiPageFont.getData().markupEnabled = true;
textX += cache.addText("[[[PINK]pink[]] ", textX, 150).width;
textX += cache.addText("[PERU][[peru] ", textX, 150).width;
cache.setColor(Color.GREEN);
textX += cache.addText("green ", textX, 150).width;
textX += cache.addText("[#A52A2A]br[#A52A2ADF]ow[#A52A2ABF]n f[#A52A2A9F]ad[#A52A2A7F]in[#A52A2A5F]g o[#A52A2A3F]ut ",
textX, 150).width;
multiPageFont.getData().markupEnabled = false;
cache.draw(spriteBatch);
// tinting
cache.tint(new Color(1f, 1f, 1f, 0.3f));
cache.translate(0f, 40f);
cache.draw(spriteBatch);
cache = smallFont.getCache();
// String neeeds to be pretty long to trigger the crash described in #5834; fixed now
final String trogdor = "TROGDOR! TROGDOR! Trogdor was a man! Or maybe he was a... Dragon-Man!";
cache.clear();
cache.addText(trogdor, 24, 37, 500, Align.center, true);
cache.setColors(Color.FOREST, 0, trogdor.length());
cache.draw(spriteBatch);
spriteBatch.end();
// System.out.println(spriteBatch.renderCalls);
renderer.begin(ShapeType.Line);
renderer.setColor(Color.BLACK);
renderer.rect(x, viewHeight - y - 200, alignmentWidth, 200);
renderer.end();
}
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
public void resize (int width, int height) {
spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, width, height);
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
spriteBatch.dispose();
renderer.dispose();
font.dispose();
// Restore predefined colors
Colors.reset();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.BitmapFontCache;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.GlyphLayout.GlyphRun;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
public class BitmapFontTest extends GdxTest {
private Stage stage;
private SpriteBatch spriteBatch;
private BitmapFont font;
private ShapeRenderer renderer;
private BitmapFont multiPageFont;
private BitmapFont smallFont;
private GlyphLayout layout;
private Label label;
@Override
public void create () {
spriteBatch = new SpriteBatch();
// font = new BitmapFont(Gdx.files.internal("data/verdana39.fnt"), false);
font = new BitmapFont(Gdx.files.internal("data/lsans-32-pad.fnt"), false);
smallFont = new BitmapFont(); // uses LSans 15, the default
// font = new FreeTypeFontGenerator(Gdx.files.internal("data/lsans.ttf")).generateFont(new FreeTypeFontParameter());
font.getData().markupEnabled = true;
font.getData().breakChars = new char[] {'-'};
multiPageFont = new BitmapFont(Gdx.files.internal("data/multipagefont.fnt"));
// Add user defined color
Colors.put("PERU", Color.valueOf("CD853F"));
renderer = new ShapeRenderer();
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
stage = new Stage(new ScreenViewport());
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
BitmapFont labelFont = skin.get("default-font", BitmapFont.class);
labelFont.getData().markupEnabled = true;
// Notice that the last [] has been deliberately added to test the effect of excessive pop operations.
// They are silently ignored, as expected.
label = new Label("<<[BLUE]M[RED]u[YELLOW]l[GREEN]t[OLIVE]ic[]o[]l[]o[]r[]*[MAROON]Label[][] [Unknown Color]>>", skin);
label.setPosition(100, 200);
stage.addActor(label);
Window window = new Window("[RED]Multicolor[GREEN] Title", skin);
window.setPosition(400, 300);
window.pack();
stage.addActor(window);
layout = new GlyphLayout();
}
@Override
public void render () {
// red.a = (red.a + Gdx.graphics.getDeltaTime() * 0.1f) % 1;
int viewHeight = Gdx.graphics.getHeight();
ScreenUtils.clear(0, 0, 0, 1);
// Test wrapping or truncation with the font directly.
if (true) {
// BitmapFont font = label.getStyle().font;
BitmapFont font = this.font;
font.getData().markupEnabled = true;
font.getRegion().getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
font.getData().setScale(2f);
renderer.begin(ShapeRenderer.ShapeType.Line);
renderer.setColor(0, 1, 0, 1);
float w = Gdx.input.getX() - 10;
// w = 855;
renderer.rect(10, 10, w, 500);
renderer.end();
spriteBatch.begin();
String text = "your new";
// text = "How quickly da[RED]ft jumping zebras vex.";
// text = "Another font wrap is-sue, this time with multiple whitespace characters.";
// text = "test with AGWlWi AGWlWi issue";
// text = "AA BB \nEE"; // When wrapping after BB, there should not be a blank line before EE.
text = "[BLUE]A[]A BB [#00f000]EE[] T [GREEN]e[] \r\r[PINK]\n\nV[][YELLOW]a bb[] ([CYAN]5[]FFFurz)\nV[PURPLE]a[]\nVa\n[PURPLE]V[]a";
if (true) { // Test wrap.
layout.setText(font, text, 0, text.length(), font.getColor(), w, Align.center, true, null);
} else { // Test truncation.
layout.setText(font, text, 0, text.length(), font.getColor(), w, Align.center, false, "...");
}
float meowy = (500 / 2 + layout.height / 2 + 5);
font.draw(spriteBatch, layout, 10, 10 + meowy);
spriteBatch.end();
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE);
renderer.begin(ShapeRenderer.ShapeType.Line);
float c = 0.8f;
// GlyphLayout bounds
if (true) {
renderer.setColor(c, c, c, 1);
renderer.rect(10 + 0.5f * (w - layout.width), 10 + meowy, layout.width, -layout.height);
}
// GlyphRun bounds
for (int i = 0, n = layout.runs.size; i < n; i++) {
if (i % 3 == 0)
renderer.setColor(c, 0, c, 1);
else if (i % 2 == 0)
renderer.setColor(0, c, c, 1);
else
renderer.setColor(c, c, 0, 1);
GlyphRun r = layout.runs.get(i);
renderer.rect(10 + r.x, 10 + meowy + r.y, r.width, -font.getLineHeight());
}
renderer.end();
font.getData().setScale(1f);
return;
}
// Test wrapping with label.
if (false) {
label.debug();
label.getStyle().font = font;
label.setStyle(label.getStyle());
label.setText("How quickly [RED]daft[] jumping zebras vex.");
label.setWrap(true);
// label.setEllipsis(true);
label.setAlignment(Align.center, Align.right);
label.setWidth(Gdx.input.getX() - label.getX());
label.setHeight(label.getPrefHeight());
} else {
// Test various font features.
spriteBatch.begin();
String text = "Sphinx of black quartz, judge my vow.";
font.setColor(Color.RED);
float x = 100, y = 20;
float alignmentWidth;
if (false) {
alignmentWidth = 0;
font.draw(spriteBatch, text, x, viewHeight - y, alignmentWidth, Align.right, false);
}
if (true) {
alignmentWidth = 280;
font.draw(spriteBatch, text, x, viewHeight - y, alignmentWidth, Align.right, true);
}
font.draw(spriteBatch, "[", 50, 60, 100, Align.left, true);
font.getData().markupEnabled = true;
font.draw(spriteBatch, "[", 100, 60, 100, Align.left, true);
font.getData().markupEnabled = false;
// 'R' and 'p' are in different pages
String txt2 = "this font uses " + multiPageFont.getRegions().size + " texture pages: RpRpRpRpRpNM";
spriteBatch.renderCalls = 0;
// regular draw function
multiPageFont.setColor(Color.BLUE);
multiPageFont.draw(spriteBatch, txt2, 10, 100);
// expert usage.. drawing with bitmap font cache
BitmapFontCache cache = multiPageFont.getCache();
cache.clear();
cache.setColor(Color.BLACK);
cache.setText(txt2, 10, 50);
cache.setColors(Color.PINK, 3, 6);
cache.setColors(Color.ORANGE, 9, 12);
cache.setColors(Color.GREEN, 16, txt2.length());
cache.draw(spriteBatch, 5, txt2.length() - 5);
cache.clear();
cache.setColor(Color.BLACK);
float textX = 10;
textX += cache.setText("[black] ", textX, 150).width;
multiPageFont.getData().markupEnabled = true;
textX += cache.addText("[[[PINK]pink[]] ", textX, 150).width;
textX += cache.addText("[PERU][[peru] ", textX, 150).width;
cache.setColor(Color.GREEN);
textX += cache.addText("green ", textX, 150).width;
textX += cache.addText("[#A52A2A]br[#A52A2ADF]ow[#A52A2ABF]n f[#A52A2A9F]ad[#A52A2A7F]in[#A52A2A5F]g o[#A52A2A3F]ut ",
textX, 150).width;
multiPageFont.getData().markupEnabled = false;
cache.draw(spriteBatch);
// tinting
cache.tint(new Color(1f, 1f, 1f, 0.3f));
cache.translate(0f, 40f);
cache.draw(spriteBatch);
cache = smallFont.getCache();
// String neeeds to be pretty long to trigger the crash described in #5834; fixed now
final String trogdor = "TROGDOR! TROGDOR! Trogdor was a man! Or maybe he was a... Dragon-Man!";
cache.clear();
cache.addText(trogdor, 24, 37, 500, Align.center, true);
cache.setColors(Color.FOREST, 0, trogdor.length());
cache.draw(spriteBatch);
spriteBatch.end();
// System.out.println(spriteBatch.renderCalls);
renderer.begin(ShapeType.Line);
renderer.setColor(Color.BLACK);
renderer.rect(x, viewHeight - y - 200, alignmentWidth, 200);
renderer.end();
}
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
public void resize (int width, int height) {
spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, width, height);
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
spriteBatch.dispose();
renderer.dispose();
font.dispose();
// Restore predefined colors
Colors.reset();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-bullet/jni/src/bullet/BulletCollision/CollisionShapes/btSphereShape.cpp | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "btSphereShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
{
(void)vec;
return btVector3(btScalar(0.),btScalar(0.),btScalar(0.));
}
void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
{
(void)vectors;
for (int i=0;i<numVectors;i++)
{
supportVerticesOut[i].setValue(btScalar(0.),btScalar(0.),btScalar(0.));
}
}
btVector3 btSphereShape::localGetSupportingVertex(const btVector3& vec)const
{
btVector3 supVertex;
supVertex = localGetSupportingVertexWithoutMargin(vec);
btVector3 vecnorm = vec;
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
{
vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
}
vecnorm.normalize();
supVertex+= getMargin() * vecnorm;
return supVertex;
}
//broken due to scaling
void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{
const btVector3& center = t.getOrigin();
btVector3 extent(getMargin(),getMargin(),getMargin());
aabbMin = center - extent;
aabbMax = center + extent;
}
void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
btScalar elem = btScalar(0.4) * mass * getMargin()*getMargin();
inertia.setValue(elem,elem,elem);
}
| /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "btSphereShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
{
(void)vec;
return btVector3(btScalar(0.),btScalar(0.),btScalar(0.));
}
void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
{
(void)vectors;
for (int i=0;i<numVectors;i++)
{
supportVerticesOut[i].setValue(btScalar(0.),btScalar(0.),btScalar(0.));
}
}
btVector3 btSphereShape::localGetSupportingVertex(const btVector3& vec)const
{
btVector3 supVertex;
supVertex = localGetSupportingVertexWithoutMargin(vec);
btVector3 vecnorm = vec;
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
{
vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
}
vecnorm.normalize();
supVertex+= getMargin() * vecnorm;
return supVertex;
}
//broken due to scaling
void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{
const btVector3& center = t.getOrigin();
btVector3 extent(getMargin(),getMargin(),getMargin());
aabbMin = center - extent;
aabbMax = center + extent;
}
void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
btScalar elem = btScalar(0.4) * mass * getMargin()*getMargin();
inertia.setValue(elem,elem,elem);
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.glutils;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Disposable;
/** Renders points, lines, shape outlines and filled shapes.
* <p>
* By default a 2D orthographic projection with the origin in the lower left corner is used and units are specified in screen
* pixels. This can be changed by configuring the projection matrix, usually using the {@link Camera#combined} matrix. If the
* screen resolution changes, the projection matrix may need to be updated.
* <p>
* Shapes are rendered in batches to increase performance. Standard usage pattern looks as follows:
*
* <pre>
* {@code
* camera.update();
* shapeRenderer.setProjectionMatrix(camera.combined);
*
* shapeRenderer.begin(ShapeType.Line);
* shapeRenderer.setColor(1, 1, 0, 1);
* shapeRenderer.line(x, y, x2, y2);
* shapeRenderer.rect(x, y, width, height);
* shapeRenderer.circle(x, y, radius);
* shapeRenderer.end();
*
* shapeRenderer.begin(ShapeType.Filled);
* shapeRenderer.setColor(0, 1, 0, 1);
* shapeRenderer.rect(x, y, width, height);
* shapeRenderer.circle(x, y, radius);
* shapeRenderer.end();
* }
* </pre>
*
* ShapeRenderer has a second matrix called the transformation matrix which is used to rotate, scale and translate shapes in a
* more flexible manner. The following example shows how to rotate a rectangle around its center using the z-axis as the rotation
* axis and placing it's center at (20, 12, 2):
*
* <pre>
* shapeRenderer.begin(ShapeType.Line);
* shapeRenderer.identity();
* shapeRenderer.translate(20, 12, 2);
* shapeRenderer.rotate(0, 0, 1, 90);
* shapeRenderer.rect(-width / 2, -height / 2, width, height);
* shapeRenderer.end();
* </pre>
*
* Matrix operations all use postmultiplication and work just like glTranslate, glScale and glRotate. The last transformation
* specified will be the first that is applied to a shape (rotate then translate in the above example).
* <p>
* The projection and transformation matrices are a state of the ShapeRenderer, just like the color, and will be applied to all
* shapes until they are changed.
* @author mzechner
* @author stbachmann
* @author Nathan Sweet */
public class ShapeRenderer implements Disposable {
/** Shape types to be used with {@link #begin(ShapeType)}.
* @author mzechner, stbachmann */
public enum ShapeType {
Point(GL20.GL_POINTS), Line(GL20.GL_LINES), Filled(GL20.GL_TRIANGLES);
private final int glType;
ShapeType (int glType) {
this.glType = glType;
}
public int getGlType () {
return glType;
}
}
private final ImmediateModeRenderer renderer;
private boolean matrixDirty = false;
private final Matrix4 projectionMatrix = new Matrix4();
private final Matrix4 transformMatrix = new Matrix4();
private final Matrix4 combinedMatrix = new Matrix4();
private final Vector2 tmp = new Vector2();
private final Color color = new Color(1, 1, 1, 1);
private ShapeType shapeType;
private boolean autoShapeType;
private float defaultRectLineWidth = 0.75f;
public ShapeRenderer () {
this(5000);
}
public ShapeRenderer (int maxVertices) {
this(maxVertices, null);
}
public ShapeRenderer (int maxVertices, ShaderProgram defaultShader) {
if (defaultShader == null) {
renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0);
} else {
renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0, defaultShader);
}
projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
matrixDirty = true;
}
/** Sets the color to be used by the next shapes drawn. */
public void setColor (Color color) {
this.color.set(color);
}
/** Sets the color to be used by the next shapes drawn. */
public void setColor (float r, float g, float b, float a) {
this.color.set(r, g, b, a);
}
public Color getColor () {
return color;
}
public void updateMatrices () {
matrixDirty = true;
}
/** Sets the projection matrix to be used for rendering. Usually this will be set to {@link Camera#combined}.
* @param matrix */
public void setProjectionMatrix (Matrix4 matrix) {
projectionMatrix.set(matrix);
matrixDirty = true;
}
/** If the matrix is modified, {@link #updateMatrices()} must be called. */
public Matrix4 getProjectionMatrix () {
return projectionMatrix;
}
public void setTransformMatrix (Matrix4 matrix) {
transformMatrix.set(matrix);
matrixDirty = true;
}
/** If the matrix is modified, {@link #updateMatrices()} must be called. */
public Matrix4 getTransformMatrix () {
return transformMatrix;
}
/** Sets the transformation matrix to identity. */
public void identity () {
transformMatrix.idt();
matrixDirty = true;
}
/** Multiplies the current transformation matrix by a translation matrix. */
public void translate (float x, float y, float z) {
transformMatrix.translate(x, y, z);
matrixDirty = true;
}
/** Multiplies the current transformation matrix by a rotation matrix. */
public void rotate (float axisX, float axisY, float axisZ, float degrees) {
transformMatrix.rotate(axisX, axisY, axisZ, degrees);
matrixDirty = true;
}
/** Multiplies the current transformation matrix by a scale matrix. */
public void scale (float scaleX, float scaleY, float scaleZ) {
transformMatrix.scale(scaleX, scaleY, scaleZ);
matrixDirty = true;
}
/** If true, when drawing a shape cannot be performed with the current shape type, the batch is flushed and the shape type is
* changed automatically. This can increase the number of batch flushes if care is not taken to draw the same type of shapes
* together. Default is false. */
public void setAutoShapeType (boolean autoShapeType) {
this.autoShapeType = autoShapeType;
}
/** Begins a new batch without specifying a shape type.
* @throws IllegalStateException if {@link #autoShapeType} is false. */
public void begin () {
if (!autoShapeType) throw new IllegalStateException("autoShapeType must be true to use this method.");
begin(ShapeType.Line);
}
/** Starts a new batch of shapes. Shapes drawn within the batch will attempt to use the type specified. The call to this method
* must be paired with a call to {@link #end()}.
* @see #setAutoShapeType(boolean) */
public void begin (ShapeType type) {
if (shapeType != null) throw new IllegalStateException("Call end() before beginning a new shape batch.");
shapeType = type;
if (matrixDirty) {
combinedMatrix.set(projectionMatrix);
Matrix4.mul(combinedMatrix.val, transformMatrix.val);
matrixDirty = false;
}
renderer.begin(combinedMatrix, shapeType.getGlType());
}
public void set (ShapeType type) {
if (shapeType == type) return;
if (shapeType == null) throw new IllegalStateException("begin must be called first.");
if (!autoShapeType) throw new IllegalStateException("autoShapeType must be enabled.");
end();
begin(type);
}
/** Draws a point using {@link ShapeType#Point}, {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void point (float x, float y, float z) {
if (shapeType == ShapeType.Line) {
float size = defaultRectLineWidth * 0.5f;
line(x - size, y - size, z, x + size, y + size, z);
return;
} else if (shapeType == ShapeType.Filled) {
float size = defaultRectLineWidth * 0.5f;
box(x - size, y - size, z - size, defaultRectLineWidth, defaultRectLineWidth, defaultRectLineWidth);
return;
}
check(ShapeType.Point, null, 1);
renderer.color(color);
renderer.vertex(x, y, z);
}
/** Draws a line using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public final void line (float x, float y, float z, float x2, float y2, float z2) {
line(x, y, z, x2, y2, z2, color, color);
}
/** @see #line(float, float, float, float, float, float) */
public final void line (Vector3 v0, Vector3 v1) {
line(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, color, color);
}
/** @see #line(float, float, float, float, float, float) */
public final void line (float x, float y, float x2, float y2) {
line(x, y, 0.0f, x2, y2, 0.0f, color, color);
}
/** @see #line(float, float, float, float, float, float) */
public final void line (Vector2 v0, Vector2 v1) {
line(v0.x, v0.y, 0.0f, v1.x, v1.y, 0.0f, color, color);
}
/** @see #line(float, float, float, float, float, float, Color, Color) */
public final void line (float x, float y, float x2, float y2, Color c1, Color c2) {
line(x, y, 0.0f, x2, y2, 0.0f, c1, c2);
}
/** Draws a line using {@link ShapeType#Line} or {@link ShapeType#Filled}. The line is drawn with two colors interpolated
* between the start and end points. */
public void line (float x, float y, float z, float x2, float y2, float z2, Color c1, Color c2) {
if (shapeType == ShapeType.Filled) {
rectLine(x, y, x2, y2, defaultRectLineWidth, c1, c2);
return;
}
check(ShapeType.Line, null, 2);
renderer.color(c1.r, c1.g, c1.b, c1.a);
renderer.vertex(x, y, z);
renderer.color(c2.r, c2.g, c2.b, c2.a);
renderer.vertex(x2, y2, z2);
}
/** Draws a curve using {@link ShapeType#Line}. */
public void curve (float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, int segments) {
check(ShapeType.Line, null, segments * 2 + 2);
float colorBits = color.toFloatBits();
// Algorithm from: http://www.antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION
float subdiv_step = 1f / segments;
float subdiv_step2 = subdiv_step * subdiv_step;
float subdiv_step3 = subdiv_step * subdiv_step * subdiv_step;
float pre1 = 3 * subdiv_step;
float pre2 = 3 * subdiv_step2;
float pre4 = 6 * subdiv_step2;
float pre5 = 6 * subdiv_step3;
float tmp1x = x1 - cx1 * 2 + cx2;
float tmp1y = y1 - cy1 * 2 + cy2;
float tmp2x = (cx1 - cx2) * 3 - x1 + x2;
float tmp2y = (cy1 - cy2) * 3 - y1 + y2;
float fx = x1;
float fy = y1;
float dfx = (cx1 - x1) * pre1 + tmp1x * pre2 + tmp2x * subdiv_step3;
float dfy = (cy1 - y1) * pre1 + tmp1y * pre2 + tmp2y * subdiv_step3;
float ddfx = tmp1x * pre4 + tmp2x * pre5;
float ddfy = tmp1y * pre4 + tmp2y * pre5;
float dddfx = tmp2x * pre5;
float dddfy = tmp2y * pre5;
while (segments-- > 0) {
renderer.color(colorBits);
renderer.vertex(fx, fy, 0);
fx += dfx;
fy += dfy;
dfx += ddfx;
dfy += ddfy;
ddfx += dddfx;
ddfy += dddfy;
renderer.color(colorBits);
renderer.vertex(fx, fy, 0);
}
renderer.color(colorBits);
renderer.vertex(fx, fy, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
}
/** Draws a triangle in x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void triangle (float x1, float y1, float x2, float y2, float x3, float y3) {
check(ShapeType.Line, ShapeType.Filled, 6);
float colorBits = color.toFloatBits();
if (shapeType == ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
renderer.color(colorBits);
renderer.vertex(x3, y3, 0);
renderer.color(colorBits);
renderer.vertex(x3, y3, 0);
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
} else {
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
renderer.color(colorBits);
renderer.vertex(x3, y3, 0);
}
}
/** Draws a triangle in x/y plane with colored corners using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void triangle (float x1, float y1, float x2, float y2, float x3, float y3, Color col1, Color col2, Color col3) {
check(ShapeType.Line, ShapeType.Filled, 6);
if (shapeType == ShapeType.Line) {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
} else {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
}
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void rect (float x, float y, float width, float height) {
check(ShapeType.Line, ShapeType.Filled, 8);
float colorBits = color.toFloatBits();
if (shapeType == ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y, 0);
} else {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y, 0);
}
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x and y specify the lower
* left corner.
* @param col1 The color at (x, y).
* @param col2 The color at (x + width, y).
* @param col3 The color at (x + width, y + height).
* @param col4 The color at (x, y + height). */
public void rect (float x, float y, float width, float height, Color col1, Color col2, Color col3, Color col4) {
check(ShapeType.Line, ShapeType.Filled, 8);
if (shapeType == ShapeType.Line) {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x + width, y, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x + width, y, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x, y + height, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x, y + height, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
} else {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x + width, y, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x, y + height, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
}
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x and y specify the lower
* left corner. The originX and originY specify the point about which to rotate the rectangle. */
public void rect (float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY,
float degrees) {
rect(x, y, originX, originY, width, height, scaleX, scaleY, degrees, color, color, color, color);
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x and y specify the lower
* left corner. The originX and originY specify the point about which to rotate the rectangle.
* @param col1 The color at (x, y)
* @param col2 The color at (x + width, y)
* @param col3 The color at (x + width, y + height)
* @param col4 The color at (x, y + height) */
public void rect (float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY,
float degrees, Color col1, Color col2, Color col3, Color col4) {
check(ShapeType.Line, ShapeType.Filled, 8);
float cos = MathUtils.cosDeg(degrees);
float sin = MathUtils.sinDeg(degrees);
float fx = -originX;
float fy = -originY;
float fx2 = width - originX;
float fy2 = height - originY;
if (scaleX != 1 || scaleY != 1) {
fx *= scaleX;
fy *= scaleY;
fx2 *= scaleX;
fy2 *= scaleY;
}
float worldOriginX = x + originX;
float worldOriginY = y + originY;
float x1 = cos * fx - sin * fy + worldOriginX;
float y1 = sin * fx + cos * fy + worldOriginY;
float x2 = cos * fx2 - sin * fy + worldOriginX;
float y2 = sin * fx2 + cos * fy + worldOriginY;
float x3 = cos * fx2 - sin * fy2 + worldOriginX;
float y3 = sin * fx2 + cos * fy2 + worldOriginY;
float x4 = x1 + (x3 - x2);
float y4 = y3 - (y2 - y1);
if (shapeType == ShapeType.Line) {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x4, y4, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x4, y4, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
} else {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x4, y4, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
}
}
/** Draws a line using a rotated rectangle, where with one edge is centered at x1, y1 and the opposite edge centered at x2,
* y2. */
public void rectLine (float x1, float y1, float x2, float y2, float width) {
check(ShapeType.Line, ShapeType.Filled, 8);
float colorBits = color.toFloatBits();
Vector2 t = tmp.set(y2 - y1, x1 - x2).nor();
width *= 0.5f;
float tx = t.x * width;
float ty = t.y * width;
if (shapeType == ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
} else {
renderer.color(colorBits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
}
}
/** Draws a line using a rotated rectangle, where with one edge is centered at x1, y1 and the opposite edge centered at x2,
* y2. */
public void rectLine (float x1, float y1, float x2, float y2, float width, Color c1, Color c2) {
check(ShapeType.Line, ShapeType.Filled, 8);
float col1Bits = c1.toFloatBits();
float col2Bits = c2.toFloatBits();
Vector2 t = tmp.set(y2 - y1, x1 - x2).nor();
width *= 0.5f;
float tx = t.x * width;
float ty = t.y * width;
if (shapeType == ShapeType.Line) {
renderer.color(col1Bits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
} else {
renderer.color(col1Bits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
}
}
/** @see #rectLine(float, float, float, float, float) */
public void rectLine (Vector2 p1, Vector2 p2, float width) {
rectLine(p1.x, p1.y, p2.x, p2.y, width);
}
/** Draws a cube using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x, y and z specify the bottom, left, front
* corner of the rectangle. */
public void box (float x, float y, float z, float width, float height, float depth) {
depth = -depth;
float colorBits = color.toFloatBits();
if (shapeType == ShapeType.Line) {
check(ShapeType.Line, ShapeType.Filled, 24);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
} else {
check(ShapeType.Line, ShapeType.Filled, 36);
// Front
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
// Back
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
// Left
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
// Right
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
// Top
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
// Bottom
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x, y, z);
}
}
/** Draws two crossed lines using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void x (float x, float y, float size) {
line(x - size, y - size, x + size, y + size);
line(x - size, y + size, x + size, y - size);
}
/** @see #x(float, float, float) */
public void x (Vector2 p, float size) {
x(p.x, p.y, size);
}
/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */
public void arc (float x, float y, float radius, float start, float degrees) {
arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f))));
}
/** Draws an arc using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void arc (float x, float y, float radius, float start, float degrees, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
float colorBits = color.toFloatBits();
float theta = (2 * MathUtils.PI * (degrees / 360.0f)) / segments;
float cos = MathUtils.cos(theta);
float sin = MathUtils.sin(theta);
float cx = radius * MathUtils.cos(start * MathUtils.degreesToRadians);
float cy = radius * MathUtils.sin(start * MathUtils.degreesToRadians);
if (shapeType == ShapeType.Line) {
check(ShapeType.Line, ShapeType.Filled, segments * 2 + 2);
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
} else {
check(ShapeType.Line, ShapeType.Filled, segments * 3 + 3);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
float temp = cx;
cx = 0;
cy = 0;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
/** Calls {@link #circle(float, float, float, int)} by estimating the number of segments needed for a smooth circle. */
public void circle (float x, float y, float radius) {
circle(x, y, radius, Math.max(1, (int)(6 * (float)Math.cbrt(radius))));
}
/** Draws a circle using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void circle (float x, float y, float radius, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
float cos = MathUtils.cos(angle);
float sin = MathUtils.sin(angle);
float cx = radius, cy = 0;
if (shapeType == ShapeType.Line) {
check(ShapeType.Line, ShapeType.Filled, segments * 2 + 2);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
} else {
check(ShapeType.Line, ShapeType.Filled, segments * 3 + 3);
segments--;
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
float temp = cx;
cx = radius;
cy = 0;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
/** Calls {@link #ellipse(float, float, float, float, int)} by estimating the number of segments needed for a smooth
* ellipse. */
public void ellipse (float x, float y, float width, float height) {
ellipse(x, y, width, height, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}
/** Draws an ellipse using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void ellipse (float x, float y, float width, float height, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
check(ShapeType.Line, ShapeType.Filled, segments * 3);
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
float cx = x + width / 2, cy = y + height / 2;
if (shapeType == ShapeType.Line) {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos(i * angle)), cy + (height * 0.5f * MathUtils.sin(i * angle)), 0);
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos((i + 1) * angle)),
cy + (height * 0.5f * MathUtils.sin((i + 1) * angle)), 0);
}
} else {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos(i * angle)), cy + (height * 0.5f * MathUtils.sin(i * angle)), 0);
renderer.color(colorBits);
renderer.vertex(cx, cy, 0);
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos((i + 1) * angle)),
cy + (height * 0.5f * MathUtils.sin((i + 1) * angle)), 0);
}
}
}
/** Calls {@link #ellipse(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth
* ellipse. */
public void ellipse (float x, float y, float width, float height, float rotation) {
ellipse(x, y, width, height, rotation, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}
/** Draws an ellipse using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void ellipse (float x, float y, float width, float height, float rotation, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
check(ShapeType.Line, ShapeType.Filled, segments * 3);
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
rotation = MathUtils.PI * rotation / 180f;
float sin = MathUtils.sin(rotation);
float cos = MathUtils.cos(rotation);
float cx = x + width / 2, cy = y + height / 2;
float x1 = width * 0.5f;
float y1 = 0;
if (shapeType == ShapeType.Line) {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
x1 = (width * 0.5f * MathUtils.cos((i + 1) * angle));
y1 = (height * 0.5f * MathUtils.sin((i + 1) * angle));
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
}
} else {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
renderer.color(colorBits);
renderer.vertex(cx, cy, 0);
x1 = (width * 0.5f * MathUtils.cos((i + 1) * angle));
y1 = (height * 0.5f * MathUtils.sin((i + 1) * angle));
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
}
}
}
/** Calls {@link #cone(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth
* circular base. */
public void cone (float x, float y, float z, float radius, float height) {
cone(x, y, z, radius, height, Math.max(1, (int)(4 * (float)Math.sqrt(radius))));
}
/** Draws a cone using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void cone (float x, float y, float z, float radius, float height, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
check(ShapeType.Line, ShapeType.Filled, segments * 4 + 2);
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
float cos = MathUtils.cos(angle);
float sin = MathUtils.sin(angle);
float cx = radius, cy = 0;
if (shapeType == ShapeType.Line) {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + height);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
} else {
segments--;
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
float temp = cx;
float temp2 = cy;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x + temp, y + temp2, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + height);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
}
float temp = cx;
float temp2 = cy;
cx = radius;
cy = 0;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
if (shapeType != ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x + temp, y + temp2, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + height);
}
}
/** Draws a polygon in the x/y plane using {@link ShapeType#Line}. The vertices must contain at least 3 points (6 floats
* x,y). */
public void polygon (float[] vertices, int offset, int count) {
if (count < 6) throw new IllegalArgumentException("Polygons must contain at least 3 points.");
if (count % 2 != 0) throw new IllegalArgumentException("Polygons must have an even number of vertices.");
check(ShapeType.Line, null, count);
float colorBits = color.toFloatBits();
float firstX = vertices[0];
float firstY = vertices[1];
for (int i = offset, n = offset + count; i < n; i += 2) {
float x1 = vertices[i];
float y1 = vertices[i + 1];
float x2;
float y2;
if (i + 2 >= count) {
x2 = firstX;
y2 = firstY;
} else {
x2 = vertices[i + 2];
y2 = vertices[i + 3];
}
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
}
}
/** @see #polygon(float[], int, int) */
public void polygon (float[] vertices) {
polygon(vertices, 0, vertices.length);
}
/** Draws a polyline in the x/y plane using {@link ShapeType#Line}. The vertices must contain at least 2 points (4 floats
* x,y). */
public void polyline (float[] vertices, int offset, int count) {
if (count < 4) throw new IllegalArgumentException("Polylines must contain at least 2 points.");
if (count % 2 != 0) throw new IllegalArgumentException("Polylines must have an even number of vertices.");
check(ShapeType.Line, null, count);
float colorBits = color.toFloatBits();
for (int i = offset, n = offset + count - 2; i < n; i += 2) {
float x1 = vertices[i];
float y1 = vertices[i + 1];
float x2;
float y2;
x2 = vertices[i + 2];
y2 = vertices[i + 3];
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
}
}
/** @see #polyline(float[], int, int) */
public void polyline (float[] vertices) {
polyline(vertices, 0, vertices.length);
}
/** Checks whether the correct ShapeType was set. If not and autoShapeType is enabled, it flushes the batch and changes the
* shape type. The batch is also flushed, when the matrix has been changed or not enough vertices remain.
*
* @param preferred usually ShapeType.Line
* @param other usually ShapeType.Filled. May be null.
* @param newVertices vertices count of geometric figure you want to draw */
protected final void check (ShapeType preferred, ShapeType other, int newVertices) {
if (shapeType == null) throw new IllegalStateException("begin must be called first.");
if (shapeType != preferred && shapeType != other) {
// Shape type is not valid.
if (!autoShapeType) {
if (other == null)
throw new IllegalStateException("Must call begin(ShapeType." + preferred + ").");
else
throw new IllegalStateException("Must call begin(ShapeType." + preferred + ") or begin(ShapeType." + other + ").");
}
end();
begin(preferred);
} else if (matrixDirty) {
// Matrix has been changed.
ShapeType type = shapeType;
end();
begin(type);
} else if (renderer.getMaxVertices() - renderer.getNumVertices() < newVertices) {
// Not enough space.
ShapeType type = shapeType;
end();
begin(type);
}
}
/** Finishes the batch of shapes and ensures they get rendered. */
public void end () {
renderer.end();
shapeType = null;
}
public void flush () {
ShapeType type = shapeType;
if (type == null) return;
end();
begin(type);
}
/** Returns the current shape type. */
public ShapeType getCurrentType () {
return shapeType;
}
public ImmediateModeRenderer getRenderer () {
return renderer;
}
/** @return true if currently between begin and end. */
public boolean isDrawing () {
return shapeType != null;
}
public void dispose () {
renderer.dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.glutils;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Disposable;
/** Renders points, lines, shape outlines and filled shapes.
* <p>
* By default a 2D orthographic projection with the origin in the lower left corner is used and units are specified in screen
* pixels. This can be changed by configuring the projection matrix, usually using the {@link Camera#combined} matrix. If the
* screen resolution changes, the projection matrix may need to be updated.
* <p>
* Shapes are rendered in batches to increase performance. Standard usage pattern looks as follows:
*
* <pre>
* {@code
* camera.update();
* shapeRenderer.setProjectionMatrix(camera.combined);
*
* shapeRenderer.begin(ShapeType.Line);
* shapeRenderer.setColor(1, 1, 0, 1);
* shapeRenderer.line(x, y, x2, y2);
* shapeRenderer.rect(x, y, width, height);
* shapeRenderer.circle(x, y, radius);
* shapeRenderer.end();
*
* shapeRenderer.begin(ShapeType.Filled);
* shapeRenderer.setColor(0, 1, 0, 1);
* shapeRenderer.rect(x, y, width, height);
* shapeRenderer.circle(x, y, radius);
* shapeRenderer.end();
* }
* </pre>
*
* ShapeRenderer has a second matrix called the transformation matrix which is used to rotate, scale and translate shapes in a
* more flexible manner. The following example shows how to rotate a rectangle around its center using the z-axis as the rotation
* axis and placing it's center at (20, 12, 2):
*
* <pre>
* shapeRenderer.begin(ShapeType.Line);
* shapeRenderer.identity();
* shapeRenderer.translate(20, 12, 2);
* shapeRenderer.rotate(0, 0, 1, 90);
* shapeRenderer.rect(-width / 2, -height / 2, width, height);
* shapeRenderer.end();
* </pre>
*
* Matrix operations all use postmultiplication and work just like glTranslate, glScale and glRotate. The last transformation
* specified will be the first that is applied to a shape (rotate then translate in the above example).
* <p>
* The projection and transformation matrices are a state of the ShapeRenderer, just like the color, and will be applied to all
* shapes until they are changed.
* @author mzechner
* @author stbachmann
* @author Nathan Sweet */
public class ShapeRenderer implements Disposable {
/** Shape types to be used with {@link #begin(ShapeType)}.
* @author mzechner, stbachmann */
public enum ShapeType {
Point(GL20.GL_POINTS), Line(GL20.GL_LINES), Filled(GL20.GL_TRIANGLES);
private final int glType;
ShapeType (int glType) {
this.glType = glType;
}
public int getGlType () {
return glType;
}
}
private final ImmediateModeRenderer renderer;
private boolean matrixDirty = false;
private final Matrix4 projectionMatrix = new Matrix4();
private final Matrix4 transformMatrix = new Matrix4();
private final Matrix4 combinedMatrix = new Matrix4();
private final Vector2 tmp = new Vector2();
private final Color color = new Color(1, 1, 1, 1);
private ShapeType shapeType;
private boolean autoShapeType;
private float defaultRectLineWidth = 0.75f;
public ShapeRenderer () {
this(5000);
}
public ShapeRenderer (int maxVertices) {
this(maxVertices, null);
}
public ShapeRenderer (int maxVertices, ShaderProgram defaultShader) {
if (defaultShader == null) {
renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0);
} else {
renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0, defaultShader);
}
projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
matrixDirty = true;
}
/** Sets the color to be used by the next shapes drawn. */
public void setColor (Color color) {
this.color.set(color);
}
/** Sets the color to be used by the next shapes drawn. */
public void setColor (float r, float g, float b, float a) {
this.color.set(r, g, b, a);
}
public Color getColor () {
return color;
}
public void updateMatrices () {
matrixDirty = true;
}
/** Sets the projection matrix to be used for rendering. Usually this will be set to {@link Camera#combined}.
* @param matrix */
public void setProjectionMatrix (Matrix4 matrix) {
projectionMatrix.set(matrix);
matrixDirty = true;
}
/** If the matrix is modified, {@link #updateMatrices()} must be called. */
public Matrix4 getProjectionMatrix () {
return projectionMatrix;
}
public void setTransformMatrix (Matrix4 matrix) {
transformMatrix.set(matrix);
matrixDirty = true;
}
/** If the matrix is modified, {@link #updateMatrices()} must be called. */
public Matrix4 getTransformMatrix () {
return transformMatrix;
}
/** Sets the transformation matrix to identity. */
public void identity () {
transformMatrix.idt();
matrixDirty = true;
}
/** Multiplies the current transformation matrix by a translation matrix. */
public void translate (float x, float y, float z) {
transformMatrix.translate(x, y, z);
matrixDirty = true;
}
/** Multiplies the current transformation matrix by a rotation matrix. */
public void rotate (float axisX, float axisY, float axisZ, float degrees) {
transformMatrix.rotate(axisX, axisY, axisZ, degrees);
matrixDirty = true;
}
/** Multiplies the current transformation matrix by a scale matrix. */
public void scale (float scaleX, float scaleY, float scaleZ) {
transformMatrix.scale(scaleX, scaleY, scaleZ);
matrixDirty = true;
}
/** If true, when drawing a shape cannot be performed with the current shape type, the batch is flushed and the shape type is
* changed automatically. This can increase the number of batch flushes if care is not taken to draw the same type of shapes
* together. Default is false. */
public void setAutoShapeType (boolean autoShapeType) {
this.autoShapeType = autoShapeType;
}
/** Begins a new batch without specifying a shape type.
* @throws IllegalStateException if {@link #autoShapeType} is false. */
public void begin () {
if (!autoShapeType) throw new IllegalStateException("autoShapeType must be true to use this method.");
begin(ShapeType.Line);
}
/** Starts a new batch of shapes. Shapes drawn within the batch will attempt to use the type specified. The call to this method
* must be paired with a call to {@link #end()}.
* @see #setAutoShapeType(boolean) */
public void begin (ShapeType type) {
if (shapeType != null) throw new IllegalStateException("Call end() before beginning a new shape batch.");
shapeType = type;
if (matrixDirty) {
combinedMatrix.set(projectionMatrix);
Matrix4.mul(combinedMatrix.val, transformMatrix.val);
matrixDirty = false;
}
renderer.begin(combinedMatrix, shapeType.getGlType());
}
public void set (ShapeType type) {
if (shapeType == type) return;
if (shapeType == null) throw new IllegalStateException("begin must be called first.");
if (!autoShapeType) throw new IllegalStateException("autoShapeType must be enabled.");
end();
begin(type);
}
/** Draws a point using {@link ShapeType#Point}, {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void point (float x, float y, float z) {
if (shapeType == ShapeType.Line) {
float size = defaultRectLineWidth * 0.5f;
line(x - size, y - size, z, x + size, y + size, z);
return;
} else if (shapeType == ShapeType.Filled) {
float size = defaultRectLineWidth * 0.5f;
box(x - size, y - size, z - size, defaultRectLineWidth, defaultRectLineWidth, defaultRectLineWidth);
return;
}
check(ShapeType.Point, null, 1);
renderer.color(color);
renderer.vertex(x, y, z);
}
/** Draws a line using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public final void line (float x, float y, float z, float x2, float y2, float z2) {
line(x, y, z, x2, y2, z2, color, color);
}
/** @see #line(float, float, float, float, float, float) */
public final void line (Vector3 v0, Vector3 v1) {
line(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, color, color);
}
/** @see #line(float, float, float, float, float, float) */
public final void line (float x, float y, float x2, float y2) {
line(x, y, 0.0f, x2, y2, 0.0f, color, color);
}
/** @see #line(float, float, float, float, float, float) */
public final void line (Vector2 v0, Vector2 v1) {
line(v0.x, v0.y, 0.0f, v1.x, v1.y, 0.0f, color, color);
}
/** @see #line(float, float, float, float, float, float, Color, Color) */
public final void line (float x, float y, float x2, float y2, Color c1, Color c2) {
line(x, y, 0.0f, x2, y2, 0.0f, c1, c2);
}
/** Draws a line using {@link ShapeType#Line} or {@link ShapeType#Filled}. The line is drawn with two colors interpolated
* between the start and end points. */
public void line (float x, float y, float z, float x2, float y2, float z2, Color c1, Color c2) {
if (shapeType == ShapeType.Filled) {
rectLine(x, y, x2, y2, defaultRectLineWidth, c1, c2);
return;
}
check(ShapeType.Line, null, 2);
renderer.color(c1.r, c1.g, c1.b, c1.a);
renderer.vertex(x, y, z);
renderer.color(c2.r, c2.g, c2.b, c2.a);
renderer.vertex(x2, y2, z2);
}
/** Draws a curve using {@link ShapeType#Line}. */
public void curve (float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, int segments) {
check(ShapeType.Line, null, segments * 2 + 2);
float colorBits = color.toFloatBits();
// Algorithm from: http://www.antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION
float subdiv_step = 1f / segments;
float subdiv_step2 = subdiv_step * subdiv_step;
float subdiv_step3 = subdiv_step * subdiv_step * subdiv_step;
float pre1 = 3 * subdiv_step;
float pre2 = 3 * subdiv_step2;
float pre4 = 6 * subdiv_step2;
float pre5 = 6 * subdiv_step3;
float tmp1x = x1 - cx1 * 2 + cx2;
float tmp1y = y1 - cy1 * 2 + cy2;
float tmp2x = (cx1 - cx2) * 3 - x1 + x2;
float tmp2y = (cy1 - cy2) * 3 - y1 + y2;
float fx = x1;
float fy = y1;
float dfx = (cx1 - x1) * pre1 + tmp1x * pre2 + tmp2x * subdiv_step3;
float dfy = (cy1 - y1) * pre1 + tmp1y * pre2 + tmp2y * subdiv_step3;
float ddfx = tmp1x * pre4 + tmp2x * pre5;
float ddfy = tmp1y * pre4 + tmp2y * pre5;
float dddfx = tmp2x * pre5;
float dddfy = tmp2y * pre5;
while (segments-- > 0) {
renderer.color(colorBits);
renderer.vertex(fx, fy, 0);
fx += dfx;
fy += dfy;
dfx += ddfx;
dfy += ddfy;
ddfx += dddfx;
ddfy += dddfy;
renderer.color(colorBits);
renderer.vertex(fx, fy, 0);
}
renderer.color(colorBits);
renderer.vertex(fx, fy, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
}
/** Draws a triangle in x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void triangle (float x1, float y1, float x2, float y2, float x3, float y3) {
check(ShapeType.Line, ShapeType.Filled, 6);
float colorBits = color.toFloatBits();
if (shapeType == ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
renderer.color(colorBits);
renderer.vertex(x3, y3, 0);
renderer.color(colorBits);
renderer.vertex(x3, y3, 0);
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
} else {
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
renderer.color(colorBits);
renderer.vertex(x3, y3, 0);
}
}
/** Draws a triangle in x/y plane with colored corners using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void triangle (float x1, float y1, float x2, float y2, float x3, float y3, Color col1, Color col2, Color col3) {
check(ShapeType.Line, ShapeType.Filled, 6);
if (shapeType == ShapeType.Line) {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
} else {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
}
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void rect (float x, float y, float width, float height) {
check(ShapeType.Line, ShapeType.Filled, 8);
float colorBits = color.toFloatBits();
if (shapeType == ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y, 0);
} else {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y + height, 0);
renderer.color(colorBits);
renderer.vertex(x, y, 0);
}
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x and y specify the lower
* left corner.
* @param col1 The color at (x, y).
* @param col2 The color at (x + width, y).
* @param col3 The color at (x + width, y + height).
* @param col4 The color at (x, y + height). */
public void rect (float x, float y, float width, float height, Color col1, Color col2, Color col3, Color col4) {
check(ShapeType.Line, ShapeType.Filled, 8);
if (shapeType == ShapeType.Line) {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x + width, y, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x + width, y, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x, y + height, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x, y + height, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
} else {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x + width, y, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x + width, y + height, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x, y + height, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x, y, 0);
}
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x and y specify the lower
* left corner. The originX and originY specify the point about which to rotate the rectangle. */
public void rect (float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY,
float degrees) {
rect(x, y, originX, originY, width, height, scaleX, scaleY, degrees, color, color, color, color);
}
/** Draws a rectangle in the x/y plane using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x and y specify the lower
* left corner. The originX and originY specify the point about which to rotate the rectangle.
* @param col1 The color at (x, y)
* @param col2 The color at (x + width, y)
* @param col3 The color at (x + width, y + height)
* @param col4 The color at (x, y + height) */
public void rect (float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY,
float degrees, Color col1, Color col2, Color col3, Color col4) {
check(ShapeType.Line, ShapeType.Filled, 8);
float cos = MathUtils.cosDeg(degrees);
float sin = MathUtils.sinDeg(degrees);
float fx = -originX;
float fy = -originY;
float fx2 = width - originX;
float fy2 = height - originY;
if (scaleX != 1 || scaleY != 1) {
fx *= scaleX;
fy *= scaleY;
fx2 *= scaleX;
fy2 *= scaleY;
}
float worldOriginX = x + originX;
float worldOriginY = y + originY;
float x1 = cos * fx - sin * fy + worldOriginX;
float y1 = sin * fx + cos * fy + worldOriginY;
float x2 = cos * fx2 - sin * fy + worldOriginX;
float y2 = sin * fx2 + cos * fy + worldOriginY;
float x3 = cos * fx2 - sin * fy2 + worldOriginX;
float y3 = sin * fx2 + cos * fy2 + worldOriginY;
float x4 = x1 + (x3 - x2);
float y4 = y3 - (y2 - y1);
if (shapeType == ShapeType.Line) {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x4, y4, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x4, y4, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
} else {
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
renderer.color(col2.r, col2.g, col2.b, col2.a);
renderer.vertex(x2, y2, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col3.r, col3.g, col3.b, col3.a);
renderer.vertex(x3, y3, 0);
renderer.color(col4.r, col4.g, col4.b, col4.a);
renderer.vertex(x4, y4, 0);
renderer.color(col1.r, col1.g, col1.b, col1.a);
renderer.vertex(x1, y1, 0);
}
}
/** Draws a line using a rotated rectangle, where with one edge is centered at x1, y1 and the opposite edge centered at x2,
* y2. */
public void rectLine (float x1, float y1, float x2, float y2, float width) {
check(ShapeType.Line, ShapeType.Filled, 8);
float colorBits = color.toFloatBits();
Vector2 t = tmp.set(y2 - y1, x1 - x2).nor();
width *= 0.5f;
float tx = t.x * width;
float ty = t.y * width;
if (shapeType == ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
} else {
renderer.color(colorBits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(colorBits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(colorBits);
renderer.vertex(x1 - tx, y1 - ty, 0);
}
}
/** Draws a line using a rotated rectangle, where with one edge is centered at x1, y1 and the opposite edge centered at x2,
* y2. */
public void rectLine (float x1, float y1, float x2, float y2, float width, Color c1, Color c2) {
check(ShapeType.Line, ShapeType.Filled, 8);
float col1Bits = c1.toFloatBits();
float col2Bits = c2.toFloatBits();
Vector2 t = tmp.set(y2 - y1, x1 - x2).nor();
width *= 0.5f;
float tx = t.x * width;
float ty = t.y * width;
if (shapeType == ShapeType.Line) {
renderer.color(col1Bits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
} else {
renderer.color(col1Bits);
renderer.vertex(x1 + tx, y1 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 - tx, y2 - ty, 0);
renderer.color(col2Bits);
renderer.vertex(x2 + tx, y2 + ty, 0);
renderer.color(col1Bits);
renderer.vertex(x1 - tx, y1 - ty, 0);
}
}
/** @see #rectLine(float, float, float, float, float) */
public void rectLine (Vector2 p1, Vector2 p2, float width) {
rectLine(p1.x, p1.y, p2.x, p2.y, width);
}
/** Draws a cube using {@link ShapeType#Line} or {@link ShapeType#Filled}. The x, y and z specify the bottom, left, front
* corner of the rectangle. */
public void box (float x, float y, float z, float width, float height, float depth) {
depth = -depth;
float colorBits = color.toFloatBits();
if (shapeType == ShapeType.Line) {
check(ShapeType.Line, ShapeType.Filled, 24);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
} else {
check(ShapeType.Line, ShapeType.Filled, 36);
// Front
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
// Back
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
// Left
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
// Right
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
// Top
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z);
renderer.color(colorBits);
renderer.vertex(x + width, y + height, z + depth);
renderer.color(colorBits);
renderer.vertex(x, y + height, z + depth);
// Bottom
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + depth);
renderer.color(colorBits);
renderer.vertex(x + width, y, z);
renderer.color(colorBits);
renderer.vertex(x, y, z);
}
}
/** Draws two crossed lines using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void x (float x, float y, float size) {
line(x - size, y - size, x + size, y + size);
line(x - size, y + size, x + size, y - size);
}
/** @see #x(float, float, float) */
public void x (Vector2 p, float size) {
x(p.x, p.y, size);
}
/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */
public void arc (float x, float y, float radius, float start, float degrees) {
arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f))));
}
/** Draws an arc using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void arc (float x, float y, float radius, float start, float degrees, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
float colorBits = color.toFloatBits();
float theta = (2 * MathUtils.PI * (degrees / 360.0f)) / segments;
float cos = MathUtils.cos(theta);
float sin = MathUtils.sin(theta);
float cx = radius * MathUtils.cos(start * MathUtils.degreesToRadians);
float cy = radius * MathUtils.sin(start * MathUtils.degreesToRadians);
if (shapeType == ShapeType.Line) {
check(ShapeType.Line, ShapeType.Filled, segments * 2 + 2);
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
} else {
check(ShapeType.Line, ShapeType.Filled, segments * 3 + 3);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
float temp = cx;
cx = 0;
cy = 0;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
/** Calls {@link #circle(float, float, float, int)} by estimating the number of segments needed for a smooth circle. */
public void circle (float x, float y, float radius) {
circle(x, y, radius, Math.max(1, (int)(6 * (float)Math.cbrt(radius))));
}
/** Draws a circle using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void circle (float x, float y, float radius, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
float cos = MathUtils.cos(angle);
float sin = MathUtils.sin(angle);
float cx = radius, cy = 0;
if (shapeType == ShapeType.Line) {
check(ShapeType.Line, ShapeType.Filled, segments * 2 + 2);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
} else {
check(ShapeType.Line, ShapeType.Filled, segments * 3 + 3);
segments--;
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x, y, 0);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
float temp = cx;
cx = radius;
cy = 0;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
/** Calls {@link #ellipse(float, float, float, float, int)} by estimating the number of segments needed for a smooth
* ellipse. */
public void ellipse (float x, float y, float width, float height) {
ellipse(x, y, width, height, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}
/** Draws an ellipse using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void ellipse (float x, float y, float width, float height, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
check(ShapeType.Line, ShapeType.Filled, segments * 3);
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
float cx = x + width / 2, cy = y + height / 2;
if (shapeType == ShapeType.Line) {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos(i * angle)), cy + (height * 0.5f * MathUtils.sin(i * angle)), 0);
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos((i + 1) * angle)),
cy + (height * 0.5f * MathUtils.sin((i + 1) * angle)), 0);
}
} else {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos(i * angle)), cy + (height * 0.5f * MathUtils.sin(i * angle)), 0);
renderer.color(colorBits);
renderer.vertex(cx, cy, 0);
renderer.color(colorBits);
renderer.vertex(cx + (width * 0.5f * MathUtils.cos((i + 1) * angle)),
cy + (height * 0.5f * MathUtils.sin((i + 1) * angle)), 0);
}
}
}
/** Calls {@link #ellipse(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth
* ellipse. */
public void ellipse (float x, float y, float width, float height, float rotation) {
ellipse(x, y, width, height, rotation, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}
/** Draws an ellipse using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void ellipse (float x, float y, float width, float height, float rotation, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
check(ShapeType.Line, ShapeType.Filled, segments * 3);
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
rotation = MathUtils.PI * rotation / 180f;
float sin = MathUtils.sin(rotation);
float cos = MathUtils.cos(rotation);
float cx = x + width / 2, cy = y + height / 2;
float x1 = width * 0.5f;
float y1 = 0;
if (shapeType == ShapeType.Line) {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
x1 = (width * 0.5f * MathUtils.cos((i + 1) * angle));
y1 = (height * 0.5f * MathUtils.sin((i + 1) * angle));
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
}
} else {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
renderer.color(colorBits);
renderer.vertex(cx, cy, 0);
x1 = (width * 0.5f * MathUtils.cos((i + 1) * angle));
y1 = (height * 0.5f * MathUtils.sin((i + 1) * angle));
renderer.color(colorBits);
renderer.vertex(cx + cos * x1 - sin * y1, cy + sin * x1 + cos * y1, 0);
}
}
}
/** Calls {@link #cone(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth
* circular base. */
public void cone (float x, float y, float z, float radius, float height) {
cone(x, y, z, radius, height, Math.max(1, (int)(4 * (float)Math.sqrt(radius))));
}
/** Draws a cone using {@link ShapeType#Line} or {@link ShapeType#Filled}. */
public void cone (float x, float y, float z, float radius, float height, int segments) {
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
check(ShapeType.Line, ShapeType.Filled, segments * 4 + 2);
float colorBits = color.toFloatBits();
float angle = 2 * MathUtils.PI / segments;
float cos = MathUtils.cos(angle);
float sin = MathUtils.sin(angle);
float cx = radius, cy = 0;
if (shapeType == ShapeType.Line) {
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + height);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
} else {
segments--;
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
float temp = cx;
float temp2 = cy;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x + temp, y + temp2, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + height);
}
// Ensure the last segment is identical to the first.
renderer.color(colorBits);
renderer.vertex(x, y, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
}
float temp = cx;
float temp2 = cy;
cx = radius;
cy = 0;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
if (shapeType != ShapeType.Line) {
renderer.color(colorBits);
renderer.vertex(x + temp, y + temp2, z);
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, z);
renderer.color(colorBits);
renderer.vertex(x, y, z + height);
}
}
/** Draws a polygon in the x/y plane using {@link ShapeType#Line}. The vertices must contain at least 3 points (6 floats
* x,y). */
public void polygon (float[] vertices, int offset, int count) {
if (count < 6) throw new IllegalArgumentException("Polygons must contain at least 3 points.");
if (count % 2 != 0) throw new IllegalArgumentException("Polygons must have an even number of vertices.");
check(ShapeType.Line, null, count);
float colorBits = color.toFloatBits();
float firstX = vertices[0];
float firstY = vertices[1];
for (int i = offset, n = offset + count; i < n; i += 2) {
float x1 = vertices[i];
float y1 = vertices[i + 1];
float x2;
float y2;
if (i + 2 >= count) {
x2 = firstX;
y2 = firstY;
} else {
x2 = vertices[i + 2];
y2 = vertices[i + 3];
}
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
}
}
/** @see #polygon(float[], int, int) */
public void polygon (float[] vertices) {
polygon(vertices, 0, vertices.length);
}
/** Draws a polyline in the x/y plane using {@link ShapeType#Line}. The vertices must contain at least 2 points (4 floats
* x,y). */
public void polyline (float[] vertices, int offset, int count) {
if (count < 4) throw new IllegalArgumentException("Polylines must contain at least 2 points.");
if (count % 2 != 0) throw new IllegalArgumentException("Polylines must have an even number of vertices.");
check(ShapeType.Line, null, count);
float colorBits = color.toFloatBits();
for (int i = offset, n = offset + count - 2; i < n; i += 2) {
float x1 = vertices[i];
float y1 = vertices[i + 1];
float x2;
float y2;
x2 = vertices[i + 2];
y2 = vertices[i + 3];
renderer.color(colorBits);
renderer.vertex(x1, y1, 0);
renderer.color(colorBits);
renderer.vertex(x2, y2, 0);
}
}
/** @see #polyline(float[], int, int) */
public void polyline (float[] vertices) {
polyline(vertices, 0, vertices.length);
}
/** Checks whether the correct ShapeType was set. If not and autoShapeType is enabled, it flushes the batch and changes the
* shape type. The batch is also flushed, when the matrix has been changed or not enough vertices remain.
*
* @param preferred usually ShapeType.Line
* @param other usually ShapeType.Filled. May be null.
* @param newVertices vertices count of geometric figure you want to draw */
protected final void check (ShapeType preferred, ShapeType other, int newVertices) {
if (shapeType == null) throw new IllegalStateException("begin must be called first.");
if (shapeType != preferred && shapeType != other) {
// Shape type is not valid.
if (!autoShapeType) {
if (other == null)
throw new IllegalStateException("Must call begin(ShapeType." + preferred + ").");
else
throw new IllegalStateException("Must call begin(ShapeType." + preferred + ") or begin(ShapeType." + other + ").");
}
end();
begin(preferred);
} else if (matrixDirty) {
// Matrix has been changed.
ShapeType type = shapeType;
end();
begin(type);
} else if (renderer.getMaxVertices() - renderer.getNumVertices() < newVertices) {
// Not enough space.
ShapeType type = shapeType;
end();
begin(type);
}
}
/** Finishes the batch of shapes and ensures they get rendered. */
public void end () {
renderer.end();
shapeType = null;
}
public void flush () {
ShapeType type = shapeType;
if (type == null) return;
end();
begin(type);
}
/** Returns the current shape type. */
public ShapeType getCurrentType () {
return shapeType;
}
public ImmediateModeRenderer getRenderer () {
return renderer;
}
/** @return true if currently between begin and end. */
public boolean isDrawing () {
return shapeType != null;
}
public void dispose () {
renderer.dispose();
}
}
| -1 |
libgdx/libgdx | 7,250 | chore: Update to gwt 2.10.0 | I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | SimonIT | "2023-10-06T10:43:44Z" | "2023-11-12T07:23:11Z" | e688cf718d56048bd9ab3e61180b93ee46f399d7 | 93503b4120f2c6002c7b1ecc73fc36bef4b678a0 | chore: Update to gwt 2.10.0. I don't know why there's no dtd for 2.10.0, so I chose the dtd from 2.9.0 | ./extensions/gdx-setup/res/com/badlogic/gdx/setup/resources/ios/data/Media.xcassets/AppIcon.appiconset/[email protected] | PNG
IHDR : : J( sBIT|d pHYs K Kl tEXtSoftware www.inkscape.org< IDAThOLUofYdwfʡ]ԨWb$?Op?mT(jIb@cx17b7dk݃tm]vٝSM5y_{,1@'_ʆ'*lxʆ'*lxʆ'*l_H$躎ia8 ]]](& |