pjalsGit

pjalsGit

e

Member Since 5 years ago

0.4miles away from my laptop

Experience Points
18
follower
Lessons Completed
65
follow
Lessons Completed
154
stars
Best Reply Awards
44
repos

223 contributions in the last year

Pinned
⚡ 🧛🏻‍♂️ Dark theme for Vim
⚡ SMLinux but in TypeScript.
⚡ A bridge between flying-squid, dazed-sheep, and vice-versa.
⚡ Display and control your Android device (old for intel devices)
⚡ The best authentication plugin for the Bukkit/Spigot API!
Activity
May
17
4 days ago
Activity icon
issue

pjalsGit issue comment coppolaemilio/dialogic

pjalsGit
pjalsGit

Name label disappears after question

The problem

Describe the bug For some reason, when I make a question to a character with a custom theme, the name label of the next character disappears.

To Reproduce Steps to reproduce the behavior:

  1. Make a question
  2. Put a text event in the choice branch
  3. Play timeline
  4. See that name label disappears

Expected behavior For the name label not to disappear.

Screenshots

https://user-images.githubusercontent.com/25231103/168756056-e5835b87-894f-4b98-99ea-0e9cf5fc0819.mp4

(yea i had some fun making the bug report)

Niko's custom theme has "Hide name labels" off. Player's custom theme has "Hide name labels" on.

System (please complete the following information):

  • OS: Fedora Linux 35
  • Godot Version: 3.
  • Dialogic Version: 2efa1a0

Solutions

Workaround

Disable name labels and act like it didn't happen.

Possible fixes

Not sure.

pjalsGit
pjalsGit

Player has a custom theme which looks completely different from Niko's, and it would look weird if Niko would be speaking in Player's theme.

Activity icon
issue

pjalsGit issue coppolaemilio/dialogic

pjalsGit
pjalsGit

Name label disappears after question

The problem

Describe the bug For some reason, when I make a question to a character with a custom theme, the name label of the next character disappears.

To Reproduce Steps to reproduce the behavior:

  1. Make a question
  2. Put a text event in the choice branch
  3. Play timeline
  4. See that name label disappears

Expected behavior For the name label not to disappear.

Screenshots

https://user-images.githubusercontent.com/25231103/168756056-e5835b87-894f-4b98-99ea-0e9cf5fc0819.mp4

Niko's custom theme has "Hide name labels" off. Player's custom theme has "Hide name labels" on.

System (please complete the following information):

  • OS: Fedora Linux 35
  • Godot Version: 3.
  • Dialogic Version: 2efa1a0

Solutions

Workaround

Disable name labels and act like it didn't happen.

Possible fixes

Not sure.

May
16
5 days ago
Activity icon
issue

pjalsGit issue coppolaemilio/dialogic

pjalsGit
pjalsGit

Very short typing sound effects don't stop playing

The problem

When I try to set the typing sound effect to a very short one, it keeps looping and never stops.

Even if I go to another tab, it continues.

To Reproduce Steps to reproduce the behavior:

  1. Go to the theme editor
  2. Go to audio tab
  3. Set a very short audio file
  4. See that it keeps looping, instead of stopping when dialog stops

Expected behavior The looping should stop as soon as the dialog stops.

Screenshots

https://user-images.githubusercontent.com/25231103/168620502-4e02bef3-2e76-4039-9806-83fbfca16e6a.mp4

This is the audio file I'm using: https://envs.sh/EyA.wav It's around 00.06 seconds long, bitrate: 722 kb/s.

System (please complete the following information):

  • OS: Fedora Linux 35
  • Godot Version: 3.3.3.stable
  • Dialogic Version: 1.4.1

Solutions

Workaround

None yet.

Possible fixes

Not sure.

Activity icon
issue

pjalsGit issue comment coppolaemilio/dialogic

pjalsGit
pjalsGit

Very short typing sound effects don't stop playing

The problem

When I try to set the typing sound effect to a very short one, it keeps looping and never stops.

Even if I go to another tab, it continues.

To Reproduce Steps to reproduce the behavior:

  1. Go to the theme editor
  2. Go to audio tab
  3. Set a very short audio file
  4. See that it keeps looping, instead of stopping when dialog stops

Expected behavior The looping should stop as soon as the dialog stops.

Screenshots

https://user-images.githubusercontent.com/25231103/168620502-4e02bef3-2e76-4039-9806-83fbfca16e6a.mp4

This is the audio file I'm using: https://envs.sh/EyA.wav It's around 00.06 seconds long, bitrate: 722 kb/s.

System (please complete the following information):

  • OS: Fedora Linux 35
  • Godot Version: 3.3.3.stable
  • Dialogic Version: 1.4.1

Solutions

Workaround

None yet.

Possible fixes

Not sure.

pjalsGit
pjalsGit

For some reason, Godot automatically put looping on, thank you!

Activity icon
issue

pjalsGit issue coppolaemilio/dialogic

pjalsGit
pjalsGit

Very short typing sound effects don't stop playing

The problem

When I try to set the typing sound effect to a very short one, it keeps looping and never stops.

Even if I go to another tab, it continues.

To Reproduce Steps to reproduce the behavior:

  1. Go to the theme editor
  2. Go to audio tab
  3. Set a very short audio file
  4. See that it keeps looping, instead of stopping when dialog stops

Expected behavior The looping should stop as soon as the dialog stops.

Screenshots

https://user-images.githubusercontent.com/25231103/168620502-4e02bef3-2e76-4039-9806-83fbfca16e6a.mp4

This is the audio file I'm using: https://envs.sh/EyA.wav It's around 00.06 seconds long, bitrate: 722 kb/s.

System (please complete the following information):

  • OS: Linux
  • Godot Version: 3.3.3.stable
  • Dialogic Version: 1.4.1

Solutions

Workaround

None yet.

Possible fixes

Not sure.

started
started time in 4 days ago
Activity icon
issue

pjalsGit issue comment coppolaemilio/dialogic

pjalsGit
pjalsGit

Choice button styles not saving

The problem

Describe the bug The choice button background textures and text color reset every time I open Godot. It seems to only be the choice buttons that get affected by this.

To Reproduce Steps to reproduce the behavior:

  1. Go to Choice Buttons and change them.
  2. Close and open Godot.
  3. They reset to their default state. (for me, at least)

System (please complete the following information):

  • OS: Windows 10
  • Godot Version: 3.3.3
  • Dialogic Version: 1.4
pjalsGit
pjalsGit

I also have this problem but with timelines, characters, themes, etc.

May
12
1 week ago
May
10
1 week ago
started
started time in 1 week ago
May
7
2 weeks ago
started
started time in 1 week ago
started
started time in 1 week ago
Activity icon
issue

pjalsGit issue BrainJS/brain.js

pjalsGit
pjalsGit

Add Deno support

Summary

This probably would take way too much time, but Deno is a simple, modern and secure runtime for JavaScript, TypeScript, and WebAssembly that uses V8 and is built in Rust and I would like that brain.js would be ported to Deno without a CDN and compatibility mode.

Basic example

import brain from 'https://deno.land/x/brainjs/mod.[ts/js]'

// provide optional config object (or undefined). Defaults shown.
const config = {
  binaryThresh: 0.5,
  hiddenLayers: [3], // array of ints for the sizes of the hidden layers in the network
  activation: 'sigmoid', // supported activation types: ['sigmoid', 'relu', 'leaky-relu', 'tanh'],
  leakyReluAlpha: 0.01, // supported for activation type 'leaky-relu'
};

// create a simple feed forward neural network with backpropagation
const net = new brain.NeuralNetwork(config);

net.train([
  { input: [0, 0], output: [0] },
  { input: [0, 1], output: [1] },
  { input: [1, 0], output: [1] },
  { input: [1, 1], output: [0] },
]);

const output = net.run([1, 0]); // [0.987]

Motivation

To add support for Deno so developers that use Deno can use this library easier.

May
6
2 weeks ago
May
4
2 weeks ago
started
started time in 2 weeks ago
May
3
2 weeks ago
Activity icon
issue

pjalsGit issue TypeScriptToLua/TypeScriptToLua

pjalsGit
pjalsGit

Transpile _delete to delete

TSTL should transpile _delete to delete because Lua supports having table keys and variables that are named "delete".

For example:

// _G.d.ts

declare namespace fs {
	...
	export function delete(path: string): void;
	...
}

will error in JavaScript, but with this feature, you can replace delete with _delete like:

declare namespace fs {
	...
	export function _delete(path: string): void;
	...
}

Sorry if this is already implemented, it isn't mentioned in the docs.

Activity icon
issue

pjalsGit issue comment TypeScriptToLua/TypeScriptToLua

pjalsGit
pjalsGit

Transpile _delete to delete

TSTL should transpile _delete to delete because Lua supports having table keys and variables that are named "delete".

For example:

// _G.d.ts

declare namespace fs {
	...
	export function delete(path: string): void;
	...
}

will error in JavaScript, but with this feature, you can replace delete with _delete like:

declare namespace fs {
	...
	export function _delete(path: string): void;
	...
}

Sorry if this is already implemented, it isn't mentioned in the docs.

pjalsGit
pjalsGit

Apparently you can replace delete with 'delete'.

started
started time in 2 weeks ago
started
started time in 2 weeks ago
Apr
22
4 weeks ago
started
started time in 4 weeks ago
Apr
21
1 month ago
Activity icon
issue

pjalsGit issue comment denoland/deno

pjalsGit
pjalsGit

Proposal: add `Deno.getUserFullName()`

This function allows you to view the GECOS or "Full/Display Name" of the account.

I'm not sure if it should be Deno.getUserFullName, Deno.getUserGecos or Deno.getUserDisplayName

It might be a long name so suggestions appreciated. I actually already did this in this snippet, but this should probably be better as a Deno built-in function:

const getFullName = async (username: string, fullNameDefaultUsername = false, passwdPath: PathLike = '/etc/passwd'): Promise<string | void> => {
  if (Deno.build.os === 'windows') {
    const fullNameProcess = await Deno.run({
      cmd: ['wmic', 'useraccount', 'where', `name='${username}'`, 'get', 'fullname'],
      stdout: 'piped'
    });

    if ((!fullName) && fullNameDefaultUsername) { fullName = username; }
    
    return username
  } else if (Deno.build.os === 'linux' || Deno.build.os === 'darwin') {
    const decoder = new TextDecoder();
    const file = await Deno.readFile(passwdPath);
    const data = decoder.decode(file);

    const passwdLines = data.split('\n');
    passwdLines.shift();
    for (const line of passwdLines) {
      const parts = line.split(':');
      if (parts[0] === username) {
        return parts[4]
      }
    }
  }
};
Apr
20
1 month ago
Activity icon
issue

pjalsGit issue comment alacritty/alacritty

pjalsGit
pjalsGit

ANSI not working correctly

System

OS: Fedora 35 Version: alacritty 0.10.1 Protocol: Wayland DE/WM: Gnome TERM env var: alacritty

Screenshots

image image image

What am I doing?

I'm trying to print a colored character in Deno with ANSI (with await Deno.stderr.write(new TextEncoder().encode(`\x9B38;2;${r};${g};${b}m${char}`));), but Alacritty and libvterm doesn't support it. GNOME Terminal, and VSCode does.

pjalsGit
pjalsGit

Replacing \x9b with \x1b[ fixes it, Alacritty should support one-character CSI (\x9b)

Activity icon
issue

pjalsGit issue alacritty/alacritty

pjalsGit
pjalsGit

ANSI not working correctly

System

OS: Fedora 35 Version: alacritty 0.10.1 Protocol: Wayland DE/WM: Gnome

Screenshots

image image image

What am I doing?

I'm trying to print a colored character in Deno with ANSI (with await Deno.stderr.write(new TextEncoder().encode(`\x9B38;2;${r};${g};${b}m${char}`));), but Alacritty and libvterm doesn't support it. GNOME Terminal, and VSCode does.

Apr
16
1 month ago
started
started time in 1 month ago
Apr
9
1 month ago
started
started time in 1 month ago
Apr
6
1 month ago
Activity icon
issue

pjalsGit issue RayTracing/raytracing.github.io

pjalsGit
pjalsGit

[Book 1] Dielectric material is transparent black?

I have no idea how I caused this, first it was completely black, then it was transparent but not upside down and then it's transparent black?

image

My code is (slightly copied because i thought maybe i typed it wrong):

// material.h
class dielectric : public material {
  public:
    dielectric(double index_of_refraction) : ir(index_of_refraction) {}

    bool scatter(const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered)
    const override {
        attenuation = color(1.0, 1.0, 1.0);
        double refraction_ratio = rec.front_face ? (1.0/ir) : ir;

        vec3 unit_direction = unit_vector(r_in.direction());
        double cos_theta = fmin(dot(-unit_direction, rec.normal), 1.0);
        double sin_theta = sqrt(1.0 - cos_theta*cos_theta);

        bool cannot_refract = refraction_ratio * sin_theta > 1.0;
        vec3 direction;
        if (cannot_refract || reflectance(cos_theta, refraction_ratio) > random_double())
            direction = reflect(unit_direction, rec.normal);
        else
            direction = refract(unit_direction, rec.normal, refraction_ratio);

        scattered = ray(rec.p, direction);
        return true;
    }

  public:
    double ir; // Index of Refraction

  private:
  	static double reflectance(double cosine, double index) {
			double r0 = (1 - index) / (1 + index);
			r0 = r0 * r0;
			return r0 + (1 - r0) * pow((1 - cosine), 5);
  	}
};

// main.cc


color ray_color(const ray& r, const hittable& world, int depth) {
	hit_record rec;
	
	if (depth <= 0)
		return color(0, 0, 0);

	if (world.hit(r, interval(0.001, infinity), rec)) {
		ray scattered;
		color attenuation;
		if (rec.mat->scatter(r, rec, attenuation, scattered))
			return attenuation * ray_color(scattered, world, depth - 1);
		return color(0, 0, 0);
	}
	vec3 unit_direction = unit_vector(r.direction());
	auto t = 0.5 * (unit_direction.y() + 1.0);
	return (1.0 - t) * color(1.0, 1.0, 1.0) + t * color(0.5, 0.7, 1.0);
}

// ...
	auto ground_material = make_shared<lambertian>(color(0.3, 0.7, 0.4));
	auto center_material = make_shared<dielectric>(1.5);
	auto left_material = make_shared<dielectric>(1.5);
	auto right_material = make_shared<metal>(color(0.8, 0.8, 0.8), 0.8);

	world.add(make_shared<sphere>(point3(0, -100.5, -1), 100, ground_material));
	world.add(make_shared<sphere>(point3(0, 0, -1), 0.5, center_material));
	world.add(make_shared<sphere>(point3(-1, 0, -1), 0.5, left_material));
	world.add(make_shared<sphere>(point3(1, 0, -1), 0.5, right_material));

// vec3.h
inline vec3 refract(const vec3& uv, const vec3& n, double etai_over_etat) {
	auto cos_theta = fmin(dot(-uv, n), 1.0);
	vec3 r_out_perp = etai_over_etat * (uv + cos_theta*n);
	vec3 r_out_parallel = -sqrt(fabs(1.0 - r_out_perp.length_squared())) * n;
	return r_out_parallel + r_out_perp;
}

// sphere.h

		bool hit(const ray& r, interval ray_t, hit_record& rec) const override {
			vec3 oc = r.origin() - center;
			auto a = r.direction().length_squared();
			auto half_b = dot(oc, r.direction());
			auto c = oc.length_squared() - radius * radius;

			auto discriminant = half_b * half_b - a * c;
			if (discriminant < 0) return false;

			auto sqrtd = sqrt(discriminant);

			// Find nearest root that lies in the acceptable range
			
			auto root = (-half_b - sqrtd) / a;
			if (!ray_t.contains(root)) {
				root = (-half_b + sqrtd) / a;
				if (!ray_t.contains(root)) return false;
			}

			rec.t = root;
			rec.p = r.at(rec.t);
			vec3 outward_normal = (rec.p - center) / radius;
			rec.set_face_normal(r, outward_normal);
			rec.normal = (rec.p - center) / radius;
			rec.mat = mat;

			return true;
		}

Those are some places I could think of where this is happening.

Activity icon
issue

pjalsGit issue comment RayTracing/raytracing.github.io

pjalsGit
pjalsGit

[Book 1] Dielectric material is transparent black?

I have no idea how I caused this, first it was completely black, then it was transparent but not upside down and then it's transparent black?

image

My code is (slightly copied because i thought maybe i typed it wrong):

// material.h
class dielectric : public material {
  public:
    dielectric(double index_of_refraction) : ir(index_of_refraction) {}

    bool scatter(const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered)
    const override {
        attenuation = color(1.0, 1.0, 1.0);
        double refraction_ratio = rec.front_face ? (1.0/ir) : ir;

        vec3 unit_direction = unit_vector(r_in.direction());
        double cos_theta = fmin(dot(-unit_direction, rec.normal), 1.0);
        double sin_theta = sqrt(1.0 - cos_theta*cos_theta);

        bool cannot_refract = refraction_ratio * sin_theta > 1.0;
        vec3 direction;
        if (cannot_refract || reflectance(cos_theta, refraction_ratio) > random_double())
            direction = reflect(unit_direction, rec.normal);
        else
            direction = refract(unit_direction, rec.normal, refraction_ratio);

        scattered = ray(rec.p, direction);
        return true;
    }

  public:
    double ir; // Index of Refraction

  private:
  	static double reflectance(double cosine, double index) {
			double r0 = (1 - index) / (1 + index);
			r0 = r0 * r0;
			return r0 + (1 - r0) * pow((1 - cosine), 5);
  	}
};

// main.cc


color ray_color(const ray& r, const hittable& world, int depth) {
	hit_record rec;
	
	if (depth <= 0)
		return color(0, 0, 0);

	if (world.hit(r, interval(0.001, infinity), rec)) {
		ray scattered;
		color attenuation;
		if (rec.mat->scatter(r, rec, attenuation, scattered))
			return attenuation * ray_color(scattered, world, depth - 1);
		return color(0, 0, 0);
	}
	vec3 unit_direction = unit_vector(r.direction());
	auto t = 0.5 * (unit_direction.y() + 1.0);
	return (1.0 - t) * color(1.0, 1.0, 1.0) + t * color(0.5, 0.7, 1.0);
}

// ...
	auto ground_material = make_shared<lambertian>(color(0.3, 0.7, 0.4));
	auto center_material = make_shared<dielectric>(1.5);
	auto left_material = make_shared<dielectric>(1.5);
	auto right_material = make_shared<metal>(color(0.8, 0.8, 0.8), 0.8);

	world.add(make_shared<sphere>(point3(0, -100.5, -1), 100, ground_material));
	world.add(make_shared<sphere>(point3(0, 0, -1), 0.5, center_material));
	world.add(make_shared<sphere>(point3(-1, 0, -1), 0.5, left_material));
	world.add(make_shared<sphere>(point3(1, 0, -1), 0.5, right_material));

// vec3.h
inline vec3 refract(const vec3& uv, const vec3& n, double etai_over_etat) {
	auto cos_theta = fmin(dot(-uv, n), 1.0);
	vec3 r_out_perp = etai_over_etat * (uv + cos_theta*n);
	vec3 r_out_parallel = -sqrt(fabs(1.0 - r_out_perp.length_squared())) * n;
	return r_out_parallel + r_out_perp;
}

// sphere.h

		bool hit(const ray& r, interval ray_t, hit_record& rec) const override {
			vec3 oc = r.origin() - center;
			auto a = r.direction().length_squared();
			auto half_b = dot(oc, r.direction());
			auto c = oc.length_squared() - radius * radius;

			auto discriminant = half_b * half_b - a * c;
			if (discriminant < 0) return false;

			auto sqrtd = sqrt(discriminant);

			// Find nearest root that lies in the acceptable range
			
			auto root = (-half_b - sqrtd) / a;
			if (!ray_t.contains(root)) {
				root = (-half_b + sqrtd) / a;
				if (!ray_t.contains(root)) return false;
			}

			rec.t = root;
			rec.p = r.at(rec.t);
			vec3 outward_normal = (rec.p - center) / radius;
			rec.set_face_normal(r, outward_normal);
			rec.normal = (rec.p - center) / radius;
			rec.mat = mat;

			return true;
		}

Those are some places I could think of where this is happening.

pjalsGit
pjalsGit

Fixed by commenting out rec.normal = ...

Activity icon
issue

pjalsGit issue RayTracing/raytracing.github.io

pjalsGit
pjalsGit

[Book 1] Dielectric material is transparent black?

I have no idea how I caused this, first it was completely black, then it was transparent but not upside down and then it's transparent black?

image

My code is (slightly copied because i thought maybe i typed it wrong):

// material.h
class dielectric : public material {
  public:
    dielectric(double index_of_refraction) : ir(index_of_refraction) {}

    bool scatter(const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered)
    const override {
        attenuation = color(1.0, 1.0, 1.0);
        double refraction_ratio = rec.front_face ? (1.0/ir) : ir;

        vec3 unit_direction = unit_vector(r_in.direction());
        double cos_theta = fmin(dot(-unit_direction, rec.normal), 1.0);
        double sin_theta = sqrt(1.0 - cos_theta*cos_theta);

        bool cannot_refract = refraction_ratio * sin_theta > 1.0;
        vec3 direction;
        if (cannot_refract || reflectance(cos_theta, refraction_ratio) > random_double())
            direction = reflect(unit_direction, rec.normal);
        else
            direction = refract(unit_direction, rec.normal, refraction_ratio);

        scattered = ray(rec.p, direction);
        return true;
    }

  public:
    double ir; // Index of Refraction

  private:
  	static double reflectance(double cosine, double index) {
			double r0 = (1 - index) / (1 + index);
			r0 = r0 * r0;
			return r0 + (1 - r0) * pow((1 - cosine), 5);
  	}
};

// main.cc


color ray_color(const ray& r, const hittable& world, int depth) {
	hit_record rec;
	
	if (depth <= 0)
		return color(0, 0, 0);

	if (world.hit(r, interval(0.001, infinity), rec)) {
		ray scattered;
		color attenuation;
		if (rec.mat->scatter(r, rec, attenuation, scattered))
			return attenuation * ray_color(scattered, world, depth - 1);
		return color(0, 0, 0);
	}
	vec3 unit_direction = unit_vector(r.direction());
	auto t = 0.5 * (unit_direction.y() + 1.0);
	return (1.0 - t) * color(1.0, 1.0, 1.0) + t * color(0.5, 0.7, 1.0);
}

Those are the two places I could think of where this is happening.

Activity icon
issue

pjalsGit issue RayTracing/raytracing.github.io

pjalsGit
pjalsGit

Lambertian material erroring with "member access into incomplete type ..."

For some reason the Lambertian material is erroring with member access into incomplete type 'const hit_record', here is the code that is most relevant:

class lambertian : public material {
	public:
		lambertian(const color& a) : albedo(a) {}
		bool scatter(const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered)
		const override {
			auto scatter_direction = rec.normal + random_in_unit_sphere();
								// error^
			// Catch degenerate scatter direction
			if (scatter_direction.near_zero())
				scatter_direction = rec.normal
								//error^

			scattered = ray(rec.p, scatter_direction);
			// no error here?^
			attenuation = albedo;
			return true;
		}
	public:
		color albedo;
};
Activity icon
issue

pjalsGit issue comment RayTracing/raytracing.github.io

pjalsGit
pjalsGit

Lambertian material erroring with "member access into incomplete type ..."

For some reason the Lambertian material is erroring with member access into incomplete type 'const hit_record', here is the code that is most relevant:

class lambertian : public material {
	public:
		lambertian(const color& a) : albedo(a) {}
		bool scatter(const ray& r_in, const hit_record& rec, color& attenuation, ray& scattered)
		const override {
			auto scatter_direction = rec.normal + random_in_unit_sphere();
								// error^
			// Catch degenerate scatter direction
			if (scatter_direction.near_zero())
				scatter_direction = rec.normal
								//error^

			scattered = ray(rec.p, scatter_direction);
			// no error here?^
			attenuation = albedo;
			return true;
		}
	public:
		color albedo;
};
pjalsGit
pjalsGit

I see that this is not a bug, so I will close this.

Previous