Skip to content

Commit

Permalink
Refactor Member annotation into Std430Writer
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Nov 2, 2019
1 parent e7ababb commit 3a903d2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.demo.util.*;
import org.lwjgl.demo.util.KDTree.*;
import org.lwjgl.demo.util.Std430Writer.*;
import org.lwjgl.demo.util.WavefrontMeshLoader.Mesh;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.GL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.lwjgl.assimp.Assimp;
import org.lwjgl.demo.opengl.util.DemoUtils;
import org.lwjgl.demo.util.DynamicByteBuffer;
import org.lwjgl.demo.util.Member;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.*;
import org.lwjgl.system.*;
Expand Down
26 changes: 0 additions & 26 deletions src/org/lwjgl/demo/util/Member.java

This file was deleted.

17 changes: 17 additions & 0 deletions src/org/lwjgl/demo/util/Std430Writer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package org.lwjgl.demo.util;

import java.lang.annotation.*;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
Expand All @@ -21,6 +22,22 @@
*/
public class Std430Writer {

/**
* Used to annotate a struct member (i.e. field in a class representing a GLSL struct).
*
* @author Kai Burjack
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Member {

/**
* If that member is an array, this indicates the static size of the array.
*/
int length() default 0;

}

private static final Map<Class<?>, Integer> SIZES = new IdentityHashMap<Class<?>, Integer>();
static {
SIZES.put(int.class, Integer.valueOf(1));
Expand Down

0 comments on commit 3a903d2

Please sign in to comment.